Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix too many tabs

Nick Sweeting1de886b82a8d
diff --git a/browser_use/browser/browser.py b/browser_use/browser/browser.py
index eae261209..88fc7ba17 100644
--- a/browser_use/browser/browser.py
+++ b/browser_use/browser/browser.py
@@ -51,30 +51,30 @@ class BrowserConfig(BaseModel):
Configuration for the Browser.
Default values:
- headless: False
- Whether to run browser in headless mode (not recommended)
+ headless: False
+ Whether to run browser in headless mode (not recommended)
- disable_security: False
- Disable browser security features (required for cross-origin iframe support)
+ disable_security: True
+ Disable browser security features (required for cross-origin iframe support)
- extra_browser_args: []
- Extra arguments to pass to the browser
+ extra_browser_args: []
+ Extra arguments to pass to the browser
- wss_url: None
- Connect to a browser instance via WebSocket
+ wss_url: None
+ Connect to a browser instance via WebSocket
- cdp_url: None
- Connect to a browser instance via CDP
+ cdp_url: None
+ Connect to a browser instance via CDP
- browser_binary_path: None
- Path to a Browser instance to use to connect to your normal browser
- e.g. '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
+ browser_binary_path: None
+ Path to a Browser instance to use to connect to your normal browser
+ e.g. '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
- keep_alive: False
- Keep the browser alive after the agent has finished running
+ keep_alive: False
+ Keep the browser alive after the agent has finished running
- deterministic_rendering: False
- Enable deterministic rendering (makes GPU/font rendering consistent across different OS's and docker)
+ deterministic_rendering: False
+ Enable deterministic rendering (makes GPU/font rendering consistent across different OS's and docker)
"""
model_config = ConfigDict(arbitrary_types_allowed=True, extra='ignore')
@@ -87,7 +87,7 @@ class BrowserConfig(BaseModel):
extra_browser_args: list[str] = Field(default_factory=list)
headless: bool = False
- disable_security: bool = False
+ disable_security: bool = True
deterministic_rendering: bool = False
keep_alive: bool = Field(default=False, alias='_force_keep_browser_alive') # used to be called _force_keep_browser_alive
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.py
index 28dde79e1..27c801f5a 100644
--- a/browser_use/browser/context.py
+++ b/browser_use/browser/context.py
@@ -56,15 +56,15 @@ class BrowserContextConfig(BaseModel):
cookies_file: None
Path to cookies file for persistence
- disable_security: True
- Disable browser security features
+ disable_security: True
+ Disable browser security features
minimum_wait_page_load_time: 0.5
Minimum time to wait before getting page state for LLM input
- wait_for_network_idle_page_load_time: 1.0
- Time to wait for network requests to finish before getting page state.
- Lower values may result in incomplete page loads.
+ wait_for_network_idle_page_load_time: 1.0
+ Time to wait for network requests to finish before getting page state.
+ Lower values may result in incomplete page loads.
maximum_wait_page_load_time: 5.0
Maximum time to wait for page load before proceeding anyway
@@ -72,10 +72,7 @@ class BrowserContextConfig(BaseModel):
wait_between_actions: 1.0
Time to wait between multiple per step actions
- browser_window_size: {
- 'width': 1280,
- 'height': 1100,
- }
+ browser_window_size: {'width': 1280, 'height': 1100}
Default browser window size
no_viewport: False
@@ -135,7 +132,7 @@ class BrowserContextConfig(BaseModel):
disable_security: bool = True
- browser_window_size: BrowserContextWindowSize | None = Field(default_factory=lambda: {'width': 1280, 'height': 1100})
+ browser_window_size: BrowserContextWindowSize = Field(default_factory=lambda: {'width': 1280, 'height': 1100})
no_viewport: Optional[bool] = None
save_recording_path: str | None = None