-
Notifications
You must be signed in to change notification settings - Fork 251
Open
Labels
Area: browserThe browser moduleThe browser module
Description
What
Using generic selectors instead of semantic ones reduces test maintainability e.g.:
const l = page.locator('#some-id');Solution
Prefer getBy* methods over generic locator() when possible. These APIs are available from page, locator, frame and frameLocator. These usually work with selectors that are more user facing.
Semantic locators are more maintainable and readable. Playwright also recommends their use. Also take a look at the testing library for more details.
Metadata
Metadata
Assignees
Labels
Area: browserThe browser moduleThe browser module