Low-level Chromium process management.
Spawns a headless Chromium instance and provides the WebSocket debugger URL
needed to connect via Automator.Client or Automator.Scraper.
Example
browser = Automator.Chromium.spawn()
# => %{chromium: #Port<...>, os_pid: 1234, port: 9222, ws_url: "ws://..."}
# Connect to the browser target
{:ok, client} = Automator.Client.start_link(browser.ws_url)
{:ok, result} = Automator.Client.send_command(client, "Browser.getVersion")
Automator.Chromium.kill(browser)Browser Flags
Chromium is launched with these flags:
| Flag | Value |
|---|---|
--headless | new |
--no-sandbox | — |
--disable-gpu | — |
--window-size | 1920,1080 |
--remote-debugging-port | auto-detected (available TCP port) |
When to Use
Use Chromium directly when you want to:
- Connect multiple
Automator.Clientinstances to the same browser - Manage the browser lifecycle independently of scraping sessions
- Access the browser-level WebSocket target (not a page target)
For most use cases, prefer Automator.Scraper which handles this automatically.
Summary
Functions
Kills the Chromium process by OS PID.
Example
browser = Automator.Chromium.spawn()
Automator.Chromium.kill(browser)
Spawns a headless Chromium instance on an available port.
Launches Chromium with --headless=new, --no-sandbox, --disable-gpu,
and --window-size=1920,1080. Finds an available TCP port automatically
and sets --remote-debugging-port to it.
Returns a map with :chromium, :os_pid, :port, and :ws_url.
Example
browser = Automator.Chromium.spawn()
IO.puts(browser.ws_url)
# => "ws://localhost:9222/devtools/browser/..."