Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: more clarity in the attribute selectors #5621

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

aslushnikov
Copy link
Collaborator

Fixes #5615

@@ -449,7 +449,42 @@ converts `'//html/body'` to `'xpath=//html/body'`.

## id, data-testid, data-test-id, data-test selectors

Attribute engines are selecting based on the corresponding attribute value. For example: `data-test-id=foo` is equivalent to `css=[data-test-id="foo"]`, and `id:light=foo` is equivalent to `css:light=[id="foo"]`.
Playwright supports a shorthand for selecting elements using certain elements. Currently, only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using certain attributes

```

:::note
Attribute selectors piece shadow DOM. To opt-out from this behavior, use `:light` suffix after attribute, for example `page.click('data-test-id:light=submit')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

piece -> pierce

@aslushnikov aslushnikov merged commit b285936 into microsoft:master Feb 25, 2021
@aslushnikov aslushnikov deleted the enhance-selector-docs branch February 25, 2021 18:42
yury-s pushed a commit to yury-s/playwright that referenced this pull request Mar 1, 2021
yury-s pushed a commit to yury-s/playwright that referenced this pull request Mar 1, 2021
yury-s added a commit that referenced this pull request Mar 1, 2021
…#5638) (#5660)

* docs: more clarity in the attribute selectors (#5621)
* docs: add java snippets to the examples in guides (#5638)
* docs: docs typos (#5658)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

page.selectOption: Unknown engine "name" while parsing selector name="serviceType" [BUG]
2 participants