Q1.Can Playwright be used for API testing? How?
This Playwright question checks whether you can go beyond textbook knowledge on Can Playwright be used for API testing? How and reason about it the way a working QA engineer does — with a definition, an example, and the edge case that usually comes up next.
Answer: Yes. Playwright Test provides a built-in request fixture, which is an APIRequestContext. It sends HTTP requests directly from Node.js without launching a browser, so API tests are fast. It supports get, post, put, patch, delete, head and a generic fetch.
import { test, expect } from '@playwright/test';
test('GET a user returns 200 and the right id', async ({ request }) => {
const response = await request.get('/api/users/1');
expect(response.status()).toBe(200);
const body = await response.json();
expect(body.id).toBe(1);
});- Anchor the answer in a real Playwright project — panels reward specificity on Can Playwright be used for API testing? How over textbook wording.
- Be ready to whiteboard the Can Playwright be used for API testing? How snippet live — panels often ask you to type it, not describe it.
- Explain setup/teardown ordering and what runs per-test vs per-suite; ordering mistakes are the follow-up question.

Discussion
Ask a question, share your experience, or correct us. Be kind — real people are reading.