Playwright · Senior · Question 38 of 77
How should locators be chosen in an app with several languages?
- 1Hard-coded English text, since tests always run in English
- 2Roles with names from translations, or test IDs where needed
- 3XPath by position, so that the language doesn't matter
Show the answer
Correct answer: Roles with names from translations, or test IDs where needed
Explanation
Reading names from the same translation files or running each locale as a project keeps tests correct for every language.