Skip to content

Commit 9ba2d77

Browse files
shossain786claude
andcommitted
docs(readme): semantic locators in page object, soften absolute claims, move related tools below Learn More
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent a78797f commit 9ba2d77

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

‎README.md‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -138,26 +138,6 @@ Next: [page objects and tests](#page-objects-and-tests), [configuration](#config
138138

139139
---
140140

141-
### Already have a Selenium Java project?
142-
143-
[`selenium-boot-migrator`](https://github.com/seleniumboot/selenium-boot-migrator) analyzes it first and
144-
changes nothing: what maps cleanly, what needs manual work. Maven and Gradle (including version catalogs).
145-
146-
```bash
147-
java -jar selenium-boot-migrator.jar analyze path/to/your-project
148-
```
149-
150-
Grab the jar from the [latest release](https://github.com/seleniumboot/selenium-boot-migrator/releases/latest). Requires Java 17+.
151-
152-
> **Let an AI assistant drive a real browser and write the tests**
153-
> **seleniumboot-mcp** is a standalone MCP server for Claude / GitHub Copilot: it controls Chrome, records your session, and generates ready-to-run test code (Java TestNG / JUnit 5 / Gherkin, Python, C#, Playwright) — Selenium Boot-native when the dependency is present. Its `migrate` tool runs the analysis above for you.
154-
> ```
155-
> pip install seleniumboot-mcp
156-
> ```
157-
> [PyPI](https://pypi.org/project/seleniumboot-mcp/) · [GitHub](https://github.com/seleniumboot/selenium-mcp) · 43 tools by default (77 total) · self-healing locators
158-
159-
---
160-
161141
## Overview
162142

163143
Selenium Boot is an opinionated framework for Java Selenium, inspired by Spring Boot. Add one dependency, extend `BaseTest` / `BasePage`, and the driver lifecycle, waits, retries, reporting and CI wiring are already decided.
@@ -175,41 +155,39 @@ Already on Selenium? You keep your stack, TestNG, team skills and Grid, and gain
175155
Outcomes first — the API that delivers each one is named so you can find it in the docs.
176156

177157
- **No driver setup, teardown or `Thread.sleep()`** — thread-safe WebDriver lifecycle per test and an auto-waiting `WaitEngine`
178-
- **Tests survive CSS and DOM refactors** — accessibility-first locators (`getByRole`, `getByText`, `getByLabel`, `getByPlaceholder`, `getByTestId`, `getByAltText`, `getByTitle`) plus a `SmartLocator` fallback
179-
- **Flaky tests stop failing your build** — automatic retry via `@Retryable`
158+
- **Tests less coupled to markup** — accessibility-first locators (`getByRole`, `getByText`, `getByLabel`, `getByPlaceholder`, `getByTestId`, `getByAltText`, `getByTitle`) plus a `SmartLocator` fallback
159+
- **Transient failures don't fail the build** — automatic retry via `@Retryable`; flaky tests are still reported as retried
180160
- **Parallel runs that are safe** — thread-isolated drivers, `parallel` in one YAML line
181161
- **See exactly why a test failed** — screenshot on failure, `StepLogger` named steps, and an HTML report with pass-rate gauge, slowest tests and step timeline
182162
- **Write pages, not plumbing** — `BasePage` with wait-backed `click`, `type`, `getText`, iFrame helpers and file upload; `@PreCondition` logs in once and reuses the session
183163
- **UI and API in the same suite** — `BaseApiTest` + fluent `ApiClient` with auth, schema validation and JSONPath
184-
- **CI that configures itself** — auto-detects GitHub Actions, Jenkins, CircleCI; forces headless, emits JUnit XML
164+
- **CI-aware defaults** — detects GitHub Actions, Jenkins, CircleCI and others; forces headless, emits JUnit XML
185165

186166
Also built in: accessibility checks (axe-core bundled), download testing, JavaScript console-error capture, environment profiles, and SPI plugins for custom drivers, report adapters and hooks.
187167

188168
---
189169

190170
## Page Objects and Tests
191171

192-
Extend `BasePage` for wait-backed `click`, `type`, `getText`, `getAttribute`, `isDisplayed`, `withinFrame` and `upload`:
172+
Extend `BasePage` for the same semantic locators plus wait-backed helpers (`click`, `type`, `getText`, `isDisplayed`, `withinFrame`, `upload`):
193173

194174
```java
195175
public class LoginPage extends BasePage {
196176
197-
private final By usernameField = By.id("username");
198-
private final By passwordField = By.id("password");
199-
private final By loginButton = By.id("login-btn");
200-
201177
public LoginPage(WebDriver driver) {
202178
super(driver);
203179
}
204180
205181
public void login(String username, String password) {
206-
type(usernameField, username);
207-
type(passwordField, password);
208-
click(loginButton);
182+
getByLabel("Username").type(username);
183+
getByLabel("Password").type(password);
184+
getByRole(Role.BUTTON, "Log in").click();
209185
}
210186
}
211187
```
212188

189+
Prefer semantic locators. When an element has no accessible name, fall back to `By` — `type(By.id("username"), username)` — or to the raw `WebDriver`.
190+
213191
Extend `BaseTest` — that's all the setup a test needs:
214192

215193
```java
@@ -284,6 +262,28 @@ Environment profiles (`-Dselenium.boot.profile=staging`), `ci:` quality gates an
284262

285263
---
286264

265+
## Related Tools
266+
267+
### Already have a Selenium Java project?
268+
269+
[`selenium-boot-migrator`](https://github.com/seleniumboot/selenium-boot-migrator) analyzes it first and
270+
changes nothing: what maps cleanly, what needs manual work. Maven and Gradle (including version catalogs).
271+
272+
```bash
273+
java -jar selenium-boot-migrator.jar analyze path/to/your-project
274+
```
275+
276+
Grab the jar from the [latest release](https://github.com/seleniumboot/selenium-boot-migrator/releases/latest). Requires Java 17+.
277+
278+
> **Let an AI assistant drive a real browser and write the tests**
279+
> **seleniumboot-mcp** is a standalone MCP server for Claude / GitHub Copilot: it controls Chrome, records your session, and generates ready-to-run test code (Java TestNG / JUnit 5 / Gherkin, Python, C#, Playwright) — Selenium Boot-native when the dependency is present. Its `migrate` tool runs the analysis above for you.
280+
> ```
281+
> pip install seleniumboot-mcp
282+
> ```
283+
> [PyPI](https://pypi.org/project/seleniumboot-mcp/) · [GitHub](https://github.com/seleniumboot/selenium-mcp) · 43 tools by default (77 total) · self-healing locators
284+
285+
---
286+
287287
## Project Status
288288

289289
**Current release: v3.7.0** — live-triage debug mode (`debug.slowMoMs` / `debug.highlight`), `withNewWindow` / `withNewTab`, `Locator.dragTo`, and `browser.version` pinning.

0 commit comments

Comments
 (0)