> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.scrapybara.com/browser/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.scrapybara.com/_mcp/server. # Browser ## BrowserInstance The `BrowserInstance` is a lightweight Chromium instance that supports interactive streaming, computer actions, Playwright CDP control, and saving/loading auth states. We recommend using this instance type if your task is constrained to the browser. * Fastest start up time * 1x compute cost ## Start a browser instance #### Python ```python instance = client.start_browser() ``` #### TypeScript ```typescript const instance = await client.startBrowser(); ``` ## Available actions ### get\_cdp\_url Get the Playwright CDP URL #### Python ```python cdp_url = instance.get_cdp_url().cdp_url ``` #### TypeScript ```typescript const cdpUrl = await instance.getCdpUrl().cdpUrl; ``` ### save\_auth Save the browser auth state #### Python ```python auth_state_id = instance.browser.save_auth(name="default").auth_state_id ``` #### TypeScript ```typescript const authStateId = await instance.browser.saveAuth({name: "default"}).authStateId; ``` ### authenticate Authenticate the browser using a saved auth state #### Python ```python instance.browser.authenticate(auth_state_id=auth_state_id) ``` #### TypeScript ```typescript await instance.browser.authenticate({authStateId: authStateId}); ``` ### screenshot Take a base64 encoded image of the current desktop #### Python ```python base_64_image = instance.screenshot().base_64_image ``` #### TypeScript ```typescript const base64Image = await instance.screenshot(); ``` ### get\_stream\_url Get the interactive stream URL #### Python ```python stream_url = instance.get_stream_url().stream_url ``` #### TypeScript ```typescript const streamUrl = await instance.getStreamUrl(); ``` ### computer Perform computer actions with the mouse and keyboard #### `move_mouse` Move mouse cursor to specific coordinates **`coordinates`** `array` — required \[x, y] coordinates to move to --- **`hold_keys`** `array` List of modifier keys to hold during the action --- #### Python **`Move mouse`** ```python Move mouse instance.computer(action="move_mouse", coordinates=[100, 200]) ``` **`Move mouse while holding shift`** ```python Move mouse while holding shift instance.computer(action="move_mouse", coordinates=[100, 200], hold_keys=["shift"]) ``` #### TypeScript **`Move mouse`** ```typescript Move mouse await instance.computer({action: "move_mouse", coordinates: [100, 200]}); ``` **`Move mouse while holding shift`** ```typescript Move mouse while holding shift await instance.computer({action: "move_mouse", coordinates: [100, 200], holdKeys: ["shift"]}); ``` #### `click_mouse` Perform a mouse click at current position or specified coordinates **`button`** `string` — required Mouse button to click ("left", "right", "middle", "back", "forward") --- **`click_type`** `string` — default: click Type of click action ("down", "up", "click") --- **`coordinates`** `array` \[x, y] coordinates to click at --- **`num_clicks`** `number` — default: 1 Number of clicks --- **`hold_keys`** `array` List of modifier keys to hold during the action --- #### Python **`Left click at current position`** ```python Left click at current position instance.computer(action="click_mouse", button="left") ``` **`Right click at coordinates`** ```python Right click at coordinates instance.computer(action="click_mouse", button="right", coordinates=[300, 400]) ``` **`Mouse down`** ```python Mouse down instance.computer(action="click_mouse", button="left", click_type="down") ``` **`Double click at coordinates`** ```python Double click at coordinates instance.computer(action="click_mouse", button="left", num_clicks=2, coordinates=[500, 300]) ``` #### TypeScript **`Left click at current position`** ```typescript Left click at current position await instance.computer({action: "click_mouse", button: "left"}); ``` **`Right click at coordinates`** ```typescript Right click at coordinates await instance.computer({action: "click_mouse", button: "right", coordinates: [300, 400]}); ``` **`Mouse down`** ```typescript Mouse down await instance.computer({action: "click_mouse", button: "left", clickType: "down"}); ``` **`Double click at coordinates`** ```typescript Double click at coordinates await instance.computer({action: "click_mouse", button: "left", numClicks: 2, coordinates: [500, 300]}); ``` #### `drag_mouse` Click and drag from current position to specified coordinates **`path`** `array` — required List of \[x, y] coordinate pairs defining the drag path --- **`hold_keys`** `array` List of modifier keys to hold during the action --- #### Python **`Drag to coordinates`** ```python Drag to coordinates instance.computer(action="drag_mouse", path=[[100, 200], [300, 400]]) ``` #### TypeScript **`Drag to coordinates`** ```typescript Drag to coordinates await instance.computer({action: "drag_mouse", path: [[100, 200], [300, 400]]}); ``` #### `scroll` Scroll horizontally and/or vertically **`coordinates`** `array` \[x, y] coordinates to scroll at --- **`delta_x`** `number` — default: 0 Horizontal scroll amount --- **`delta_y`** `number` — default: 0 Vertical scroll amount --- **`hold_keys`** `array` List of modifier keys to hold during the action --- #### Python **`Scroll down`** ```python Scroll down instance.computer(action="scroll", coordinates=[100, 100], delta_x=0, delta_y=200) ``` **`Scroll right`** ```python Scroll right instance.computer(action="scroll", coordinates=[100, 100], delta_x=200, delta_y=0) ``` #### TypeScript **`Scroll down`** ```typescript Scroll down await instance.computer({action: "scroll", coordinates: [100, 100], deltaX: 0, deltaY: 200}); ``` **`Scroll right`** ```typescript Scroll right await instance.computer({action: "scroll", coordinates: [100, 100], deltaX: 100, deltaY: 0}); ``` #### `press_key` Press a key or combination of keys. Scrapybara supports keys defined by [X keysyms](https://github.com/D-Programming-Deimos/libX11/blob/master/c/X11/keysymdef.h). Common aliases are also supported: * `alt` → `Alt_L` * `ctrl`, `control` → `Control_L` * `meta` → `Meta_L` * `super` → `Super_L` * `shift` → `Shift_L` * `enter`, `return` → `Return` **`keys`** `array` — required List of keys to press --- **`duration`** `number` Time to hold keys in seconds --- #### Python **`Press ctrl+c`** ```python Press ctrl+c instance.computer(action="press_key", keys=["ctrl", "c"]) ``` **`Hold shift for 2 seconds`** ```python Hold shift for 2 seconds instance.computer(action="press_key", keys=["shift"], duration=2) ``` **`Press enter/return`** ```python Press enter/return instance.computer(action="press_key", keys=["Return"]) ``` #### TypeScript **`Press ctrl+c`** ```typescript Press ctrl+c await instance.computer({action: "press_key", keys: ["ctrl", "c"]}); ``` **`Hold shift for 2 seconds`** ```typescript Hold shift for 2 seconds await instance.computer({action: "press_key", keys: ["shift"], duration: 2}); ``` **`Press enter/return`** ```typescript Press enter/return await instance.computer({action: "press_key", keys: ["Return"]}); ``` #### `type_text` Type text into the active window **`text`** `string` — required Text to type --- **`hold_keys`** `array` List of modifier keys to hold while typing --- #### Python **`Type text`** ```python Type text instance.computer(action="type_text", text="Hello world") ``` #### TypeScript **`Type text`** ```typescript Type text await instance.computer({action: "type_text", text: "Hello world"}); ``` #### `wait` Wait for a specified duration **`duration`** `number` — required Time to wait in seconds --- #### Python **`Wait for 3 seconds`** ```python Wait for 3 seconds instance.computer(action="wait", duration=3) ``` #### TypeScript **`Wait for 3 seconds`** ```typescript Wait for 3 seconds await instance.computer({action: "wait", duration: 3}); ``` #### `take_screenshot` Take a screenshot of the desktop #### Python ```python screenshot = instance.computer(action="take_screenshot").base64_image ``` #### TypeScript ```typescript const screenshot = await instance.computer({action: "take_screenshot"}).base64Image; ``` #### `get_cursor_position` Get current mouse cursor coordinates #### Python ```python cursor_position = instance.computer(action="get_cursor_position").output ``` #### TypeScript ```typescript const cursorPosition = await instance.computer({action: "get_cursor_position"}).output; ``` ### `stop` Stop the instance #### Python ```python instance.stop() ``` #### TypeScript ```typescript await instance.stop(); ``` ### `pause` Pause the instance #### Python ```python instance.pause() ``` #### TypeScript ```typescript await instance.pause(); ``` ### `resume` Resume the instance #### Python **`Resume with default timeout`** ```python Resume with default timeout instance.resume() ``` **`Resume with custom timeout`** ```python Resume with custom timeout instance.resume(timeout_hours=2.5) ``` #### TypeScript **`Resume with default timeout`** ```typescript Resume with default timeout await instance.resume(); ``` **`Resume with custom timeout`** ```typescript Resume with custom timeout await instance.resume({timeoutHours: 2.5}); ``` ## Compatible tools * `ComputerTool` ## Screen resolution By default, the Browser instance runs at 1024x768 resolution. You can specify a custom resolution when starting the instance: #### Python ```python instance = client.start_browser(resolution=[1920, 1080]) ``` #### TypeScript ```typescript const instance = await client.startBrowser({resolution: [1920, 1080]}); ``` > Deploy a Browser instance