Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
A REST API playground is useful in browser automation when you need to prepare server state, inspect or assert API results, or give a page a controlled response. Use Playwright’s APIRequestContext for setup and postconditions, Playwright routing or HAR files to intercept requests made by the page, and a Postman mock server when several clients need a hosted endpoint built from saved examples. These workflows are complementary, not interchangeable.
What a REST API playground contributes to browser automation
Browser tests normally drive visible actions: open a page, fill a form, click a button, and check the result. An API playground adds a second control surface. You can send HTTP requests directly, inspect status codes and payloads, save reproducible examples, or replace a live response with a known fixture.
The important distinction is where the request is handled:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems- Direct API calls in the test: the test talks to a real endpoint to create, mutate, or verify server-side data.
- Browser-bound interception: Playwright catches a page request and fulfills it with a response you control. The page never has to receive the live backend response for that request.
- Hosted mocking: a service such as Postman serves saved collection examples at an endpoint that browsers, applications, or other test clients can call.
A mock proves client behavior for the response you supplied; it does not prove that the production backend would return that response. Use a live API request when backend correctness is part of the assertion.
Choose the workflow before writing a test
| Need | Best fit | What the test establishes | Trade-off |
|---|---|---|---|
| Create or inspect state around a UI flow | Playwright APIRequestContext |
The test issued setup or postcondition requests to an API. | It depends on a reachable service, suitable test data, and valid authentication. |
| Make page behavior deterministic | Playwright page.route or HAR mocking |
The page rendered against the exact response supplied by the test. | It does not verify the live backend’s response. |
| Share endpoint examples with several clients | Postman mock server | A hosted endpoint can return saved collection examples, with dynamic responses when configured. | You must maintain collections and examples; private mocks require an API key according to Postman’s tutorial. |
| Run API assertions outside the UI | Postman collection tests or framework requests | Scripts can assert responses and collections can be run manually or automatically. | This is an API-testing workflow, not page-traffic interception. |
Decide whether the test needs a real backend, whether API calls must share browser cookies, where state is created and checked, whether responses should be fixed or variable, and whether a mock must be reachable outside one test process.
Use Playwright APIRequestContext for setup and postconditions
Playwright can send HTTP(S) requests without navigating a page. Its API-testing guidance describes using requests to prepare data before a browser flow and to check or clean up state afterward. That often keeps UI steps focused on user-visible behavior rather than making every prerequisite through the interface.
Cookie and context choices
A request object obtained from a browser context shares that context’s cookie jar. This is useful after a UI login when an API call should act as the same user. A separately created request context has isolated cookie storage, which is safer for independent service-account setup.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →import { test, expect, request } from '@playwright/test';
test('create data through the API, then verify it in the UI', async ({ browser }) => {
const context = await browser.newContext({
baseURL: process.env.APP_URL,
storageState: process.env.AUTH_STATE
});
const api = await context.request;
const create = await api.post('/api/projects', {
data: { name: 'automation-fixture' }
});
expect(create.ok()).toBeTruthy();
const project = await create.json();
const page = await context.newPage();
await page.goto(`/projects/${project.id}`);
await expect(page.getByRole('heading', { name: project.name })).toBeVisible();
const remove = await api.delete(`/api/projects/${project.id}`);
expect(remove.ok()).toBeTruthy();
await context.close();
});
In a real suite, supply APP_URL, storage state, and credentials through your CI secret store. Do not commit tokens or use a shared production account. If the endpoint requires a bearer token rather than browser cookies, create an isolated request context and pass an Authorization header.
Assert the server-side outcome after a UI action
test('UI action persists an order', async ({ page, request }) => {
await page.goto('/checkout');
await page.getByRole('button', { name: 'Place order' }).click();
await expect(page.getByText('Order confirmed')).toBeVisible();
const result = await request.get('/api/orders?reference=automation-fixture');
expect(result.ok()).toBeTruthy();
const orders = await result.json();
expect(orders).toEqual(expect.arrayContaining([
expect.objectContaining({ status: 'confirmed' })
]));
});
Keep cleanup in the same test or a fixture, and make identifiers unique enough that parallel workers cannot delete one another’s data. A failed cleanup should be visible in CI; otherwise later tests inherit misleading state.
Intercept page traffic with routes or HAR files
Playwright’s mock-API documentation states: “Playwright provides APIs to mock and modify network traffic, both HTTP and HTTPS.” Routing covers requests made by the page, including XHR and fetch. Fulfill a matching request with a fixture when the purpose is to test rendering, loading, empty, error, or edge-case states.
Rank #2
Fulfill a controlled JSON response
import { test, expect } from '@playwright/test';
test('renders an empty activity feed', async ({ page }) => {
await page.route('**/api/activity**', async route => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ items: [], nextCursor: null })
});
});
await page.goto('/activity');
await expect(page.getByText('No activity yet')).toBeVisible();
});
The route is active before navigation, so the initial request is intercepted. Match narrowly enough to avoid hiding unrelated calls. You can inspect the incoming request, branch on query parameters, or continue selected requests to the real service:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
await page.route('**/api/products**', async route => {
const request = route.request();
if (request.method() !== 'GET') {
await route.continue();
return;
}
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ products: [{ id: 'p-1', name: 'Mock keyboard' }] })
});
});
Use HAR replay for a larger interaction
When a flow involves many requests, recording a HAR file and replaying it can be less brittle than maintaining each route by hand. Keep the HAR tied to the application version and update it deliberately when the contract changes. Replay still validates the page against recorded responses; it is not a live-backend test.
Test the limits of interception
- Register routes before the request occurs, normally before
page.goto. - Verify that your pattern matches the final URL, including query strings and redirects.
- Unregister routes or use a fresh page when a mock should not leak into another test.
- Include realistic status codes, headers, latency, malformed payloads, and empty collections when those states matter to the UI.
- Keep at least one separate suite that calls the real API, because an intercepted response can conceal a broken endpoint or schema.
Build a reusable hosted mock with Postman
Postman supports manual testing and test automation. In a collection, each request can have scripts that assert status codes, headers, or body fields. The collection can then be run manually or in an automated pipeline.
For a hosted mock, save one or more examples with the request. Postman’s mock server selects a saved example based on the incoming request; it does not invent arbitrary responses unless you configure the collection and examples for that behavior. A cloud mock can be called by a browser application, a separate test runner, or a teammate’s client, which is different from a Playwright route that exists only inside one test.
Set up the collection and example
- Create an HTTP collection in Postman and add the method, path, query parameters, and representative headers.
- Send the request once and save a successful example. Add additional examples for validation errors, authorization failures, empty results, and pagination if clients must exercise them.
- Create a mock server from the collection, then record its base URL and access setting.
- Point the browser or test client at the mock URL in a test environment. Keep the mock base URL in configuration rather than hard-coding it in application code.
- For a private mock, provide the API key required by Postman’s documented tutorial. Treat the key as a secret and rotate it if it is exposed.
A hosted mock is a good contract-development tool when frontend and backend work in parallel. It is a poor substitute for integration coverage: saved examples can drift from the live API, and public access may expose data you intended to keep private.
Practical decision path
- Need to sign in through the UI, then inspect or mutate state? Use a request object associated with the browser context if cookies should follow the login; otherwise use an isolated context with explicit credentials.
- Need to prove that a page handles a known payload? Intercept the page request and fulfill it with a fixture or HAR response. Label the test as client-behavior coverage.
- Need one endpoint that multiple clients can call? Create a Postman mock from a collection and saved examples. Decide whether public access is acceptable; private access requires the documented API key.
- Need API correctness independent of a browser? Put requests and scripted assertions in a collection or API test suite, then reserve browser automation for visible user journeys.
Or skip the browser setup
If your browser test also needs stable screenshots of the resulting page, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL and returns PNG, JPEG, WebP, or PDF. Before capture it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.
The API supports full-page screenshots with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper and margin settings, custom CSS and JavaScript, pre-capture clicks, selector hiding, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
Rank #3
- Contains one (1) API 5-IN-1 TEST STRIPS Freshwater and Saltwater Aquarium Test Strips 25-Count Box
- Monitors levels of pH, nitrite, nitrate carbonate and general water hardness in freshwater and saltwater aquariums
- Dip test strips into aquarium water and check colors for fast and accurate results
- Helps prevent invisible water problems that can be harmful to fish and cause fish loss
- Use for weekly monitoring and when water or fish problems appear
Use the parameter names documented by ScreenshotNeo; common screenshot-API parameter names are also accepted, which can simplify migration. See the ScreenshotNeo API documentation for the current option syntax.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Plans include 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan. Create a free ScreenshotNeo account to try the API.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Troubleshooting common failures
The API request returns 401 or 403
Check whether the endpoint expects browser cookies, a bearer token, an API key, or a CSRF header. Confirm that the test account has access to the target project and that CI is loading the intended secret. For a context-shared request, verify that login completed before the API call.
The setup request passes, but the page shows old data
Look for eventual consistency, client caching, service-worker caches, or a different base URL in the browser. Poll a documented read endpoint with a bounded timeout rather than adding an arbitrary long sleep. Ensure the UI is using the same tenant and identifier created by the setup call.
The route never fires
Register it before navigation, print the actual request URL, and account for query strings, redirects, and alternate API hosts. A service worker may satisfy the request before page routing sees it; disable or reset that worker in the test context when appropriate.
The mock makes a green test that fails in production
Add contract or integration coverage against a real test environment. Compare the fixture’s status, headers, pagination, error shape, and authentication behavior with the live API. Keep mocked UI tests and live API tests as separate, clearly named layers.
Parallel tests interfere with one another
Use per-test identifiers, isolated users or projects, and deterministic cleanup. Never let a shared hosted mock retain mutable state unless that behavior is explicitly part of the test. Reset routes and browser contexts between cases.
A Postman mock returns an unexpected example
Inspect the saved examples for method, path, query, and header differences. The mock selects among configured examples; update the matching request or add an explicit example for the case you need. Recheck private-mock authentication when the response is unauthorized.
Reliability, speed, and cost considerations
- API setup generally removes unnecessary UI navigation steps, but that is a workflow advantage, not a measured benchmark. Keep a small number of end-to-end UI setup tests so authentication and critical forms remain covered.
- Intercepted responses make edge cases repeatable and avoid dependence on backend availability during client tests. They also require fixture maintenance whenever the API contract changes.
- Hosted mocks centralize examples for several consumers, but availability, access policy, and example freshness become shared dependencies.
- Use timeouts, retries only for genuinely transient operations, and diagnostic logging of URL, status, and correlation ID. Do not retry assertion failures caused by bad fixtures.
- For screenshots, ScreenshotNeo’s verdict and billing headers let a pipeline distinguish a clean billed capture from a failed or non-billed result. Caching can be configured with a TTL you choose; disable or shorten it when validating rapidly changing pages.
Key takeaway
Use direct Playwright requests to create and verify real server state, Playwright routes or HAR files to test page behavior against controlled responses, and Postman hosted mocks to share saved examples across clients. Keep those claims separate in test names and reports so a passing mock test is never mistaken for proof that the live backend is correct.
Frequently Asked Questions
Can a Playwright APIRequestContext replace browser navigation?
No. It is best for API setup, cleanup, and assertions around a browser flow. It does not render pages or exercise user-visible interactions.
Does a Postman mock server automatically generate realistic data?
It serves responses from saved collection examples; dynamic behavior must be configured, and the matching request determines which example is returned.
Should mocked and live API tests use the same test?
Keep them as separate layers. Mocked tests isolate client behavior, while live tests establish what the real service returns.
Are browser cookies shared with every Playwright request context?
Only a request object associated with the browser context shares that context’s cookie jar. A newly created isolated request context has separate cookies.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

