If you’re automating, try `page.$x("//*[contains(., 'your text')]")` in Puppeteer. Works when how to locate element without using attributes is a nightmare.
Or, if the element’s near something identifiable, use `near` in Playwright:
```js
page.locator(':near(:text("Username"), 100px)')
```
Tool: [Playwright docs](https://playwright.dev/docs/locators) have more tricks.
Or, if the element’s near something identifiable, use `near` in Playwright:
```js
page.locator(':near(:text("Username"), 100px)')
```
Tool: [Playwright docs](https://playwright.dev/docs/locators) have more tricks.
