Closed NikkTod closed 1 year ago
@NikkTod Playwright selectors only work with elements, and this XPath seems to target an attribute. Let us know what you are trying to achieve, and we'll help you do it in some other way.
Hey @dgozman,
the whole line that was not working for me was like that:
page.locator("ta-table-row", new Page.LocatorOptions().setHasText("someText")).locator("xpath=//[name()='use']//@[contains(., 'edit')]").click();
Nevertheless by my request the devs on the project inserted some sensible class attributes for those elements, so that I can target them. We can close the ticket :)
I have the following html
and when pasting the following xpath in the chrome devtools I receive elements returned:
But when running the test, playwright is not able to find any element. I also tried with the Inspector and put the same xpath within the explore field, but nothing was returned.
Seems that the problem is with the //@*[contains(., 'edit')]