From ccc89e3522a6caadb63ea4c22ff6d6543165c07f Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Tue, 9 Mar 2021 13:13:54 -0800 Subject: [PATCH] cherry-pick(release-1.9): fix(text selector): revert quoted match to match by text nodes only (#5766) --- 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 `