From 19acf998dab4a3160c98779276bb1995ac86e05f Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Tue, 19 Jan 2021 10:48:18 -0800 Subject: [PATCH] docs: minor updates to selectors.md (#5055) --- docs/src/selectors.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/src/selectors.md b/docs/src/selectors.md index b25ec5df34..89f581e990 100644 --- a/docs/src/selectors.md +++ b/docs/src/selectors.md @@ -216,14 +216,14 @@ More advanced Shadow DOM use cases: ``` -- Both `"css=article div"` and `"css:light=article div"` match the first `
In the light dom
`. -- Both `"css=article > div"` and `"css:light=article > div"` match two `div` elements that are direct children of the `article`. -- `"css=article .in-the-shadow"` matches the `
`, piercing the shadow root, while `"css:light=article .in-the-shadow"` does not match anything. -- `"css:light=article div > span"` does not match anything, because both light-dom `div` elements do not contain a `span`. -- `"css=article div > span"` matches the ``, piercing the shadow root. -- `"css=article > .in-the-shadow"` does not match anything, because `
` is not a direct child of `article` -- `"css:light=article > .in-the-shadow"` does not match anything. -- `"css=article li#target"` matches the `
  • Deep in the shadow
  • `, piercing two shadow roots. +- Both `"article div"` and `":light(article div)"` match the first `
    In the light dom
    `. +- Both `"article > div"` and `":light(article > div)"` match two `div` elements that are direct children of the `article`. +- `"article .in-the-shadow"` matches the `
    `, piercing the shadow root, while `":light(article .in-the-shadow)"` does not match anything. +- `":light(article div > span)"` does not match anything, because both light-dom `div` elements do not contain a `span`. +- `"article div > span"` matches the ``, piercing the shadow root. +- `"article > .in-the-shadow"` does not match anything, because `
    ` is not a direct child of `article` +- `":light(article > .in-the-shadow)"` does not match anything. +- `"article li#target"` matches the `
  • Deep in the shadow
  • `, piercing two shadow roots. ## Selecting elements based on layout @@ -268,12 +268,12 @@ page.fill('input:right-of(:text("Username"))') page.click('button:near(.promo-card)') ``` -## XPpath selectors +## XPath selectors -XPath engine is equivalent to [`Document.evaluate`](https://developer.mozilla.org/en/docs/Web/API/Document/evaluate). +XPath selectors are equivalent to calling [`Document.evaluate`](https://developer.mozilla.org/en/docs/Web/API/Document/evaluate). Example: `xpath=//html/body`. -Malformed selector starting with `//` or `..` is assumed to be an xpath selector. For example, Playwright +Selector starting with `//` or `..` is assumed to be an xpath selector. For example, Playwright converts `'//html/body'` to `'xpath=//html/body'`. :::note