TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/browser-use/browser-use/llms.txt
Use this file to discover all available pages before exploring further.
Browser class (alias for BrowserSession) manages browser lifecycle, configuration, and provides methods for direct browser control.
Browser is the recommended name. BrowserSession is the internal class name but both refer to the same class.Constructor
Core Settings
Unique identifier for this browser session. Auto-generated if not provided.
CDP URL for connecting to existing browser instance (e.g.,
"http://localhost:9222").Browser profile configuration. If not provided, direct parameters are used to create one.
Whether this is a local browser instance. Set to
False for remote browsers. Auto-detected from executable_path or cdp_url.Display & Appearance
Run browser without UI. Auto-detects based on display availability.
True = no UI, False = show window, None = auto-detect.Browser window size for headful mode. Format:
{'width': 1920, 'height': 1080}Window position from top-left corner in pixels.
Content area size. Format:
{'width': 1280, 'height': 720}Disable viewport emulation, content fits to window size.
Device scale factor (DPI). Set to
2.0 or 3.0 for high-resolution screenshots.Browser Behavior
Keep browser running after agent completes.
Restrict navigation to specific domains. Domain patterns:
'example.com'- Matches onlyhttps://example.com/*'*.example.com'- Matchesexample.comand all subdomains'http*://example.com'- Matches both HTTP and HTTPS'chrome-extension://*'- Matches Chrome extensions
Block navigation to specific domains. Uses same pattern format as
allowed_domains. When both are set, allowed_domains takes precedence.Load automation extensions (uBlock Origin, cookie handlers, ClearURLs).
Enable cross-origin iframe support (may increase complexity).
User Data & Profiles
Directory for browser profile data. Use
None for incognito mode. Auto-generated temp directory by default.Chrome profile subdirectory name (e.g.,
'Profile 1', 'Work Profile').Browser storage state (cookies, localStorage). Can be file path or dict object.
Network & Security
Proxy configuration. Format:
ProxySettings(server='http://host:8080', bypass='localhost', username='user', password='pass')Browser permissions to grant. Examples:
['camera', 'microphone', 'geolocation']Additional HTTP headers for connect requests (remote browsers only).
Browser Launch
Path to browser executable. Platform examples:
- macOS:
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' - Windows:
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' - Linux:
'/usr/bin/google-chrome'
Browser channel:
'chromium', 'chrome', 'chrome-beta', 'msedge', etc.Additional command-line arguments. Format:
['--disable-gpu', '--custom-flag=value']Environment variables for browser process. Format:
{'DISPLAY': ':0', 'LANG': 'en_US.UTF-8'}Enable Chromium sandboxing for security. Defaults to
False in Docker.Open DevTools panel automatically (requires
headless=False).List of default args to disable, or
True to disable all. Format: ['--enable-automation', '--disable-extensions']Timing & Performance
Minimum time to wait before capturing page state (seconds).
Time to wait for network activity to cease (seconds).
Time to wait between agent actions (seconds).
AI Integration
Highlight interactive elements for AI vision.
Alternative name for
highlight_elements.Optimize DOM tree by removing elements hidden behind others. Slightly experimental.
Filter highlight IDs from DOM output.
Downloads & Files
Automatically accept all downloads.
Directory for downloaded files. Format:
'./downloads' or Path object.Automatically download PDFs instead of viewing in browser.
Device Emulation
Custom user agent string. Example:
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)'Screen size information. Same format as
window_size.Recording & Debugging
Directory to save video recordings as
.mp4 files.Frame size (width, height) of video recording.
Framerate for video recording.
Path to save network trace files as
.har format.Directory to save complete trace files for debugging.
HAR content mode:
'omit', 'embed', or 'attach'.HAR recording mode:
'full' or 'minimal'.Cloud Browser
Use Browser Use cloud browser service. Requires
BROWSER_USE_API_KEY environment variable.Deprecated: Use
use_cloud instead. Alias for backward compatibility.Cloud browser configuration parameters.
UUID of cloud browser profile.
Country code for cloud proxy:
'us', 'uk', 'fr', 'it', 'jp', 'au', 'de', 'fi', 'ca', 'in'Session timeout in minutes (free: max 15 min, paid: max 240 min).
DOM Configuration
Maximum number of iframes to process.
Maximum iframe nesting depth.
Domains to whitelist for cookie handling.
Advanced Options
⚠️ NOT RECOMMENDED - Disables all browser security features.
⚠️ NOT RECOMMENDED - Forces consistent rendering but reduces performance.
Enable demo mode with browser overlay UI.
Methods
start()
Start the browser session.stop()
Stop the browser session without killing the process.kill()
Force-stop the browser and clean up all resources.reset()
Clear all cached CDP sessions.get_browser_state_summary()
Get current browser state including DOM and screenshot.Include screenshot in the state.
Use cached state if available.
Include recent browser events.
Complete browser state with URL, DOM, tabs, and optional screenshot.
get_current_page()
Get the current page as an Actor Page object.Current page actor, or
None if no page is open.get_pages()
Get all open pages.List of all open page actors.
new_page()
Create a new page (tab).Initial URL to navigate to. Defaults to
'about:blank'.New page actor.
close_page()
Close a page by Page object or target ID.Page object or target ID string.
cookies()
Get all browser cookies.List of browser cookies.
clear_cookies()
Clear all browser cookies.export_storage_state()
Export browser cookies and storage to storage_state format.Optional path to save storage_state.json.
Storage state dict with cookies in Playwright format.
set_extra_headers()
Set extra HTTP headers for all requests.Dictionary of header name -> value pairs.
Target to set headers on. Defaults to current focus.
Properties
cdp_client
CDP client for direct CDP communication.
browser_profile
Browser profile configuration.
agent_focus_target_id
Target ID of the currently focused tab.
session_manager
Session manager that owns all targets and sessions.
downloaded_files
List of files downloaded during this session.