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

16 Replies, 1246 Views

Ugh, zero attributes is the worst. For how to locate element without using attributes, try:

- `document.querySelectorAll('*')[index]` (brute-force, but works if DOM is small).
- `elementFromPoint(x,y)` if you know the coords (kinda hacky tho).

Also, `window.getComputedStyle(el)` can sometimes reveal hidden traits.

Tool: [BrowserStack’s Automate](https://www.browserstack.com/automate) lets you test locators cross-browser.

Messages In This Thread



Users browsing this thread: 1 Guest(s)