Skip to content

Chrome

The chrome template runs Chromium with the remote DevTools protocol listening on port 9222 inside the sandbox.

Drive it from inside the sandbox

DevTools is a WebSocket protocol, and public sandbox endpoints are HTTP only today — WebSockets arrive with the ingress gateway. Connecting a CDP client from your machine to a published endpoint will not work yet. Run the driving script inside the sandbox, where localhost:9222 is reachable.

Setup

bash
pip install ovrin
export OVRIN_API_KEY="ovrin_..."

Drive Chromium over CDP

python
import ovrin

client = ovrin.Client()  # reads OVRIN_API_KEY

sandbox = client.sandboxes.create(template="chrome", timeout=900)

sandbox.files.write("/workspace/drive.py", """
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp("http://localhost:9222")
    page = browser.contexts[0].new_page()
    page.goto("https://example.com")
    print(page.title())
    page.screenshot(path="/workspace/example.png")
""")

result = sandbox.run("python /workspace/drive.py", timeout=300)
print(result.stdout)          # Example Domain

png = sandbox.files.read_bytes("/workspace/example.png")
open("example.png", "wb").write(png)

sandbox.kill()

Publishing an HTTP port

For a plain HTTP service the sandbox serves, sandbox.endpoint(port) returns a public URL:

python
endpoint = sandbox.endpoint(8080)
print(endpoint["url"], endpoint["protocol"])

The console's endpoint panel does the same thing. The same HTTP-only limit applies — this publishes request/response traffic, not upgrades.

Chrome or Playwright?

chromeplaywright
What runsChromium with CDP on 9222Headless Chromium plus the Playwright library
Best forAttaching to a live browser, DevTools workScripted navigation, scraping, screenshots