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

fix(text selector): make quoted selector match by text nodes #5603

Merged
merged 1 commit into from
Feb 25, 2021
Merged

fix(text selector): make quoted selector match by text nodes #5603

merged 1 commit into from
Feb 25, 2021

Conversation

dgozman
Copy link
Contributor

@dgozman dgozman commented Feb 24, 2021

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:

<div>text1<span>child node</span>text2</div>

We now match this div by text="text1" and text="text2".

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:
```html
<div>text1<span>child node</span>text2</div>
```
We now match this div by `text="text1"` and `text="text2"`.
@dgozman dgozman merged commit 0102e08 into microsoft:master Feb 25, 2021
aslushnikov pushed a commit to aslushnikov/playwright that referenced this pull request Feb 25, 2021
…icrosoft#5603)

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:
```html
<div>text1<span>child node</span>text2</div>
```
We now match this div by `text="text1"` and `text="text2"`.
aslushnikov pushed a commit to aslushnikov/playwright that referenced this pull request Feb 25, 2021
aslushnikov added a commit that referenced this pull request Feb 25, 2021
@niranjan-borawake
Copy link

niranjan-borawake commented Feb 26, 2021

This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:

<div>text1<span>child node</span>text2</div>

We now match this div by text="text1" and text="text2".

Hello @dgozman ,

What's the recommended way to do strict full string search?

If I have -

<div>Hello World..!</div> <div>Hello</div>

What's the recommended way to select second div?
The way I chose was text=/^Hello$/

@ychaudhari
Copy link

ychaudhari commented Mar 1, 2021

I had element like this:

<h2>
	<span>Title:</span>
	&nbsp;
	<span>text</span>
</h2>

My selector await expect(page).toHaveSelector('"text"'); was working in 1.8.1 but breaking in 1.9.0 and 1.9.1

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.

4 participants