/oxygen:oxygen-triagefrom oxygen
Diagnoses and fixes failing Oxygen tests by mapping error codes to likely causes and repairs. Helps decide if a failure is a test defect or a real application bug.
Ships in oxygen. 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.
None: SKILL.md is the whole skill.
Every Oxygen failure carries a typed error code, a message, and a location
pointing at the line in the test script. Read the code first — it narrows the
cause far faster than the message text does.
This decision comes first, and getting it wrong is expensive in both directions.
A failure is a real application bug — report it, do not "fix" the test —
when the test faithfully expresses the intended behaviour and the application
does not deliver it. An ASSERT_ERROR reading Expected: "Dashboard". Got: "Login" after a valid sign-in is a bug, not a locator problem.
A failure is a test defect when the test is asking for the wrong thing: a stale locator, a missing wait, a wrong assumption about page state.
If you cannot tell, say so and present both readings. Never make a failing
assertion pass by weakening it — changing assertText to a laxer pattern, or
assert* to verify*, to get a green run is destroying the test's purpose.
Loosening an assertion is legitimate only when the original was over-specific
about something genuinely incidental, and that reasoning should be stated.
| Code | Message shape | Likely cause and fix |
|---|---|---|
ELEMENT_NOT_FOUND | Unable to find element: <locator> | Wrong or stale locator; element in an iframe; page not loaded yet. Confirm the locator against the live page before editing. If the element is inside a frame, web.selectFrame() first. Waiting longer does not help — the command already waited 60s. |
ELEMENT_NOT_VISIBLE | Element not visible: <locator> | Element exists but is hidden or off-screen. Usually a real timing or state problem, not a locator problem. web.scrollToElement(), or wait for the state that reveals it. web.clickHidden() only when the element is legitimately never visible. |
ELEMENT_NOT_INTERACTABLE | driver message | Element is covered, disabled, or animating. Wait for the overlay to clear or the control to enable — web.waitForInteractable(). Do not reach for clickHidden to bypass a genuinely disabled control; that hides a real bug. |
STALE_ELEMENT_REFERENCE | driver message | The DOM was replaced between finding the element and using it — common with SPAs. Re-find rather than caching: pass the locator string to each command instead of holding an Element across a navigation. |
LOCATOR_MATCHES_MULTIPLE_ELEMENTS | — | The locator is not specific enough. Scope it to a container, do not add an index — an index is positional and will drift. |
ELEMENT_STILL_EXISTS | — | waitForNotExist timed out. The element genuinely did not go away; check whether the action that should remove it actually fired. |
OPTION_NOT_FOUND | — | select/deselect could not find the option. Check the label-vs-value distinction and whether options load asynchronously. |
ATTRIBUTE_NOT_FOUND | — | The attribute is absent, not empty. Verify against the live DOM. |
| Code | Fatal | Meaning |
|---|---|---|
ASSERT_ERROR | yes | assert* mismatch — Expected: "x". Got: "y". Test stops here. |
VERIFY_ERROR | no | verify* mismatch. Step recorded failed, execution continued — so look for later failures caused by this one. |
For both, check the pattern syntax before assuming an application fault. A bare
pattern is glob-matched, so Total: $42 fails against text containing *
or ? unless prefixed with exact:. regex:, regexi:, exact: and glob:
are the available prefixes.
| Code | Likely cause and fix |
|---|---|
MODULE_NOT_INITIALIZED_ERROR | Missing web.init() — a command ran before its module was initialized. Add web.init(). If it is already there, the real cause is usually a command in a constructor/getter or an un-awaited callback running out of order. |
SCRIPT_ERROR | A JavaScript error in the test. Check location for the line. A Promise-shaped value here almost always means a command inside a constructor, getter, setter, or forEach callback — see the oxygen-write skill, section 1. |
BROWSER_JS_EXECUTE_ERROR | The function passed to web.execute() threw in the browser. Remember it runs in page scope — no web, no po, no Node globals. |
PARAMETERS_ERROR | Parameters file missing, unreadable, or an unsupported extension. Supported: .csv, .txt, .xlsx, .xls, .json, .js. Also raised when the table is empty. |
CRYPTO_ERROR | utils.decrypt on a value that was not produced by utils.encrypt, or encrypted with a different key. |
HOOK_ERROR | A hook in oxygen.conf.js threw. Note hooks load only from oxygen.conf.js, never .json. |
MODULE_NOT_FOUND | A module was used that is not in the config's modules list, or a custom module failed to load. |
TIMEOUT | A wait exceeded its limit. Prefer fixing the condition over raising the timeout. |
These are almost never fixed by editing the test.
| Code | Meaning |
|---|---|
oxygen: command not found | Not an Oxygen error at all - the CLI is not on PATH. Resolve it with npx oxygen --version before concluding anything; see oxygen-setup. Do not run a bare npm i to fix it, which fails when the project has no package.json. |
SELENIUM_UNREACHABLE_ERROR / SELENIUM_CONNECTION_ERROR | No grid at seleniumUrl. Start one, or set autoStartWebDriver: true (Chrome only). |
CHROMEDRIVER_ERROR | chromedriver failed to start, usually a browser/driver version mismatch. If the message is a permission error naming a cache path, see The driver cache cannot be written below — that is not a version problem. |
WEBDRIVER_ERROR | Generic driver-level failure; read the original message. |
INVALID_CAPABILITIES / BROWSER_CONFIGURATION_ERROR | Bad capabilities in the config — commonly a missing or misspelled browserName. |
URL_OPEN_ERROR | The page could not be reached. Check the environment's baseUrl and whether the application is running. |
APPIUM_* / DEVICE_NOT_FOUND | Mobile session problems — Appium server, device availability, app path. |
UNEXPECTED_ALERT_OPEN | A native dialog blocked the command. Handle it with web.alertAccept() / web.alertDismiss() at the point it appears. |
FRAME_NOT_FOUND | selectFrame could not find the frame; check for nested frames and whether it loaded. |
autoStartWebDriver (--autowd=true) downloads chromedriver into a per-user
cache directory before starting it:
| Platform | Default location |
|---|---|
| Windows | %LOCALAPPDATA%\oxygen-nodejs\Cache\drivers |
| macOS | ~/Library/Caches/oxygen-nodejs/drivers |
| Linux | $XDG_CACHE_HOME/oxygen-nodejs/drivers, else ~/.cache/oxygen-nodejs/drivers |
An EPERM or EACCES naming one of those paths is a permission problem, not
a driver problem. The usual cause is enterprise policy forbidding writes under
the user profile on Windows. It fails before any browser starts, so the test
itself is irrelevant: do not edit the script, do not retry, and do not treat it
as the version mismatch CHROMEDRIVER_ERROR normally means.
Point the cache at a directory the account can write to:
oxygen ./test.js --autowd=true --wdcache=D:\shared\oxygen-cache
OXYGEN_CACHE_DIR=/writable/path oxygen ./test.js --autowd=true
Or for the whole project, in oxygen.conf.js:
module.exports = {
autoStartWebDriver: true,
wdCacheDir: 'D:\\shared\\oxygen-cache',
};
Precedence, highest first: --wdcache, then wdCacheDir in oxygen.conf.js,
then OXYGEN_CACHE_DIR, then the per-platform default.
In the VS Code extension the same setting is oxygen.webDriverPath; it is
validated before the run and passed down as OXYGEN_CACHE_DIR, so a project
wdCacheDir would still take precedence over it.
Choose somewhere writable and durable — a second drive, a team share
(\\server\share\oxygen works), or a folder inside the project. Confirm by
writing a file there before rerunning: on Windows a directory can look writable
and still refuse the write, because ACLs are not reflected in ordinary
permission checks.
Unless a matching chromedriver is already cached, --autowd=true looks it up at
googlechromelabs.github.io and downloads it. On a closed network that request
fails before any browser starts, with something like:
Failed to get compatible ChromeDriver version: Socket closed before the TLS connection was established
Failed to get compatible ChromeDriver version: getaddrinfo ENOTFOUND googlechromelabs.github.io
No ChromeDriver 153.x is available locally and it could not be downloaded
Also ETIMEDOUT, ECONNRESET, ECONNREFUSED or EAI_AGAIN in the same
message. None of these is a test problem: do not edit the script, do not retry,
do not drop --autowd in favour of a Selenium hub nobody set up.
Before the first --autowd run in a session, follow these steps in order:
Look for a stored driver location. Check for webDriverPath in
oxygen.conf.js, then the OXYGEN_CHROMEDRIVER_PATH environment variable.
If either is set, use it (step 5) and skip the rest. Never ask again for
something already stored.
Check whether the download site is reachable. Node is always there,
and its fetch connects the same way Oxygen does:
node -e "fetch('https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json',{signal:AbortSignal.timeout(10000)}).then(r=>console.log('online',r.status),e=>{console.log('offline:',e.cause?.code||e.name);process.exit(1)})"
online 200 means downloads will work: run normally and stop here. Any
offline: result, or a run that already failed with one of the messages
above, means the environment is closed.
Ask the user where the offline ChromeDriver is. It can be the binary
itself or a folder holding one or more drivers. Do not guess and do not
search their disks or network shares: the person who set up the machine
knows where IT put it. Tell them the installed Chrome version (from the
failed run's Chrome version: line), because the driver's major version
has to match it.
Check what they gave you, then store it. Make sure the path exists. For a
binary, run <path> --version and compare its major version with
Chrome's. For a folder, Oxygen picks the matching driver itself and says
which drivers it found if none match. Then store the location as
webDriverPath in oxygen.conf.js so later runs and later sessions pick
it up:
module.exports = {
autoStartWebDriver: true,
webDriverPath: 'D:\\tools\\chromedrivers',
};
oxygen.conf.js is usually committed. If the path only applies to this
machine and the user does not want it in the repository, have them set
OXYGEN_CHROMEDRIVER_PATH instead.
Run with the location passed explicitly, so it applies even when the target is outside the project that holds the config:
oxygen ./test.js --autowd=true --wdpath=D:\tools\chromedrivers --headless
oxygen session start --autowd=true --wdpath=D:\tools\chromedrivers
The session above has no --headless on purpose. Add it only when nobody
needs to see the browser. Interactive mode means a visible browser.
Precedence, highest first: --wdpath, then webDriverPath in
oxygen.conf.js, then OXYGEN_CHROMEDRIVER_PATH. With any of them set, Oxygen
never contacts the download site and never touches the driver cache.
Do not confuse it with --wdcache. That option moves the folder Oxygen
downloads into. It still downloads whenever Chrome's major version changes,
so on a closed network it only postpones the failure.
If a stored driver later fails because its version no longer matches Chrome, Chrome has updated. Ask the user for the new driver (or the folder it was added to) and update the stored value. Do not fall back to downloading.
Run with --rf=agent and read agent-report.json from the output directory.
The HTML report is built for a person to browse; this one is built to be read
by whatever is fixing the test:
oxygen cases/login.js --rf=agent --ro=./reports
A passing run is a few hundred bytes. A failing one gives, per failure: the
error type and message, the failing step, the location as a
project-relative file:line:column, the precedingSteps that led up to it,
and screenshot / snapshot filenames sitting next to the report — the
snapshot being the actual page HTML at the moment of failure.
A failure with no step means the script threw before reaching a command;
location still points at the line.
Two more fields appear when they apply, and both exist to save you a run:
alsoAppearsIn — every other file:line in the project using the same
locator that just failed. A locator broken by an application change is
almost never broken in one file. Fix all of them in this pass; otherwise the
next run rediscovers the identical fault in the next file, one browser run
per occurrence.hint — present when the script called a command that does not exist.
It names the closest real commands and the module to list. Trust it over
your memory of the API.By default a case stops at its first failed command, so a script broken in several places costs one browser run per break. When an application change has plainly broken more than one thing, run it once with:
oxygen cases/login.js --rf=agent --continueOnError=true --timeout=5
Every failed step is then reported, each with its own screenshot and page
snapshot, and cases[].failedSteps counts them. Two cautions: later failures
may be consequences of an earlier one, so read them in order; and every broken
locator waits the full element timeout, which is why --timeout belongs in
the same command — at the 60s default a handful of stale locators turns into a
run measured in minutes.
Work from the step results, not just the final error:
name is the command, location is the script
line, failure.type the code above.VERIFY_ERROR steps — non-fatal, so an unrelated-looking later
failure may be their consequence.alsoAppearsIn — before editing, decide the fix for the locator once,
then apply it to every line listed there.When iterating toward a passing test:
oxygen cases/login.js.Stop and ask for input when: the same failure survives three repair attempts; the fix would weaken an assertion; results alternate between pass and fail across identical runs (a flaky test is its own defect, and papering over it with retries or waits hides it).
Two consecutive clean runs is the minimum bar for calling a test fixed — one green run after a timing change proves very little.
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/oxygen-authorTurn a written manual test case into a working, verified Oxygen automated test — exploring the application, emitting the script, running it, and repairing failures until it passes. Use when given a manual test case, acceptance criteria, or a described scenario to automate./oxygen-setupCreate or restructure an Oxygen test automation project — directory layout, oxygen.conf.js, environments, suites, page-object and data file organization. Use when starting a new Oxygen project, adding environments or suites to an existing one, or when asked where a test, page object, or data file should live./oxygen-writeWrite or modify Oxygen test scripts — the async transformer rules, locator strategy, page objects, transactions, assert vs verify, waits, parameters and encrypted credentials. Use whenever authoring, editing, or reviewing a .js test file or page object in an Oxygen project.npx claudepluginhub oxygenhq/oxygen --plugin oxygenOther plugins' skills for the same job