Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fixed new context config
Gregor Žunič14239da7fcde
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 8dd4b91ed..2ddeea2bd 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -105,7 +105,9 @@ class Agent:if browser_context:self.browser_context = browser_contextelif self.browser:- self.browser_context = BrowserContext(browser=self.browser)+ self.browser_context = BrowserContext(+ browser=self.browser, config=self.browser.config.new_context_config+ )else:# If neither is provided, create both newself.browser = Browser()diff --git a/browser_use/browser/browser.py b/browser_use/browser/browser.pyindex c6e1d9011..fc2fbf645 100644--- a/browser_use/browser/browser.py+++ b/browser_use/browser/browser.py@@ -5,8 +5,8 @@ Playwright browser on steroids.import asyncioimport loggingfrom dataclasses import dataclass, field+from playwright._impl._api_structures import ProxySettings-from playwright.async_api import Browser as PlaywrightBrowserfrom playwright.async_api import (Playwright,@@ -165,11 +165,11 @@ class Browser:'--no-default-browser-check','--no-startup-window','--window-position=0,0',- # '--window-size=3000,3000',+ # '--window-size=1280,1000',]+ disable_security_args+ self.config.extra_chromium_args,- proxy=self.config.proxy+ proxy=self.config.proxy,)return browserdiff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex cdda16549..b0aa26d2d 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -225,7 +225,7 @@ class BrowserContext:# Original code for creating new contextcontext = await browser.new_context(viewport=self.config.browser_window_size,- no_viewport=self.config.no_viewport,+ no_viewport=False,user_agent=('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ''(KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36'