Skip to content

API Reference parrot.bots.chrome

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.bots.chrome

View source

WebAgent — browser interaction via Chrome DevTools MCP.

Alias AIMessage

Re-exported from parrot.models.AIMessage.

Alias BasicAgent

Re-exported from parrot.bots.agent.BasicAgent.

Class ChromeConfig

Configuration for the chrome-devtools-mcp server.

Captures the subset of chrome-devtools-mcp CLI flags AI-Parrot's WebAgent needs to launch or attach to a Chrome instance, and renders them as the argument list consumed by npx chrome-devtools-mcp@latest.

Fields:

Field Type Default Description
browser_url str | None None Existing browser debugging endpoint to attach to (e.g. http://127.0.0.1:9333). When set, chrome-devtools-mcp connects instead of launching a new browser.
headless bool False Whether to launch Chrome without a visible window. Defaults to False so WebAgent sessions are visible by default; callers that want a headless session must opt in.
user_data_dir str | None None Path to a Chrome user data directory to reuse (profile, cookies, extensions).
channel Literal['stable', 'beta', 'dev', 'canary'] | None None Chrome release channel to launch, one of stable, beta, dev, or canary.
viewport str | None None Initial viewport size as "<width>x<height>" (e.g. "1920x1080").
executable_path str | None None Explicit path to the Chrome/Chromium binary to launch, overriding auto-detection.
isolated bool False Whether to use an isolated (incognito-like) browser context instead of the persistent profile.
no_usage_statistics bool True Whether to disable chrome-devtools-mcp's usage statistics reporting. Defaults to True.
auto_connect bool False Whether to auto-connect to an already-running Chrome instance instead of launching a new one.
port int 9222 Remote debugging port Chrome listens on. Defaults to 9222.

Method ChromeConfig.to_mcp_args

Build the argument list for npx chrome-devtools-mcp@latest.

to_mcp_args() -> list[str]

Returns: list[str] — list[str]: CLI arguments, starting with the npx invocation flags (-y chrome-devtools-mcp@latest) followed by one flag per configured option. Falsy/None fields are omitted.

Alias CompletionUsage

Re-exported from parrot.models.CompletionUsage.

Class ObscuraMCPConfig

Configuration for the native Obscura MCP server (FEAT-530).

When set on WebAgent, this registers Obscura's own obscura mcp stdio tool schema — a separate capability from Chrome DevTools MCP, added alongside (not instead of) it. ChromeConfig/Chrome DevTools MCP registration is unaffected either way.

Fields:

Field Type Default Description
binary_path str | None None Path to (or PATH-resolvable name of) the Obscura binary. Defaults to None, resolved to "obscura" on PATH by create_obscura_mcp_server().
name str 'obscura' MCP server name.
port int 9222 CDP port Obscura's native MCP mode should use internally.
stealth bool False Enable Obscura's stealth mode.
allow_private_network bool False Enable --allow-private-network.

Class QAAssertion

Formal acceptance criterion for a QA test case.

Fields:

Field Type Default Description
check Literal['element_visible', 'element_not_visible', 'text_contains', 'url_matches', 'no_console_errors', 'no_network_failures', 'screenshot_diff', 'performance', 'response_status', 'accessibility_check']
target str | None None
value str | None None
wait_timeout_ms int 5000 Max wait for element-based checks before asserting

Class QAFinding

Result of a single QA test case execution.

Fields:

Field Type Default Description
test_name str
status Literal['pass', 'fail', 'error', 'skip']
detail str
screenshot_path str | None None
console_errors list[str] []
duration_ms int | None None
retries int 0

Class QAReport

Structured QA report — maps to AIMessage.response (summary) + AIMessage.output.

Fields:

Field Type Default Description
summary str
url str
findings list[QAFinding] []
total int 0
passed int 0
failed int 0
errors int 0
skipped int 0
duration_ms int | None None

Attributes:

Attribute Type Description
exit_code int Return 0 if all tests passed, 1 if any failure or error occurred.

Method QAReport.to_junit_xml

Serialize this report to a JUnit XML document.

Uses only xml.etree.ElementTree (stdlib) to build a <testsuites><testsuite>...</testsuite></testsuites> document compatible with CircleCI, GitHub Actions, GitLab CI, and Jenkins JUnit parsers.

to_junit_xml(suite_name: str = 'WebAgent QA') -> str

Parameter Type Default Description
suite_name str 'WebAgent QA' Name reported for the <testsuite> element and used as the classname attribute on each <testcase>.

Returns: str — The complete XML document (including the XML declaration) as a string.

Class QATestCase

A QA test case with natural-language steps and optional assertions.

Fields:

Field Type Default Description
name str
url str
steps list[str]
expected str
assertions list[QAAssertion] []
screenshot_on_fail bool True
viewport str | None None
tags list[str] []
max_retries int 0 Retry failed test up to N times before final failure
timeout_ms int | None None Per-test timeout in ms; None -> use agent default

Attribute WEB_AGENT_SYSTEM_PROMPT

Class WebAgent

General-purpose web interaction agent via Chrome DevTools MCP.

Parameter Type Default Description
name str 'WebAgent'
chrome_config ChromeConfig | None None
obscura_config ObscuraMCPConfig | None None
default_timeout_ms int 60000
screenshot_dir str | None None
**kwargs {}

Attributes:

Attribute Type Description
system_prompt_template str

Method WebAgent.configure

Configure agent and connect Chrome DevTools MCP server.

When obscura_config is set, also registers Obscura's native MCP server (FEAT-530) — a separate tool schema from Chrome DevTools MCP, added alongside it. Chrome DevTools MCP defaults remain unchanged whether or not obscura_config is set.

configure(app=None) -> None

Parameter Type Default Description
app None Optional application/framework context, forwarded to BasicAgent.configure().

Method WebAgent.run_tests

Execute QA test cases and return a structured QAReport.

Each test case is executed individually (one ask() call per case) so that per-test retry and timeout can be applied. Cases that don't match tags (when provided) are reported as status="skip" without calling the LLM.

run_tests(test_cases: list[QATestCase], url: str | None = None, tags: list[str] | None = None) -> AIMessage

Parameter Type Default Description
test_cases list[QATestCase] List of test cases to execute.
url str | None None Base URL override (defaults to first test case's URL).
tags list[str] | None None Optional tag filter — only test cases whose tags intersect this list are executed. None runs all cases.

Returns: AIMessage — AIMessage with the aggregate QAReport in .output and the summary in .response.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally