WebBrowserBot Command Reference
Every command is a single JSON object with a
command field and its arguments. Every response is the same envelope: {success, session_id, data, error}. All per-session commands require the session_id returned by new_session. Required arguments are noted below.
Command Groups
Sessions and Profiles
new_sessionopens a browser session. Args:profile(required),provider(optional, omit for proxyless). Returnssession_idanddata: {profile, provider}.close_sessioncloses one session. Args:session_id. Returns{closed: true}.close_allcloses every session and stops Playwright. Returns{closed: true}.list_sessionslists open sessions with their profile, provider, tabs, active tab, and URL.create_profilemakes a fingerprint profile without opening a browser. Args:name(required),identity(optional object). Returns{profile, fingerprint}.get_profilereads a profile. Args:profile(required). Returns{identity, fingerprint, has_browser_state}.update_profilepatches a profile. Args:profile(required),fields(required object). Returns{profile, updated}.save_profilepersists the session's cookies and storage into its profile. Args:session_id. Returns{profile, saved: true}.list_profileslists profiles on disk.
Navigation
gotoloads a URL. Args:session_id,url(required),wait_until(optional, default "load"),timeout(optional ms, default 30000). Returns{title, url, html}, plus anoticeif the sticky IP rotated during the request.back,forward,refreshmove through history and reload. Args:session_id. Returns{title, url, html}.
Interaction
clickclicks an element by CSS selector, moving the mouse to the element center with a small human offset first. Args:session_id,selector(required). Returns{title, url, html}.typetypes text character by character with human-like delays. Args:session_id,selector(required),text,clear(optional bool). Returns{typed}.presspresses a key on the focused element. Args:session_id,key(required, e.g. "Enter"). Returns{pressed}.selectchooses an option in a select element. Args:session_id,selector(required),value(required). Returns{selected}.hoverhovers an element. Args:session_id,selector(required). Returns{hovered}.scrollscrolls the page or to an element. Args:session_id, and eitherselectorordirection("up"/"down", default "down") plusamount(px, default 500). Returns{scrolled: true}.mouse_clickclicks at raw page coordinates. Args:session_id,x(required),y(required). Returns{clicked_at, url, title}.waitwaits for a selector to appear. Args:session_id,selector(required),timeout(optional ms, default 30000). Returns{found}.
Reading
readreturns trimmed HTML with hidden nodes, styles, inline styles, and data-URIs removed. Args:session_id. Returns{title, url, html}.read_fullreturns the full raw HTML. Args:session_id. Returns{title, url, html}.textreturns the visible text (the page body innerText). Best for JS-rendered pages. Args:session_id. Returns{title, url, text}.screenshotsaves a PNG to the screenshots directory. Args:session_id,full_page(optional bool, default true). Returns{path, filename}.execute_jsruns JavaScript in the page and returns the result. Args:session_id,script(required). Returns{result}.
Tabs
new_tabopens a tab. Args:session_id,url(optional). Returns{tab, url}.switch_tabfocuses a tab. Args:session_id,tab(index, required). Returns{tab, url, title}.list_tabslists tabs. Args:session_id. Returns{tabs}.close_tabcloses a tab. Args:session_id,tab(index, required). Returns{closed_tab, tabs_remaining}.
Frames
list_frameslists frames on the page. Args:session_id. Returns{frames, count}.click_frameclicks a link inside a matching frame. Args:session_id,frame_match(required substring of the frame name or URL),selector(optional, default "a[href]"). Returns{clicked_href, current_url, current_title, tabs}.
Timing
sleeppauses. Args:ms(default 1000, clamped 100 to 30000). Returns{slept_ms}.
Good to know
When a human takes control of a session in the live viewer, drive commands are refused with a paused_for_takeover error while read-only commands keep working. See the live viewer guide for how to handle it.