Playwright Timezone Locale Check: What Each Option Really Sets

playwright timezone locale - Playwright Timezone Locale Check: What Each Option Really Sets

Playwright timezone locale settings are separate switches, and each one moves a different set of signals. The locale option changes the language the page and its requests report, timezoneId changes only the clock, geolocation changes only coordinates, and an extra Accept-Language header changes only the header. None of them knows which country your proxy exits in. I measured all of it in Chromium, headless and headed, then wrote a short check that compares a context with the proxy country before you start a solve with the CapSkip Node.js SDK. The solve comes last: the proxy goes with it, the user agent cannot, and the token returns to the same context.

What you need and what I ran

  • Node.js 20 or newer. playwright 1.65.1 and playwright-core declare node 20 or newer, and capskip 1.8.0 declares 18, so the floor is 20. I ran 20.11.1, 24.22.0 and 25.2.1 on Windows 11. I chose Node because capskip and Playwright then share one process. I did not run the other languages.
  • A Chromium build. The first block installs Playwright and then its browser. Chromium 159.0.8154.6, the build this Playwright version asks for, was already on this PC, so I did not time a download.
  • CapSkip on a Windows PC. Local mode keeps its API on the loopback address. Server mode lets machines on your network or a public IP reach it, so the browser script and CapSkip can run on different PCs. You choose the mode in the connection settings part of the setup guide.
  • A proxy whose exit country you know, which your provider usually tells you.
npm install playwright capskip
npx playwright install chromium

I did not call the real CapSkip app. Every solve below went to a mock CapSkip (in.php and res.php) that I wrote on its own port, and the site is a mock contact form that carries only the widget markup. The country table in the script is mock data too. Numbers come from Playwright 1.65.1 with Chromium 159.0.8154.6 on Windows 11, where the host time zone is Asia/Singapore and the system locale is en-US. They ran on Node 24.22.0 unless I say otherwise. I tested no real site, so I can only report what the browser sends, never what a site makes of it.

What each Playwright timezone locale option changes

I loaded a page on the mock site under 11 combinations of options, in three modes: the default headless mode, which runs a separate headless shell build, new headless mode through the chromium channel, and a headed window. New headless is chromium.launch with the channel option set to chromium, and headed is headless: false. That makes 33 runs, one each, and a second pass over the default mode matched the first exactly. In every run the page read navigator.language, navigator.languages, the Intl locale and time zone, two Date offsets and a number format, a dedicated worker read the same values, and the server logged the Accept-Language header of the document, a fetch, an image and the worker’s own fetch.

locale de-DE
  moved:   navigator.language, navigator.languages
           (now one entry), Intl locale, number
           format 1.234.567,891, and Accept-Language
           on document, fetch, image, worker requests
  stayed:  time zone, geolocation, user agent

timezoneId Europe/Berlin
  moved:   Intl time zone, getTimezoneOffset
           (-60 in January, -120 in July), also
           inside the worker
  stayed:  language, header, geolocation

geolocation plus the geolocation permission
  moved:   getCurrentPosition answers 52.52, 13.405
  stayed:  everything else

extraHTTPHeaders with Accept-Language
  moved:   the header on every request,
           the worker included
  stayed:  navigator.language, navigator.languages,
           Intl locale, the worker's own language

Chromium language launch flag set to de-DE
  moved:   depends on the mode, see next section
  stayed:  time zone

Two things stayed in step in all 33 runs. The worker agreed with the page on language, language list, Intl locale, time zone, January offset and number format, and getTimezoneOffset agreed with the Intl time zone. The user agent string did not change with any option: each mode kept one value across its 11 combinations. The installed Playwright types say the locale option affects navigator.language, the header, and number and date formatting. That matches what I measured, though the docs do not mention the one-entry language list.

Where the options drift apart

The defaults come first, because a job that sets nothing claims whatever the machine is. With no options, the time zone in every run was Asia/Singapore, the host’s. A job on a server in another region would claim that region. The three modes also differ with no options set. A stock Chrome that Playwright does not drive matches headed Chromium here apart from its version.

Default headless (headless shell)
  user agent:  HeadlessChrome/159.0.8154.6
  languages:   en-US only
  header sent: no header sent

New headless (chromium channel)
  user agent:  HeadlessChrome/159.0.0.0
  languages:   en-US, en
  header sent: en-US,en;q=0.9

Headed Chromium
  user agent:  Chrome/159.0.0.0
  languages:   en-US, en
  header sent: en-US,en;q=0.9

Stock Chrome 157.0.8103.78, no Playwright
  user agent:  Chrome/157.0.0.0
  languages:   en-US, en
  header sent: en-US,en;q=0.9

The locale option makes a context tidy rather than ordinary. With locale set to de-DE, all three modes reported a one-entry list and sent a bare de-DE. The stock Chrome, started with its language flag set to de-DE, reported four entries (de-DE, de, en-US, en) and sent de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7. Whether any site compares those shapes, I cannot say. I only found that they differ.

Four more drifts showed up, each in all three modes unless noted.

  • A header alone. With only an Accept-Language header set, the server saw de-DE,de;q=0.9 while navigator.languages stayed en-US, and so did the worker.
  • A header against the locale. With locale de-DE and a header of fr-FR, the document request carried de-DE and every later request, the worker’s included, carried fr-FR. One context said two languages.
  • The launch flag. In the default mode it gave navigator.language de, a one-entry list and no header at all. In the other two it gave de-DE with the four-entry list and an Intl locale of plain de. Setting the locale option as well overrode both.
  • Quiet value handling. A misspelled timezoneId threw Invalid timezone ID when the page opened. The alias CET was accepted and read back as Europe/Brussels. A locale of de_DE was normalised to de-DE, and xx-YY passed unchecked.

Geolocation stands apart. It needs the permission, and without it getCurrentPosition failed with code 1 in both headless modes. The headed window failed with code 3, a timeout, which I read as a permission prompt left waiting for an answer. On a plain HTTP page behind my proxy, isSecureContext was false and the call failed with code 1 even with the permission granted, so the check below does not read it.

A consistency check to run before you start a solve

The fix for drift is to build every setting from one country entry, read the claims back from the running page, and refuse to solve when they disagree. The first block does the reading, and you can run it on its own with any options to repeat my measurements. Save it as claims.js. It gets the header as sent by firing a fetch and reading the request, so no echo service is involved. I compared that header with what my server logged in 12 runs, and all 12 matched.

// npm install playwright capskip
// claims.js: print what a context claims and what its requests send.
const { chromium } = require("playwright");

const PAGE_URL = "https://example.com/contact"; // any page you may open
const LAUNCH_ARGS = []; // to test the language flag: ["--lang=de-DE"]
const OPTIONS = { locale: "de-DE" }; // the context options under test

async function readClaims(page) {
  const claims = await page.evaluate(() => {
    const d = Intl.DateTimeFormat().resolvedOptions();
    return {
      language: navigator.language,
      languages: [...navigator.languages],
      intlLocale: d.locale,
      zone: d.timeZone,
      offsets: [
        new Date(2026, 0, 15, 12).getTimezoneOffset(),
        new Date(2026, 6, 15, 12).getTimezoneOffset(),
      ],
      number: new Intl.NumberFormat().format(1234567.891),
    };
  });
  // The header as sent: fetch from the page, read it off the request.
  const [request] = await Promise.all([
    page.waitForRequest((r) => r.url().endsWith("/robots.txt")),
    page.evaluate(() => fetch("/robots.txt").catch(() => null)),
  ]);
  const headers = await request.allHeaders();
  claims.acceptLanguage = headers["accept-language"] ?? null;
  return claims;
}

module.exports = { readClaims };

async function main() {
  const browser = await chromium.launch({ args: LAUNCH_ARGS });
  const context = await browser.newContext(OPTIONS);
  const page = await context.newPage();
  await page.goto(PAGE_URL);
  console.log(await readClaims(page));
  await browser.close();
}

if (require.main === module) main();

The second file turns one country entry into context options and compares the claims with the country your proxy exits in. Save the next three blocks together as solve_in_context.js, one after the other. The table of countries is mock data, and your proxy provider is the real source for the exit country. Set PROFILE to what you meant the context to be, so a stale profile gets caught against a proxy that moved.

// solve_in_context.js
const { chromium } = require("playwright");
const { CapSkip } = require("capskip");
const { readClaims } = require("./claims");

const FORM_URL = "https://example.com/contact"; // the page with the widget
const PROXY = {
  server: "http://proxy.example.test:3128",
  username: "USER",
  password: "PASSWORD",
};
const PROFILE = "DE"; // what this context is meant to look like

// Mock tables: replace them with your own list and your provider's answer.
const COUNTRIES = {
  DE: { locale: "de-DE", zones: ["Europe/Berlin"], lat: 52.52, lon: 13.405 },
  JP: { locale: "ja-JP", zones: ["Asia/Tokyo"], lat: 35.68, lon: 139.69 },
};
const PROXY_COUNTRY = { "proxy.example.test:3128": "DE" };

// Local mode. In Server mode, use the address of the CapSkip PC as host.
const solver = new CapSkip({ host: "127.0.0.1", port: 8080 });

function contextOptions(country, proxy) {
  const c = COUNTRIES[country];
  return {
    locale: c.locale,
    timezoneId: c.zones[0],
    geolocation: { latitude: c.lat, longitude: c.lon },
    permissions: ["geolocation"],
    proxy,
  };
}
// What the context claims, against the country the proxy exits in.
function problemsWith(claims, country) {
  const want = COUNTRIES[country];
  const found = [];
  if (!want.zones.includes(claims.zone)) {
    found.push(`time zone ${claims.zone}, wanted ${want.zones[0]}`);
  }
  if (claims.language !== want.locale) {
    found.push(`language ${claims.language}, wanted ${want.locale}`);
  }
  if (claims.intlLocale !== claims.language) {
    found.push(`Intl locale ${claims.intlLocale} differs from ${claims.language}`);
  }
  const sent = (claims.acceptLanguage ?? "").split(",")[0].split(";")[0].trim();
  if (!sent) {
    found.push("no Accept-Language header is sent");
  } else if (sent !== claims.languages[0]) {
    found.push(`Accept-Language ${sent} differs from ${claims.languages[0]}`);
  }
  return found;
}

I ran the check against eight setups, each expecting Germany, in every mode. The zone and language findings assume my host settings, Asia/Singapore and en-US. The default mode differs from the other two in three rows, because its missing header adds a finding. The check took 14 to 35 milliseconds per call across the 24 timed calls, against my mock page on this PC.

Context options, Germany expectedDefault headlessNew headless and headed
No options3: zone, language, no header2: zone, language
Locale only1: zone1: zone
timezoneId only2: language, no header1: language
Locale and timezoneId00
Header de-DE and timezoneId2: language, header differs2: language, header differs
Locale, timezoneId and a header of fr-FR1: header differs1: header differs
Language flag and timezoneId2: language de, no header1: Intl locale de
The full profile from contextOptions00

Send the solve with the same proxy and put the token back

The last block opens the page through the proxy, runs the check against the proxy’s country, solves only on a clean result and writes the token into the same context. Replace the success message with whatever your site shows after a good form post.

function proxyUri(proxy) {
  const url = new URL(proxy.server);
  return `${proxy.username}:${proxy.password}@${url.host}`;
}

async function main() {
  const exitCountry = PROXY_COUNTRY[new URL(PROXY.server).host];
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext(contextOptions(PROFILE, PROXY));
    const page = await context.newPage();
    await page.goto(FORM_URL);

    const found = problemsWith(await readClaims(page), exitCountry);
    if (found.length > 0) throw new Error("not solving: " + found.join("; "));

    // The proxy goes with the solve. A user agent cannot: see the text.
    const sitekey = await page.getAttribute(".g-recaptcha", "data-sitekey");
    const result = await solver.recaptcha(sitekey, page.url(), {
      proxy: { type: "HTTP", uri: proxyUri(PROXY) },
    });

    // The token goes back into this context, and the form is sent from it.
    await page.evaluate((token) => {
      document.getElementById("g-recaptcha-response").value = token;
    }, result.code);
    // /send is the mock's form action; use your site's.
    await Promise.all([page.waitForURL(/\/send/), page.click("button[type=submit]")]);
    console.log(await page.textContent("p")); // your site's success message
  } finally {
    await browser.close();
  }
}

main().catch((err) => {
  console.error(err.message);
  process.exitCode = 1;
});

Run node solve_in_context.js. Against the mock it printed Message saved, after one task. The mock CapSkip received googlekey, pageurl, proxy as user:pass@host:port and proxytype HTTP, which is the login:pass@IP:PORT form the CapSkip API docs list, and the solver proxy guide says when it matters. The mock site logged the form post with the context’s own user agent and de-DE, arriving through the proxy with its credentials accepted. When I set PROFILE to DE but made the table say the proxy exits in Japan, the script refused with two findings, the time zone and the language, and the mock saw no task. Deleting the timezoneId line gave one finding and no task.

The user agent is the part that does not travel. The SDK source lists the options each solve method accepts. Seven of them accept a user agent: Capy, CaptchaFox, Friendly Captcha, DataDome, hCaptcha, MTCaptcha and Yandex. reCAPTCHA, Turnstile and GeeTest do not. Passing userAgent to recaptcha raised a ValidationException before any request left, and so did locale, timezoneId and acceptLanguage, with zero tasks reaching the mock. So the solve takes your proxy and nothing else from the context. The CapSkip docs say a reCAPTCHA v2 or Turnstile result carries the user agent the token is bound to, and that some sites check the match. The recaptcha() call in the SDK does not request it, so my run never read it. These are doc claims, not something I ran against a real app. The reCAPTCHA v2 Node.js guide covers the call itself.

Server mode: where the browser and the solver run

As I read the proxy field, CapSkip makes its proxy connection from the PC it runs on, and Playwright makes its own from wherever the script runs. I could not observe that against a mock. With Server mode, both machines reach the same proxy, so a provider that admits only listed addresses needs both on the list. My test used one PC, so a two-machine setup is unverified. Starting Server mode adds an inbound rule that lets any address reach the CapSkip port, so tightening that allow rule changes nothing. To keep unexpected machines out, add a Windows Firewall rule with the Block action for their addresses. As I understand the Windows documentation, block rules win over allow rules, and I did not test that here.

FAQ

Does the locale option change the user agent?

No. In my runs each mode sent the same user agent under all 11 option sets, so the browser version and the HeadlessChrome token come from the mode, not the locale. Read the user agent from the page if your code needs it.

Is headed mode safer than headless for these settings?

For these options, no. Locale, timezoneId and geolocation gave identical values in all three modes. The modes differ in their defaults and in the geolocation failure code.

Will a consistent context stop the CAPTCHA appearing?

Nothing here shows that. The check removes contradictions you created yourself, which is cheap to fix. It says nothing about your address, your request rate or what the target site scores, and I tested no real site. For the other signals a headless browser leaks, see the headless detection guide, and for the wider Playwright setup the Playwright CAPTCHA solver page.

The short version

A Playwright timezone locale setup is only as good as the check that proves it: build locale, timezoneId, geolocation and the proxy from one country entry, read the claims back, and solve only when they agree. A flat-license unlimited captcha solver running on your own PC means a refused solve loses nothing, and the check takes milliseconds. The Playwright emulation guide lists the locale, timezone and geolocation options used here.