/quality-skills:seleniumfrom quality-skills
Designs, implements, debugs, and migrates Selenium WebDriver tests across Java, Python, JS, C#, and Ruby. Covers locators, waits, page objects, grid execution, and Selenium 3→4 migration.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in Selenium WebDriver (Selenium 4.x). Your goal is to help engineers design, implement, and stabilize Selenium tests — locators, waits, page objects, grid execution, and migration from Selenium 3 / legacy capabilities — without fabricating method signatures, capability names, or CLI flags. When unsure, point the reader to selenium.dev for the version they are running.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
safaridriver enabled on macOS), and Internet Explorer Mode in Edge. It is the only mainstream tool with first-class IE-mode support.If the file does not exist, ask: language binding, Selenium version, target browsers, and whether tests run locally or against a grid.
When not to use Selenium:
| Concept | Role |
|---|---|
| WebDriver | A protocol (W3C) and a client library. The client sends JSON commands to a driver. |
| Browser driver | chromedriver, geckodriver, msedgedriver, safaridriver. Translates WebDriver commands into browser actions. |
| Selenium Manager | Built into Selenium 4.6+. Automatically downloads matching drivers — usually means you no longer manage drivers manually. |
| Selenium Grid | A hub + nodes cluster for distributed/parallel browser execution. See the selenium-grid skill. |
| RemoteWebDriver | A WebDriver that talks to a remote URL instead of a local driver. Used for grid and cloud providers. |
Selenium 4 uses W3C capabilities. Vendor options live under a goog:chromeOptions, moz:firefoxOptions, ms:edgeOptions prefix.
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new", "--window-size=1280,720");
options.setAcceptInsecureCerts(true);
WebDriver driver = new ChromeDriver(options);
For RemoteWebDriver against a grid or cloud:
ChromeOptions options = new ChromeOptions();
WebDriver driver = new RemoteWebDriver(
new URL("https://grid.example.com/wd/hub"), options);
Legacy DesiredCapabilities from Selenium 3 still compiles but is deprecated — convert to browser-specific options classes.
| Locator | When to use |
|---|---|
By.id(...) | Stable element ID — fastest. |
By.cssSelector(...) | Default choice for almost everything else. |
By.linkText(...) / By.partialLinkText(...) | Anchor tags by visible text. |
By.xpath(...) | When CSS can't reach the element (text-based selection, parent/ancestor traversal). |
By.tagName(...) / By.className(...) / By.name(...) | Rarely the right choice — usually too brittle. |
RelativeBy (with(By...).above(...), .toRightOf(...), etc.) | Spatial relations — niche. |
Prefer stable hooks (IDs, data-test attributes) over visual selectors. Avoid long XPath chains with positional indexes — they break on the slightest DOM change.
Selenium has three categories of waits. Pick one per project and stick with it.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
WebElement signIn = wait.until(ExpectedConditions.elementToBeClickable(
By.cssSelector("[data-test='sign-in']")));
signIn.click();
Wait<WebDriver> wait = new FluentWait<>(driver)
.withTimeout(Duration.ofSeconds(10))
.pollingEvery(Duration.ofMillis(250))
.ignoring(NoSuchElementException.class);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
Do not mix implicit and explicit waits in the same suite — the interaction is unpredictable and is a major source of flake. Pick explicit; remove any implicit wait calls.
Thread.sleep / time.sleep / setTimeout is almost always wrong. Use waits.
A page object encapsulates the structure of one page (or component) so tests can speak in domain terms.
public class LoginPage {
private final WebDriver driver;
private final WebDriverWait wait;
@FindBy(css = "[data-test='email']") private WebElement email;
@FindBy(css = "[data-test='password']") private WebElement password;
@FindBy(css = "[data-test='sign-in']") private WebElement signIn;
public LoginPage(WebDriver driver) {
this.driver = driver;
this.wait = new WebDriverWait(driver, Duration.ofSeconds(10));
PageFactory.initElements(driver, this);
}
public DashboardPage signInAs(String emailValue, String passwordValue) {
email.sendKeys(emailValue);
password.sendKeys(passwordValue);
signIn.click();
return new DashboardPage(driver);
}
}
Tests then read like spec text:
new LoginPage(driver).signInAs("[email protected]", "Pa$$w0rd-fake");
Avoid mega-page-objects with 50 methods — split by section / component.
WebDriverManager.chromedriver().setup().above, below, toLeftOf, toRightOf, near. Niche.((HasDevTools) driver).getDevTools(). Lets you intercept network, emulate geolocation, throttle CPU. Chrome/Edge only.driver.switchTo().newWindow(WindowType.TAB / WINDOW).There is no single Selenium CLI — you run tests via the test runner of your language (JUnit / TestNG / pytest / Mocha / NUnit / RSpec). Example:
| Language | Typical command |
|---|---|
| Java + Maven | mvn -Dtest=LoginIT test |
| Java + Gradle | ./gradlew test --tests "LoginIT" |
| Python | pytest tests/test_login.py |
| JS / Node | npx mocha tests/login.spec.js |
| .NET | dotnet test --filter "FullyQualifiedName~Login" |
For grid execution, point RemoteWebDriver at the hub URL. For cloud providers (BrowserStack / Sauce / LambdaTest), use their cloud capabilities namespace and provided endpoint — see the cloud-test-grids skill.
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new"); // current headless mode for Chrome/Edge
options.addArguments("--no-sandbox"); // for Docker / root contexts
options.addArguments("--disable-dev-shm-usage"); // for Docker on small /dev/shm
options.addArguments("--window-size=1280,720");
In CI, prefer the official Selenium Docker images (selenium/standalone-chrome, selenium/standalone-firefox) for reproducibility. Pin a version tag — latest drifts.
Thread.sleep — replace with WebDriverWait + ExpectedConditions./html/body/div[2]/div[3]/... breaks constantly. Use CSS or text-based predicates.WebElement across navigations.DesiredCapabilities is deprecated. Migrate to *Options classes.driver.quit() in CI — leaks browsers and runners. Use a test-runner lifecycle hook (@After / fixture finalizer).When helping with Selenium, ask:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio./artilleryWhen the user wants to design, implement, debug, or operate Artillery load tests. Use when the user mentions "Artillery," "artillery.yml," "artillery run," "Artillery scenarios," "Artillery Pro," "phases (Artillery)," "Artillery plugins," "Artillery Engine," or "artillery report." For JS-tested perf with thresholds see k6. For JVM perf see gatling. For Python see locust. For JMeter see jmeter./bdd-anti-patternsWhen the user wants to audit, refactor, or rescue a Cucumber / Gherkin / SpecFlow / Reqnroll / behave BDD suite from common failure modes. Use when the user mentions "BDD anti-patterns," "Gherkin anti-patterns," "scenario refactoring," "imperative steps," "feature file review," "BDD smells," "BDD failing," "Cucumber feedback loop," "scenarios as scripts," or "is BDD worth it." For Cucumber/Gherkin basics see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For Python BDD see behave./behaveWhen the user wants to design, implement, debug, or operate BDD tests on Python using behave. Use when the user mentions "behave," "behave.ini," "@given/@when/@then," "context.x," "environment.py," "behave hooks," "behave tags," "step definitions in Python," "behave-django," or "behave-pytest." For language-agnostic Gherkin patterns see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For BDD failure modes see bdd-anti-patterns. For non-BDD Python testing see pytest.npx claudepluginhub aks-builds/quality-skills --plugin quality-skills