Mobile proxy testing & planning

Reduce Playwright Proxy Bandwidth: A Measured Test

Measure a working browser task before blocking resources. Then compare one change at a time, keeping the required output as the pass condition. Fewer transferred bytes only help when the result remains usable.

Get the comparison script ↓By Proxies.sx Team · Reviewed
Reduce Playwright Proxy Bandwidth: A Measured Test. Proxies.sx logo and proxies.sx address on a dark background.

Choose an output you can verify

For a product-data task, write down the required fields and an expected value on a fixture you control. For a screenshot, images and fonts may be part of the output and should stay enabled. Use a small, permitted test workload with the same destination and proxy settings for each run.

Save the browser and Playwright versions with the proxy session mode. Record failed requests and the provider meter readings for the test window. A challenge page, partial response or wrong locale can be smaller than a successful result. Count those as failures instead of reporting their smaller size as a saving.

Block resources by type, with a bounded example

Download the Playwright comparison script. It runs two fresh contexts against a URL you supply: one allows requests, and the other blocks images, media and fonts. Both install a request handler and block service workers, so the comparison uses the same interception settings. Set a selector and exact expected text for the output check.

npm install playwright
npx playwright install chromium

TEST_URL=https://your-permitted-fixture.example/ \
CHECK_SELECTOR="[data-test=price]" \
EXPECTED_TEXT="19.00" \
node playwright-bandwidth.mjs

The script can read PROXY_SERVER, PROXY_USERNAME and PROXY_PASSWORD from your process environment. Configure secrets through your local secret manager or a private shell session. It does not print request URLs, response bodies or proxy credentials. Without proxy settings, it measures a direct browser run.

Use route.request().resourceType() to choose the blocked types, as shown in Playwright’s network documentation. Do not block scripts or API requests just because they are large; they may produce the data you need. Adjust the downloaded set to your task.

Keep cache and service-worker conditions comparable

Playwright documents that routing disables the HTTP cache. Adding routing only to the blocked run changes two conditions at once. The example installs a pass-through route in the baseline too, so both runs use routing.

Service workers can handle requests outside the ordinary routing path. The example uses serviceWorkers: "block" in both contexts. That makes the comparison easier to interpret, but it may change how an application behaves. If your workflow depends on a service worker or a warm cache, test that production configuration separately before adopting the change.

Distinguish browser measurements from billed traffic

Request.sizes() exposes request and response body and header sizes. The example sums those fields for completed requests and counts failed, unfinished and unmeasured requests separately. The measurement ends after the page load and text check, with a timeout for each. Later background traffic falls outside that window.

These browser totals are diagnostic. They are not a complete accounting of proxy tunnel overhead, every failed transfer or the provider’s billing rules. Compare the provider meter over an isolated workload before forecasting spend. The bandwidth calculator can scale that measured usage by valid results.

What we checked, and what you still need to test

We ran the example against a local fixture containing an image and a required text element. The baseline requested the image; the blocked run did not. Both preserved the expected text. Additional checks covered a wrong expected value and resource failures. These checks establish the example’s behavior on that fixture, not a savings percentage for a live website or a paid proxy route.

For your workload, alternate short baseline and blocked runs to reduce order effects. Use the same explicit completion condition, then compare valid output, failures and the full usage window. Keep the version and configuration with the result so a later site change can be investigated.

If you use a hosted browser, check the platform’s proxy integration guide before assuming that local launch options apply. For rate limits, use bounded retries and Retry-After; blocking assets does not change the destination’s access policy.

Common questions

Should I block every image?

Only if images are unnecessary for your output and the task still passes. Screenshots, image analysis and some page interactions depend on them.

Will this reduce my proxy bill by a fixed percentage?

No fixed percentage follows from the technique. Measure a representative workload and the provider usage meter, including failed tasks.

Sources and review scope

Official references checked on 12 October 2026. The procedures and worksheets are our suggested test method. Examples use illustrative inputs or local fixtures; they do not report live proxy performance.

Check current mobile stock before choosing a route. For API fields and agent setup, use the Pool Gateway documentation and agent service index.