From d87522f2e618d6ce987ea2436126aaf39f6b5afe Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 3 Mar 2021 10:51:10 -0800 Subject: [PATCH] fix(text selector): revert quoted match to match by text nodes only (#5690) --- docs/src/selectors.md | 6 +- src/server/injected/injectedScript.ts | 27 +++---- src/server/injected/selectorEvaluator.ts | 71 ++++++++++++------- .../supplements/injected/selectorGenerator.ts | 2 +- test/selectors-text.spec.ts | 26 +++---- 5 files changed, 72 insertions(+), 60 deletions(-) diff --git a/docs/src/selectors.md b/docs/src/selectors.md index 71099afbbf..ae3ba79f40 100644 --- a/docs/src/selectors.md +++ b/docs/src/selectors.md @@ -169,7 +169,7 @@ page.click("text=Log in") Text selector has a few variations: -- `text=Log in` - default matching is case-insensitive and searches for a substring. For example `text=Log` matches ``. +- `text=Log in` - default matching is case-insensitive and searches for a substring. For example, `text=Log` matches ``. ```js await page.click('text=Log in'); @@ -184,7 +184,7 @@ Text selector has a few variations: page.click("text=Log in") ``` -- `text="Log in"` - text body can be escaped with single or double quotes for case-sensitive match. For example `text="Log"` does not match `` but instead matches `Log in`. +- `text="Log in"` - text body can be escaped with single or double quotes to search for a text node with exact content. For example, `text="Log"` does not match `` because ``, because `