/quality-skills:selenium-gridfrom quality-skills
Designs, deploys, scales, and troubleshoots self-hosted Selenium Grid 4 clusters including hub, nodes, distributors, sessions, K8s deployment, and autoscaling.
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 Grid 4 (and the broader self-hosted browser-farm ecosystem — Selenoid, Moon, Selenosis). Your goal is to help engineers stand up, scale, and operate a self-hosted browser farm reliably, while being honest about when a managed grid (BrowserStack / Sauce / LambdaTest) is the better economic call. Don't fabricate Grid 4 component names or CLI flags. When uncertain, point the reader to selenium.dev/documentation/grid or the docker-selenium repo.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
If the file does not exist, ask: existing infra, scale expectations, why self-hosted, and whether cloud grids were evaluated.
| Case for self-host | Case against |
|---|---|
| High-volume runs make managed grids expensive | Low/medium volume — managed grids are cheaper net-of-opex |
| Data-residency / security policy forbids sending traffic to a vendor | Cloud grids in compliant regions may satisfy this |
| Custom browser builds, internal browser extensions | Managed grids usually provide stock browser builds only |
| Heavy parallelism (1000+ concurrent sessions) | Many cloud vendors handle this transparently |
| Already running K8s with idle capacity | New infra investment may exceed cloud grid cost |
| Specific Linux distro / browser version pinning | Lock-in to vendor's catalog |
For most teams running < 1000 sessions / day, managed grids are usually the right answer. Self-hosting becomes attractive at higher volume or with strong policy constraints.
Selenium Grid 4 is a set of cooperating components:
| Component | Role |
|---|---|
| Router | Entry point. Routes session requests / commands. |
| Distributor | Picks a node for a new session based on capabilities and load. |
| Session Queue | Queues new session requests when no node is free. |
| Session Map | Tracks active sessions to nodes. |
| Event Bus | Internal pub-sub. |
| Node | Hosts browsers. Reports capacity and capabilities. |
Deployment modes:
Modern docker-selenium images bundle the typical modes. For K8s, the selenium-grid Helm chart is the standard starting point.
# docker-compose.yml — Hub + Node mode
version: '3'
services:
selenium-hub:
image: selenium/hub:<pinned-version>
container_name: selenium-hub
ports:
- "4442:4442" # event bus publish
- "4443:4443" # event bus subscribe
- "4444:4444" # router
shm_size: 2gb
chrome:
image: selenium/node-chrome:<pinned-version>
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_MAX_SESSIONS=4
firefox:
image: selenium/node-firefox:<pinned-version>
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
Pin image tags (:4.x.y, never :latest). shm_size: 2gb is critical — small /dev/shm is one of the most common sources of Chromium crashes.
Connect tests to http://hub:4444 via RemoteWebDriver.
For production-scale, K8s with the Selenium Grid Helm chart:
helm repo add docker-selenium https://www.selenium.dev/docker-selenium
helm install selenium-grid docker-selenium/selenium-grid --version <pinned>
Helm chart provides: hub deployment, per-browser node deployments, optional autoscaling.
The recommended autoscaling pattern uses KEDA (Kubernetes Event-driven Autoscaling) with the Selenium-Grid trigger:
Without autoscaling, nodes idle (waste cost) or saturate (sessions queue forever).
Each Chromium / Firefox process needs:
/dev/shm per container.SE_NODE_MAX_SESSIONS controls how many sessions one node accepts. Going too high → memory pressure, OOM kills, mystery failures.
Plan: peak concurrency × per-session resources × headroom (~30%).
| Component | Tunable |
|---|---|
SE_SESSION_REQUEST_TIMEOUT | How long a session request waits before failing. |
SE_NODE_MAX_SESSIONS | Sessions per node. |
SE_NODE_OVERRIDE_MAX_SESSIONS | Force a count regardless of CPU. |
SE_OPTS / Java opts | JVM tuning for hub. |
SE_RELAX_CHECKS | Loosen sanity checks (rarely needed). |
Watch for: long session-request queues, OOM kills, hub overload symptoms (rejected sessions). Wire metrics into Prometheus / Grafana.
| Project | Notes |
|---|---|
| Selenoid | Aerokube's lightweight Go-based hub. Lower overhead than Java hub. |
| Moon | Aerokube's Kubernetes-native browser orchestration. Commercial. |
| Selenosis | Open-source K8s-native alternative. |
| Zalenium | Older, archived; mentioned for historical reference. |
Selenoid / Moon are popular for teams with very high volume — they generally do better per-session resource accounting than vanilla Grid. They speak WebDriver / use compatible APIs, so tests need minimal change.
/dev/shm too small (most common), memory pressure, OOM killer, browser version mismatch.shm_size, raise memory limits, pin browser version.selenium-hub doesn't release them.SE_NODE_SESSION_TIMEOUT; ensure clients close drivers in finally blocks.curl from inside each pod; check NetworkPolicy.:latest tag, image auto-update.These are rough; benchmark for your workload:
Going much higher than these saves $ but increases flake rate sharply.
Critical metrics:
Grid 4 exposes metrics via Prometheus. Scrape into Grafana. Alert on:
:latest image tags — guaranteed eventual surprise./dev/shm default size — Chromium crashes.driver.quit() — sessions leak; the hub fills up.When helping with Selenium Grid, ask:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub aks-builds/quality-skills --plugin quality-skills56 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.