To capture network requests generated by an automated browser, attach request and response listeners before navigation or the action that triggers the traffic. Use Playwright events for passive logging, wait for a matching response when you need one API result, and use routing or a browser protocol when you need to intercept or change traffic. Only inspect traffic you are authorized to access.
Choose what to capture
“Scraping network requests” can mean several different things. Choose the least invasive API that returns the information you need:
- Request metadata: record the URL, method, and resource type as the browser sends each request.
- Response metadata: correlate a response with its URL and inspect status or headers once they arrive.
- Response body: read the body after the response has completed downloading. A response event alone does not mean the body is ready.
- Network interception: pause matching requests so you can modify, fulfill, or abort them. This changes browser behavior rather than merely observing it.
For broad logging, install listeners. For one known endpoint, wait for the corresponding request or response. For active interception, use Playwright routing or an appropriate browser protocol API.
Capture network requests with Playwright
Log requests and responses
Attach event handlers before calling goto() or triggering the page action. This minimal JavaScript example prints each request’s method and URL, then each response’s status and URL:
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 →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
page.on('request', request => {
console.log('>>', request.method(), request.url());
});
page.on('response', response => {
console.log('<<', response.status(), response.url());
});
await page.goto('https://example.com');
Playwright’s network documentation says page requests, including XHR and fetch, can be tracked, modified, and handled: Playwright Network. The example above observes traffic; it does not change or block requests.
Wait for one request or response
When an action triggers a known API call, create the wait promise before performing the action, then await it. Otherwise, a fast request could happen before the wait is registered.
const responsePromise = page.waitForResponse('**/api/fetch_data');
await page.getByText('Update').click();
const response = await responsePromise;
console.log(response.status(), response.url());
Playwright’s glob pattern must match the entire URL. The ** pattern can match across path separators; use a regular expression or predicate when the endpoint needs more precise matching, such as checking the host, query string, method, or response condition. See the Page API reference for waitForResponse and waitForRequest.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
If the needed data is in a response body, read it after the wait resolves and handle non-success statuses deliberately. For example, JSON APIs can be read with await response.json(); body-reading methods are documented in the Playwright Response API.
Use routing for network interception
Use page.route() or browserContext.route() when a matching request must be modified, fulfilled with a supplied response, or aborted. Routed requests stall until the handler deals with them, so always continue, fulfill, or abort each matching request as appropriate. For example, to log a request and let it proceed:
await page.route('**/api/**', async route => {
console.log(route.request().method(), route.request().url());
await route.continue();
});
await page.goto('https://example.com');
Routing is not required for ordinary logging. Keep observation and interception separate unless the test needs to alter network behavior.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Understand request, response, and completion events
These events represent different points in a request’s lifecycle:
- Request: the browser issues the request.
- Response: response status and headers have arrived.
- Request finished: the response body has finished downloading.
If the client does not receive an HTTP response because of a network error or timeout, Playwright can emit requestfailed instead. An HTTP error status such as 404 or 503 is still an HTTP response; it is not, by itself, a failed request. Use the response status to identify HTTP errors and failure events to investigate transport or loading problems. See Playwright’s Request API.
Choose Selenium WebDriver BiDi or CDP when appropriate
Selenium WebDriver BiDi
If the automation already uses Selenium, WebDriver BiDi can stream browser events over a WebSocket, including network events. Enable the webSocketUrl capability using the syntax for your Selenium language binding, then subscribe to the network events that binding and browser expose. The exact APIs and coverage depend on the browser, driver, Selenium binding, and their versions; verify the specific operation in your deployed environment rather than assuming every combination supports it.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Selenium describes BiDi as the bidirectional path aligned with the W3C specification, with APIs growing as browser vendors implement the standard. Selenium’s CDP support is described as temporary while BiDi is implemented. Consult Selenium WebDriver BiDi documentation and the W3C WebDriver BiDi specification for current details.
Chrome DevTools Protocol
CDP is a lower-level option for direct Chrome protocol operations, not a cross-browser standard. Its Network domain provides request and response events and methods for tasks such as retrieving request post data or response bodies. Choose it when your automation specifically needs Chrome DevTools Protocol access and the library exposes the required Network-domain methods. Check the Chrome DevTools Protocol Network reference for current protocol details.
| Option | Best fit | Important qualification |
|---|---|---|
| Playwright events | Passive logging or waiting for a request or response in a Playwright test | Use routing only when traffic must be handled or changed. |
| Selenium WebDriver BiDi | Event streaming in Selenium where the needed BiDi network operation is supported | Support varies by browser and binding as implementations evolve. |
| CDP Network domain | Direct access to Chrome protocol network events and methods | Chrome-specific protocol, not a cross-browser standard. |
Troubleshoot missing or unexpected traffic
The listener misses the request
Register listeners or create the wait promise before navigation or the click that triggers the call. If traffic may come from a popup, inspect the popup’s page as well as the original page; page-level listeners do not automatically mean every page in a context is covered.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Playwright routing does not see a request
Check whether a Service Worker handles the traffic. Playwright warns that native page.route() and browserContext.route() may appear to miss requests when Service Workers are active. If the test permits disabling them, create the context with serviceWorkers: 'block'. If you need to observe or intercept Service Worker requests themselves, use Playwright’s dedicated Service Worker guidance instead.
A request appears failed even though the server returned an error
Distinguish an HTTP response with an error status from a request that never received an HTTP response. A 404 or 503 belongs to the response path; investigate requestfailed for connectivity errors, timeouts, or similar client-side failures.
BiDi events are unavailable
Confirm that the browser, driver, Selenium version, language binding, and enabled webSocketUrl capability support the event or command you need. BiDi implementations are evolving, so a feature present in one browser and binding may not be available in another.
Or skip the browser setup
If you need a screenshot rather than a network log, ScreenshotNeo is a website screenshot API and MCP server. A single GET request returns a PNG, JPEG, WebP, or PDF; see the API documentation for parameters.
Recommended Free Tools
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with page verdict and billing details included in response headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for free.
Frequently Asked Questions
Does Playwright’s response event mean the response body is ready?
No. The response event provides status and headers; request completion follows after the body has downloaded. Read the body after completion using the documented response methods.
Can Selenium BiDi and CDP be treated as interchangeable?
No. BiDi is a developing W3C bidirectional standard supported according to browser and binding; CDP is Chrome-specific. Check whether the exact event or operation you need is supported in your deployed setup.
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.
Free tools Windows power users keep installed
One-click scans. No signup required.

