You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug #1952 introduced the concept that both single and double quotes to indicate a text selector. There are a few documentation errors now due to this:
Selector surrounded with quotes (either " or ') is assumed to be text=selector. Example: page.click('"foo"') is converted to page.click('text="foo"').
This is not correct because of the word surrounded. The actual " and ' is part of the selector. aslushnikov explained this here #1239 (comment):
Your change says:
Selector starting with " is assumed to be text=selector.
@thernstig I see what you mean and how it might be confusing. The definition is technically correct - double-quotes are a part of selector. Let me break down the example that we have in the docs:
consider page.click('"foo"') (notice how there are single-quotes that wrap double-quotes)
in this case, selector is "foo".
selector starts with ", so it is transformed into the form of text=selector
substituting selector with its value, getting text="foo"
which gets us to page.click('text="foo"')
Does the explanation make things any better?
There are one of two possible ways to fix 2) above.
a) Either to update the docs.
b) Or as can be seen in that same thread, I suggest that ' and " is not included in the conversion. Reason I recommend the latter is due to that #1341 made the default for text=some text to match case-insensitive, substring matching. Essentially this is what I recommend makes more sense. Example: page.click('"foo"') and page.click("'foo'") is converted to page.click('text=foo'). This will then default to the best default for text selectors.
The text was updated successfully, but these errors were encountered:
I am still hesitant to introduce the change proposed in (b). This would make text behave differently from css and xpath, and also break the mental model "quotes mean strict match".
Context:
Describe the bug
#1952 introduced the concept that both single and double quotes to indicate a text selector. There are a few documentation errors now due to this:
"
This is not correct because of the word
surrounded
. The actual"
and'
is part of the selector. aslushnikov explained this here #1239 (comment):There are one of two possible ways to fix 2) above.
a) Either to update the docs.
b) Or as can be seen in that same thread, I suggest that
'
and"
is not included in the conversion. Reason I recommend the latter is due to that #1341 made the default fortext=some text
to match case-insensitive, substring matching. Essentially this is what I recommend makes more sense. Example:page.click('"foo"')
andpage.click("'foo'")
is converted topage.click('text=foo')
. This will then default to the best default for text selectors.The text was updated successfully, but these errors were encountered: