To run locally:
docker run finic/chrome
This will spin up the container and expose a websocket endpoint ws://localhost:8000/ws you connect to from Playwright. For example:
CDP_URL = "ws://localhost:8000/ws"
async def main():
print("Connecting to Browser...")
async with async_playwright() as pw:
browser = await pw.chromium.connect_over_cdp(CDP_URL)
try:
print("Connected! Navigating...")
page = await browser.new_page()
await page.goto("https://example.com", timeout=2 * 60 * 1000)
print("Navigated! Scraping page content...")
html = await page.content()
print(html)
finally:
await browser.close()
asyncio.run(main())
Connecting to the websocket endpoint starts up a session of chrome in headful mode inside the container. You can have multiple concurrent connections which correspond to separate browser sessions.
Finic is open source and Apache 2.0 licensed: https://github.com/finic-ai/finic