Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Watch and interact with a running Driver browser session.
cdpUrl
https://viewer.driver.dev?ws=<cdp-url>
const session = await client.browser.session.create({ type: "hosted" }); const viewerUrl = `https://viewer.driver.dev?ws=${session.cdpUrl}`; console.log(viewerUrl);
viewer_url = f"https://viewer.driver.dev?ws={session['cdpUrl']}" print(viewer_url)
ws
theme
light
dark
async function waitForActiveSession(sessionId: string, timeoutMs = 30000) { const startedAt = Date.now(); while (Date.now() - startedAt < timeoutMs) { const session = await client.browser.session.get({ sessionId }); if (session.status === "active" && session.cdpUrl) return session; if (session.status === "completed" || session.status === "error") { throw new Error(`Session ended with status: ${session.status}`); } await new Promise((resolve) => setTimeout(resolve, 1000)); } throw new Error("Timed out waiting for session"); }
import os import time import requests def wait_for_active_session(session_id: str, timeout_seconds: int = 30): started_at = time.time() while time.time() - started_at < timeout_seconds: resp = requests.get( "https://api.driver.dev/v1/browser/session", headers={"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}"}, params={"sessionId": session_id}, ) resp.raise_for_status() session = resp.json() if session["status"] == "active" and session.get("cdpUrl"): return session if session["status"] in ("completed", "error"): raise RuntimeError(f"Session ended with status: {session['status']}") time.sleep(1) raise TimeoutError("Timed out waiting for session")
starting
active
completed
error