
I gave Java Selenium Playwright-style locators (getByRole / getByLabel) + an AI that writes the tests — open source
Locators are the part of Selenium that always bites me — By.xpath("//div[3]/span") breaks the moment someone touches the CSS. Playwright sidesteps this with getByRole/getByLabel That targets what the user perceives, not the DOM structure.
I've been building an accessibility-first locator layer for Java Selenium that does the same — getByLabel("Username"), getByRole(Role.BUTTON, "Login") — plus web-first assertions and a framework-managed driver so there's no WebDriverWait/quit boilerplate. And I wired up an MCP server so an AI assistant can drive a real browser and generate the test using those locators.
Before I go further, I really want a reality check from people who write Selenium daily:
- Does the
getByRole/getByLabelapproach actually hold up on your apps? - Where does it fall apart — heavy custom components, canvas, deeply nested shadow DOM, non-semantic markup?
- Is "AI generates the locators" something you'd trust, or does it need to be reviewable/deterministic to be useful?
It's open source; happy to share the repo in the comments if anyone wants to poke at it.