Member-only story
Testing Locale-Aware Websites in Automated Test Scripts
A Simple and Practical Tip for Localisation Testing
3 min readFeb 8, 2025
Some websites are locale-aware, meaning they display content based on the user’s region or language settings. Let me illustrate with an example website.
- Visit test server #2 on a machine configured with the Australia region (language: English).
2. Visit test server #1 on a machine configured with the China region (language: Simplified Chinese).
See my other article on setting your browser’s language.
A Typical Way to Make Automated E2E Test Scripts Work for All Locales.
This solution is NOT to use a locator referencing the text, e.g. :text
, or placeholder
attributes. Rather, using :id
, :name
attributes.
Playwright testers might find this is against its recommended style:
await page.getByLabel('User Name').fill('John');
await page.getByLabel('Password').fill('secret-password');
await page.getByRole('button', { name: 'Sign in' }).click();