Chrome
Manages a headless Chrome browser process.
Usage
Chrome(
path=None,
headless=True,
extra_args=None,
timeout=20.0,
)Launches Chrome with remote debugging enabled and provides the WebSocket URL for CDP communication.
Parameters
path: str | None = None-
Path to Chrome executable. If None, auto-detected via find_chrome().
headless: bool = True-
Whether to run in headless mode.
extra_args: list[str] | None = None-
Additional command-line arguments to pass to Chrome. These come after any arguments in the NOKAP_CHROME_ARGS environment variable.
timeout: float = 20.0- Maximum seconds to wait for Chrome to start and report its WS URL.
Notes
If Chrome fails because a macOS sandbox denies it mach-register (as Seatbelt-based agent sandboxes do), nokap retries once with --single-process.
Attributes
| Name | Description |
|---|---|
| pid | The Chrome process ID, or None if not running. |
| port | The remote debugging port. |
| ws_url | The WebSocket URL for CDP communication. |
pid
The Chrome process ID, or None if not running.
pid: int | None
port
The remote debugging port.
port: int
ws_url
The WebSocket URL for CDP communication.
ws_url: str
Methods
| Name | Description |
|---|---|
| close() | Terminate the Chrome process. |
| is_alive() | Check if the Chrome process is still running. |
close()
Terminate the Chrome process.
Usage
close()is_alive()
Check if the Chrome process is still running.
Usage
is_alive()