Selenium test hardening
Fixes flaky Selenium tests with explicit waits, better locators and page objects, so browser tests pass reliably.
Claude's review
7/10 Strong Selenium wait, locator and driver rules, with a promotional Kane CLI section and a missing reference file.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
Review and hardening rules for Selenium WebDriver tests: explicit waits, locator priority, driver lifecycle, page objects and the exceptions that cause most failures. Use when reviewing, fixing or stabilising existing Selenium tests or page objects, or when the user mentions WebDriverWait, "implicit wait", StaleElementReferenceException, NoSuchElementException, ElementClickInterceptedException, Thread.sleep or "Selenium best practices". To scaffold a new Selenium project or run on TestMu AI cloud, use selenium-skill.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: selenium-patterns-skill
description: >
Review and hardening rules for Selenium WebDriver tests: explicit waits,
locator priority, driver lifecycle, page objects and the exceptions that
cause most failures. Use when reviewing, fixing or stabilising existing
Selenium tests or page objects, or when the user mentions WebDriverWait,
"implicit wait", StaleElementReferenceException, NoSuchElementException,
ElementClickInterceptedException, Thread.sleep or "Selenium best practices".
To scaffold a new Selenium project or run on TestMu AI cloud, use
selenium-skill.
languages:
- Java
- Python
- JavaScript
- C#
category: e2e-testing
license: MIT
metadata:
author: TestMu AI
version: "1.0"
---
# Selenium patterns
Apply these when you write or review Selenium WebDriver code. Examples are in Python and Java; the same rules hold in every binding.
## Before you write anything
1. Read the existing base test class or fixture, one page object and one test. Match them.
2. Check the Selenium version. On 4.6 or later, Selenium Manager resolves the driver binary, so do not add WebDriverManager or hard-coded driver paths.
3. Find where the driver is created and where `quit()` is called. New tests must go through the same path.
## Waits
This is where most Selenium flakiness comes from.
- Use explicit waits for every interaction with something that loads or changes.
- Do not mix implicit and explicit waits. Together they produce unpredictable timeouts. Set the implicit wait to 0 and use `WebDriverWait`.
- Never use `Thread.sleep()` or `time.sleep()`.
...From LambdaTest's repository, MIT licence.
Related skills
-
Checked
React Native tests
Writes and fixes React Native component tests with Testing Library v13 and v14, using the right API for each.
7/101 credit -
Checked
JUnit and Mockito tests
Writes and fixes Java tests with JUnit, AssertJ and Mockito that are deterministic and keep failures visible.
8/101 credit -
Checked
Test code review
Reviews new or changed tests in pytest, Jest, Go and more, so weak tests are caught before merge.
8/101 credit -
Checked
Test scope decisions
Decides which tests a change needs and how to judge their quality, for unit, integration and UI tests.
8/101 credit -
Checked
Playwright accessibility tests
Writes Playwright and axe tests for WCAG, focus and ARIA, so accessibility bugs fail the build early.
7/101 credit -
Checked
Go table driven tests
Writes Go tests with table cases, fakes, fuzzing, benchmarks and golden files that stay fast and reliable.
8/101 credit