Geonode Use Cases

How to Use Geonode Proxies with Playwright

Set up Geonode proxies in Playwright for Node.js and Python: launch and per-context proxies with credentials, country targeting, sticky sessions, locale and timezone, resource blocking, Firefox and WebKit notes and troubleshooting.

By Team of Monkeys Editorial Updated 4 min read Affiliate disclosure

This guide contains affiliate links to Geonode, Webshare and Rayobyte. If you buy through them we may earn a commission, at no extra cost to you.

How to use Geonode proxies with Playwright illustration of a Playwright script giving each browser context its own Geonode proxy 3jdej38j4

Why Playwright and Geonode work well together

Playwright makes proxies easy: you can pass a proxy with username and password at launch or for each browser context, in every supported language, without extra libraries. Combined with Geonode endpoints that encode location and session in the username, that gives you clean, per-context identities with very little code.

An independent Geonode review after three months of real use on residential proxies. Video: Vashishtha Kapoor on YouTube

Get your endpoint from the Geonode dashboard's proxy configuration (product, session type, location, host:port:username:password format) and store the values in environment variables: GEONODE_HOST, GEONODE_PORT, GEONODE_USER, GEONODE_PASS.

Node.js: a proxy per context

javascript
import { chromium } from 'playwright';

const server = `http://${process.env.GEONODE_HOST}:${process.env.GEONODE_PORT}`;

function geonodeProxy(country) {
  return {
    server,
    username: country ? `${process.env.GEONODE_USER}-country-${country}` : process.env.GEONODE_USER,
    password: process.env.GEONODE_PASS,
  };
}

const browser = await chromium.launch();
const context = await browser.newContext({
  proxy: geonodeProxy('fr'),
  locale: 'fr-FR',
  timezoneId: 'Europe/Paris',
});
const page = await context.newPage();
await page.goto('https://api.ipify.org');
console.log(await page.textContent('body'));
await context.close();
await browser.close();

Each context can have its own proxy, location, locale and timezone, which makes Playwright ideal for multi-market work. The -country- username suffix follows Geonode's documented pattern; use the exact string your dashboard generates.

Our editorial team, hard at work on your proxy questions (animated GIF) 3jdej38j4
Our editorial team, hard at work on your proxy questions. GIF via Tenor

Python: the same idea

python
import os
from playwright.sync_api import sync_playwright

def geonode_proxy(country=None):
    user = os.environ["GEONODE_USER"] + (f"-country-{country}" if country else "")
    return {
        "server": f"http://{os.environ['GEONODE_HOST']}:{os.environ['GEONODE_PORT']}",
        "username": user,
        "password": os.environ["GEONODE_PASS"],
    }

with sync_playwright() as p:
    browser = p.chromium.launch()
    context = browser.new_context(proxy=geonode_proxy("jp"), locale="ja-JP", timezone_id="Asia/Tokyo")
    page = context.new_page()
    page.goto("https://api.ipify.org")
    print(page.text_content("body"))
    context.close()
    browser.close()

Rotating and sticky sessions

  • Rotating: a new context per job gives a fresh connection and a fresh exit IP from a rotating endpoint.
  • Sticky: use a sticky endpoint for flows that need one IP (logins, carts, pagination). Geonode lists sticky sessions of up to 24 hours. One sticky session per context; close the context when the flow ends.

Proxy tip: You can try every step in this guide with a small balance: Geonode bills residential bandwidth per GB with no expiry, so testing costs very little. See our complete Geonode guide for the full product overview.

Blocking heavy resources

javascript
await context.route('**/*', (route) =>
  ['image', 'media', 'font'].includes(route.request().resourceType()) ? route.abort() : route.continue()
);

Routing at the context level applies to every page in it. Check that success rates hold after blocking.

Firefox and WebKit

Playwright supports proxies in Chromium, Firefox and WebKit. Using several engines can help in testing, and for diversity in automation. Proxy options are the same; behaviour of some features (such as WebRTC handling) differs by engine, so test leaks in each.

Matching the browser to the exit

Set locale, timezoneId and, if a site requests it, geolocation with the geolocation permission granted, all consistent with the exit country. For unknown exits, look up the exit's location at the start of each context and set the rest accordingly.

Troubleshooting

ProblemLikely causeFix
407 errorsWrong username or password formatCopy credentials from the dashboard; check targeting suffix
Exit in the wrong countryTargeting missingUse the dashboard's targeted endpoint
Same IP in each contextUsing a sticky endpointUse a rotating endpoint, or a new sticky session per context
TimeoutsSlow residential exitIncrease timeout moderately and retry with a new context
Unexpected bandwidthAssets and media loadingRoute-block resources

Budget tip: If you want a cheap proxy to try this with, Webshare has a free plan with 10 datacenter proxies and 1 GB of bandwidth a month, no card required. Paid lists let you pick proxy count, bandwidth and location. See using Webshare with Playwright.

Designing a multi-market Playwright suite

Playwright's per-context proxy makes it easy to run the same checks across many markets. A maintainable design:

  • A markets file listing each market's country code, locale, timezone, currency symbol and any city you care about.
  • A context factory that takes a market and returns a context with the right Geonode proxy, locale and timezone.
  • Checks written once, parameterised by market: load a page, assert content, take a screenshot.
  • A smoke test per market that loads an IP echo page and confirms the exit country before the real checks run.
  • Artifacts per market: screenshots and traces saved with the market code in the filename, so failures are easy to review.

With Playwright Test, you can model markets as projects so each runs with its own context options, and the HTML report groups results by market. That turns geo QA from an occasional manual job into a routine part of every release. See Geonode for localization testing.

Scraping with Playwright and Geonode

For scraping rather than testing, the same building blocks apply with a different emphasis:

  • One context per job, closed when the job ends, so each job gets a fresh exit from a rotating endpoint.
  • Route-level blocking of images, media and fonts to keep per-GB costs down.
  • Content-based success checks, because blocks often return normal-looking pages.
  • Retries with a new context and a short backoff, capped.
  • Per-domain concurrency limits, since browsers make many requests per page.
John Watson Rooney shows how to plug proxies into both Python Requests and Playwright. Video: John Watson Rooney on YouTube

If a target only needs HTML, an HTTP client is far cheaper than a browser; see Geonode with Python or Geonode with Node.js. If a target is hard and low-volume, the Geonode Scraper API can replace the browser entirely. Use Playwright where you need a real browser and want precise control over it.

Residential tip: Rayobyte is worth testing when you need precise targeting: its residential proxies can be pinned to a country, state, city, ZIP code or ASN, with sticky sessions from 1 to 120 minutes. More in using Rayobyte with Playwright.

Quick self-test

Before relying on a new setup, run three checks in a throwaway script: a context with a rotating endpoint loading an IP echo page twice (expect different IPs across new contexts), a context with a sticky endpoint loading it twice (expect the same IP), and a context targeted to a specific country loading a geolocation page (expect that country). If any check fails, test the same endpoint with cURL to tell code problems from endpoint problems. See Geonode with cURL.

Strict targets usually call for residential proxies. To compare Geonode with other providers for browser automation, see our guide to the best proxies in 2026.

Choosing between providers for this? Our Webshare vs Geonode for Playwright comparison shows where each one is stronger, with costs for typical workloads.

Rayobyte is another option here: our Rayobyte vs Geonode for Playwright comparison shows where each provider is stronger, and Using Rayobyte Proxies With Playwright walks through Rayobyte's products for the job.

FAQ

Can Playwright use a different Geonode location per context?

Yes. Pass a different proxy option to each context with the location in the username.

Do I need extra libraries for proxy authentication?

No. Playwright accepts username and password in its proxy option.

Which browser engine should I use?

Chromium for most scraping; add Firefox or WebKit for cross-browser testing.

How do I get a fresh IP per page?

Use a rotating endpoint and a new context per page or job.

Sources and further reading

Independent references that back up the points above, from standards bodies, governments, universities and non-profits. They open in a new tab.

Affiliate disclosure: Team of Monkeys is an affiliate of Geonode, Webshare and Rayobyte. Links and banners marked as sponsored, and links to Geonode, Webshare and Rayobyte in the text, use our referral links, and we may earn a commission if you buy through them, at no extra cost to you. Our explanations and comparisons are written to be useful whichever provider you choose.

Editorial note: Proxy providers change their pools, features and prices often, so treat any figures here as typical ranges at the time of writing and confirm current terms with the provider before you buy.