Complete reference for all browser configuration options
cdp_url
: CDP URL for connecting to existing browser instance (e.g., "http://localhost:9222"
)headless
(default: None
): Run browser without UI. Auto-detects based on display availability (True
/False
/None
)window_size
: Browser window size for headful mode. Use dict {'width': 1920, 'height': 1080}
or ViewportSize
objectwindow_position
(default: {'width': 0, 'height': 0}
): Window position from top-left corner in pixelsviewport
: Content area size, same format as window_size
. Use {'width': 1280, 'height': 720}
or ViewportSize
objectno_viewport
(default: None
): Disable viewport emulation, content fits to window sizedevice_scale_factor
: Device scale factor (DPI). Set to 2.0
or 3.0
for high-resolution screenshotskeep_alive
(default: None
): Keep browser running after agent completesallowed_domains
: Restrict navigation to specific domains. Domain pattern formats:
'example.com'
- Matches only https://example.com/*
'*.example.com'
- Matches https://example.com/*
and any subdomain https://*.example.com/*
'http*://example.com'
- Matches both http://
and https://
protocols'chrome-extension://*'
- Matches any Chrome extension URLexample.*
) are not allowed for security['*.google.com', 'https://example.com', 'chrome-extension://*']
enable_default_extensions
(default: True
): Load automation extensions (uBlock Origin, cookie handlers, ClearURLs)cross_origin_iframes
(default: False
): Enable cross-origin iframe support (may cause complexity)is_local
(default: True
): Whether this is a local browser instance. Set to False
for remote browsers. If we have a executable_path
set, it will be automatically set to True
. This can effect your download behavior.user_data_dir
(default: auto-generated temp): Directory for browser profile data. Use None
for incognito modeprofile_directory
(default: 'Default'
): Chrome profile subdirectory name ('Profile 1'
, 'Work Profile'
, etc.)storage_state
: Browser storage state (cookies, localStorage). Can be file path string or dict objectproxy
: Proxy configuration using ProxySettings(server='http://host:8080', bypass='localhost,127.0.0.1', username='user', password='pass')
permissions
(default: ['clipboardReadWrite', 'notifications']
): Browser permissions to grant. Use list like ['camera', 'microphone', 'geolocation']
headers
: Additional HTTP headers for connect requests (remote browsers only)
executable_path
: Path to browser executable for custom installations. Platform examples:
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
'/usr/bin/google-chrome'
channel
: Browser channel ('chromium'
, 'chrome'
, 'chrome-beta'
, 'msedge'
, etc.)args
: Additional command-line arguments for the browser. Use list format: ['--disable-gpu', '--custom-flag=value', '--another-flag']
env
: Environment variables for browser process. Use dict like {'DISPLAY': ':0', 'LANG': 'en_US.UTF-8', 'CUSTOM_VAR': 'test'}
chromium_sandbox
(default: True
except in Docker): Enable Chromium sandboxing for securitydevtools
(default: False
): Open DevTools panel automatically (requires headless=False
)ignore_default_args
: List of default args to disable, or True
to disable all. Use list like ['--enable-automation', '--disable-extensions']
minimum_wait_page_load_time
(default: 0.25
): Minimum time to wait before capturing page state in secondswait_for_network_idle_page_load_time
(default: 0.5
): Time to wait for network activity to cease in secondswait_between_actions
(default: 0.5
): Time to wait between agent actions in secondshighlight_elements
(default: True
): Highlight interactive elements for AI visionaccept_downloads
(default: True
): Automatically accept all downloadsdownloads_path
: Directory for downloaded files. Use string like './downloads'
or Path
objectauto_download_pdfs
(default: True
): Automatically download PDFs instead of viewing in browseruser_agent
: Custom user agent string. Example: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)'
screen
: Screen size information, same format as window_size
record_video_dir
: Directory to save video recordings as .webm
filesrecord_har_path
: Path to save network trace files as .har
formattraces_dir
: Directory to save complete trace files for debuggingrecord_har_content
(default: 'embed'
): HAR content mode ('omit'
, 'embed'
, 'attach'
)record_har_mode
(default: 'full'
): HAR recording mode ('full'
, 'minimal'
)disable_security
(default: False
): ⚠️ NOT RECOMMENDED - Disables all browser security featuresdeterministic_rendering
(default: False
): ⚠️ NOT RECOMMENDED - Forces consistent rendering but reduces performanceBrowserProfile
and then to the Browser
.
Browser
is an alias for BrowserSession
- they are exactly the same class:
Use Browser
for cleaner, more intuitive code.