How to locate element without using attributes - Any reliable methods? or What are the best ways to l

16 Replies, 1244 Views

Hey! Been there—super annoying when elements have no attributes. One trick I use is `document.evaluate()` with XPath axes like `following-sibling` or `ancestor`.

Also, Playwright’s `text=` selector is clutch for text-based matching. Example: `page.locator("text='Submit'")`.

If the element’s position is static, `nth-child` can work, but yeah, it’s brittle. Worth a shot though!

Tool rec: Check out [ChroPath](https://autonomiq.io/chropath/) for visualizing XPath/CSS in-browser.

Messages In This Thread



Users browsing this thread: 1 Guest(s)