/openbrowser:e2e-testingfrom openbrowser
Runs end-to-end browser tests by simulating user interactions, verifying page content, and testing multi-page flows. Uses OpenBrowser MCP tools and CLI with no external API key.
Ships in openbrowser. 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.
Simulate real user interactions and verify web application behavior using Python code execution. Covers navigation, form interaction, content assertions, and multi-page flows.
These tests need a browser because they navigate, click, and inspect rendered state. OpenBrowser no-browser mode starts no Chrome, Blink, or V8 process, but it cannot run JavaScript, take screenshots, or use browser cookies, so it cannot replace the workflow below.
The CLI examples below run with openbrowser-ai -c. The MCP route runs the same browser functions inside execute_code; place a complete task sequence in one execute_code call and reuse its context_id for later calls. The CLI daemon starts automatically and persists variables across calls. Run openbrowser-ai warm once before a multi-call CLI workflow to start the daemon and browser before the workflow begins. Most browser functions are async, use await. list_downloads(), download_outcomes(), and download_failures() are synchronous.
openbrowser-ai -c needs no separate OpenAI, OpenBrowser, or MCP API key.
The CLI daemon persists cookies and login state in the Chrome user-data directory at ~/.config/openbrowser/profiles/daemon, so authenticated sessions can be reused across later runs. No storage_state.json file is written unless you configure one explicitly.
Best route. Keep one MCP context per test flow and batch each flow into one execute_code call: call create_context once, pass its context_id to every call, and call close_context when the flow ends. Use openbrowser-ai -c for a one-off CLI test or when MCP is unavailable, and run openbrowser-ai warm once before repeated CLI calls. Both routes expose the same browser functions and need no separate API key. Use fill_by_label, fill_selector, click_text, click_selector, wait_for_selector, and click_selector_and_wait_for_new_tab; the helpers wait for form submits and page loads. Use evaluate for assertions. Use lightweight render mode for functional flows and full render mode for screenshot or visual assertions. Use get_status after a failed or stalled call, and reset_browser only when no usable page target remains.
Before running, verify openbrowser-ai is installed:
openbrowser-ai --help
If not found, install:
# macOS/Linux
curl -fsSL https://raw.githubusercontent.com/billy-enrizky/openbrowser-ai/main/install.sh | sh
# Windows (PowerShell)
irm https://raw.githubusercontent.com/billy-enrizky/openbrowser-ai/main/install.ps1 | iex
openbrowser-ai -c - <<'EOF'
await navigate("https://staging.example.com")
state = await browser.get_browser_state_summary(include_screenshot=False)
assert "example" in state.url.lower(), f"Unexpected URL: {state.url}"
assert state.title, "Page title is empty"
print(f"Page loaded: {state.title} ({state.url})")
EOF
openbrowser-ai -c - <<'EOF'
# Check for expected text using JS
has_welcome = await evaluate("""
(function(){ return !!document.body.textContent.match(/Welcome to Example App/i) })()
""")
assert has_welcome, "Welcome message not found"
# Check specific element content
h1_text = await evaluate("document.querySelector('h1')?.textContent?.trim()")
assert h1_text == "Example App", f'Expected "Example App", got "{h1_text}"'
# Check no error messages
error_count = await evaluate("document.querySelectorAll('.error-message').length")
assert error_count == 0, f"Found {error_count} error messages on page"
print("All content assertions passed")
EOF
For visible labels and text, act directly in one step:
openbrowser-ai -c - <<'EOF'
await fill_by_label("Email", "[email protected]")
await fill_by_label("Password", "test-password")
await click_text("Sign in")
await wait_for_selector('[data-testid=dashboard], main.dashboard, #dashboard', timeout=5.0)
logged_in = await evaluate("!!document.querySelector('[data-testid=dashboard], main.dashboard, #dashboard')")
assert logged_in, "Login did not reach the dashboard"
EOF
Use find_element(...) when a later indexed action needs the resolved index. It reads a screenshotless browser state and can wait for an element after navigation.
You can also inspect and use indices directly:
openbrowser-ai -c - <<'EOF'
# Get form fields
state = await browser.get_browser_state_summary(include_screenshot=False)
for idx, el in state.dom_state.selector_map.items():
if el.attributes.get("type") in ("email", "text", "password") or el.tag_name == "button":
etype = el.attributes.get("type", "")
placeholder = el.attributes.get("placeholder", "")
print(f"[{idx}] <{el.tag_name}> type={etype} placeholder=\"{placeholder}\"")
# Fill and submit
await input_text(index=3, text="[email protected]")
await input_text(index=4, text="test-password")
await click(index=5) # Login button
await wait(2)
# Assert logged in
state = await browser.get_browser_state_summary(include_screenshot=False)
assert "dashboard" in state.url.lower() or "welcome" in state.title.lower(), \
f"Login may have failed. URL: {state.url}, Title: {state.title}"
print("Login test passed")
EOF
openbrowser-ai -c - <<'EOF'
# Click settings link
state = await browser.get_browser_state_summary(include_screenshot=False)
for idx, el in state.dom_state.selector_map.items():
if "settings" in el.get_all_children_text(max_depth=1).lower():
await click(index=idx)
break
await wait(1)
# Assert URL changed
path = await evaluate("window.location.pathname")
assert "/settings" in path, f"Expected /settings path, got {path}"
# Test back button
await go_back()
await wait(1)
state = await browser.get_browser_state_summary(include_screenshot=False)
print(f"After back: {state.url}")
EOF
openbrowser-ai -c - <<'EOF'
# Submit form with invalid data
await input_text(index=3, text="not-an-email")
await click(index=5)
await wait(1)
# Assert validation errors appear
errors = await evaluate("""
(function(){
const errs = document.querySelectorAll(".error, .invalid-feedback, [aria-invalid=\"true\"]");
return Array.from(errs).map(e => e.textContent.trim());
})()
""")
assert len(errors) > 0, "Expected validation errors but found none"
print(f"Validation errors shown: {errors}")
# Assert page did not navigate
path = await evaluate("window.location.pathname")
print(f"Still on: {path}")
EOF
openbrowser-ai -c - <<'EOF'
viewport = await evaluate("""
(function(){
return {
width: window.innerWidth,
height: window.innerHeight
}
})()
""")
vw = viewport["width"]
vh = viewport["height"]
print(f"Viewport: {vw}x{vh}")
# Check mobile menu visibility
mobile_display = await evaluate("""
(function(){
const el = document.querySelector(".mobile-menu");
return el ? window.getComputedStyle(el).display : "not found";
})()
""")
print(f"Mobile menu display: {mobile_display}")
EOF
openbrowser-ai -c - <<'EOF'
test_results = []
# Cart page
await navigate("https://staging.example.com/cart")
await wait(1)
cart_title = await evaluate("document.querySelector('h1')?.textContent?.trim()")
test_results.append({"test": "cart_page_loads", "passed": cart_title is not None, "detail": cart_title})
# Checkout
cart_count = await evaluate("JSON.parse(localStorage.getItem('cart'))?.items?.length || 0")
test_results.append({"test": "cart_has_items", "passed": cart_count > 0, "detail": f"{cart_count} items"})
# Print results
import json
passed = sum(1 for t in test_results if t["passed"])
total = len(test_results)
print(f"\nResults: {passed}/{total} passed")
print(json.dumps(test_results, indent=2))
EOF
-c - <<'EOF'), so all Python syntax works without shell escaping issues.assert statements for test assertions -- they produce clear error messages on failure.execute_code call.timeout=5.0 to wait_for_selector, click_selector, click_text, or fill_by_label when a control renders asynchronously.-c calls while the daemon is running, so you can accumulate test results across calls.evaluate() for DOM assertions and visible text. Read get_browser_state_summary(include_screenshot=False) once for page metadata and unknown controls, and pass cached=True for a repeat read on the same document.send_keys() for keyboard-only paths. Use get_tabs() to inspect open tabs, then pass the returned target_id as switch(tab_id=...) or close(tab_id=...).Run this step after the task, whether it succeeded or failed.
MCP route cleanup. Call close_context with the same context_id after the last execute_code call. When the result is close_failed with retryable: true, call close_context again. Keep the close result in the task record.
Do not stop a daemon you did not start. Check openbrowser-ai daemon status before the first browser call. If it already reports a running daemon, reuse it and leave it running at the end. If it reports daemon_not_running, this run starts one and must clean it up.
For a daemon started by this run:
openbrowser-ai daemon stop
daemon stop only acknowledges the request and returns. Poll openbrowser-ai daemon status until it reports daemon_not_running, up to about 30 seconds. If the daemon does not exit, run openbrowser-ai daemon force-stop, which waits and verifies listener, owner, and browser cleanup.
If the task can fail mid-workflow, run the workflow and cleanup in one shell block. The same shell detects daemon ownership before installing the EXIT trap:
status=$(openbrowser-ai daemon status 2>&1 || true)
case "$status" in
*daemon_not_running*) OPENBROWSER_DAEMON_OWNED=1 ;;
*) OPENBROWSER_DAEMON_OWNED=0 ;;
esac
cleanup() {
if [ "${OPENBROWSER_DAEMON_OWNED:-0}" != "1" ]; then
return 0
fi
openbrowser-ai daemon stop >/dev/null 2>&1 || true
i=0
while [ "$i" -lt 30 ]; do
status=$(openbrowser-ai daemon status 2>&1 || true)
case "$status" in
*daemon_not_running*) return 0 ;;
esac
sleep 1
i=$((i + 1))
done
openbrowser-ai daemon force-stop >/dev/null 2>&1 || true
}
trap cleanup EXIT
# Place every openbrowser-ai -c call for this run in this same shell block.
Persist results to disk before stopping the daemon. daemon reset clears the Python namespace. Call done() only to mark the task complete inside the agent loop. Persist results and stop the daemon for cleanup.
What SKILL.md sets; muted values are Claude Code's defaults
8 skills in this plugin
/accessibility-auditAudit web pages for accessibility issues, WCAG compliance, and screen reader compatibility.
Routes through keyless local MCP `create_context` and `execute_code` tools plus the `openbrowser-ai -c` CLI. No separate API key is required.
Trigger when the user asks to: check accessibility, run an a11y audit, test WCAG compliance,
check screen reader support, audit ARIA attributes, verify keyboard navigation,
find accessibility issues, or check for missing alt text or labels.
/deep-researchUse when the user asks for search, web search, source discovery, research, investigations, evidence gathering, comparisons, literature reviews, briefings, or cited reports.
Uses host reasoning with the keyless `openbrowser-ai web-search`, guarded `safe_scrape.py`, and `-c` CLI. The MCP `web_search` tool is an optional lead-generation helper; its snippets are not evidence. Browser capture uses the dedicated CLI daemon. No separate API key is required. The `-p` prompt route is an optional configured-provider route; this skill never uses it.
/file-downloadDownload files from websites, save PDFs, and read downloaded content.
Routes through keyless local MCP `create_context` and `execute_code` tools plus the `openbrowser-ai -c` CLI. No separate API key is required.
Trigger when the user asks to: download a file, save a PDF, export a document,
fetch a file from a URL, grab a report, download and read a PDF, or save page content as a file.
/form-fillingFill out web forms, submit data, and handle login or registration flows.
Routes through keyless local MCP `create_context` and `execute_code` tools plus the `openbrowser-ai -c` CLI. No separate API key is required.
Trigger when the user asks to: fill a form, submit data on a website, log in to a site,
register an account, complete a checkout, enter information into fields, or automate form submission.
/page-analysisAnalyze web page content, structure, and layout to understand what a page contains and how it is organized.
Routes through keyless local MCP `create_context` and `execute_code` tools plus the `openbrowser-ai -c` CLI. No separate API key is required.
Trigger when the user asks to: analyze a page, understand page structure, inspect a website,
summarize page content, examine page layout, review a web page, or describe what is on a page.
/setupInstall, configure, repair, or verify OpenBrowser for the first time.
Configures the keyless CLI and local MCP server. Provider keys apply only to optional Agent runs.
Trigger when the user asks to: install OpenBrowser, set up OpenBrowser,
configure the MCP server, install the CLI, set up browser profiles,
install the plugin skills, verify a browser, or repair a broken install.
npx claudepluginhub billy-enrizky/openbrowser-ai --plugin openbrowserOther plugins' skills for the same job