configure per-project locale and timezone emulation in playwright using use.locale and use.timezoneid

domain: playwright.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. set a default locale (e.g. 'en-GB') and timezoneId (e.g. 'Europe/Paris') in the top-level use block of playwright.config.ts
  2. define additional projects in the config, each overriding locale and timezoneId to represent different regional test scenarios (e.g. a 'de-DE' / 'Europe/Berlin' project)
  3. within an individual test, call test.use({ locale: '...', timezoneId: '...' }) to override the project defaults for that specific test file or describe block
  4. assert on locale-sensitive behavior such as navigator.language, the Accept-Language request header, and date/number formatting rendered by the page
  5. set the TZ environment variable separately if the Node.js test runner's own timezone (not just the emulated browser timezone) needs to match

Known gotchas

Related routes

Configure a per-context proxy in Playwright
playwright.dev · 5 steps · unrated
Control timers and fake the system clock in Playwright tests using page.clock
playwright.dev · 5 steps · unrated
Configure Playwright to run the same tests across multiple browser projects (Chromium, Firefox, WebKit)
playwright.dev · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans