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
fix examples issues
Nick Sweeting241b4e076be6
diff --git a/examples/browser/using_cdp.py b/examples/browser/using_cdp.pyindex 71538699b..f6e72cf86 100644--- a/examples/browser/using_cdp.py+++ b/examples/browser/using_cdp.py@@ -25,24 +25,23 @@ from langchain_google_genai import ChatGoogleGenerativeAIfrom pydantic import SecretStrfrom browser_use import Agent, Controller-from browser_use.browser import BrowserProfile, BrowserSession+from browser_use.browser import BrowserSessionapi_key = os.getenv('GOOGLE_API_KEY')if not api_key:raise ValueError('GOOGLE_API_KEY is not set')-browser_profile = BrowserProfile(+browser_session = BrowserSession(headless=False,cdp_url='http://localhost:9222',)-browser_session = BrowserSession(browser_profile=browser_profile)controller = Controller()async def main():task = 'In docs.google.com write my Papa a quick thank you for everything letter \n - Magnus'task += ' and save the document as pdf'- model = ChatGoogleGenerativeAI(model='gemini-2.0-flash-exp', api_key=SecretStr(str(api_key)))+ model = ChatGoogleGenerativeAI(model='gemini-2.0-flash-exp', api_key=SecretStr(api_key))agent = Agent(task=task,llm=model,diff --git a/examples/features/result_processing.py b/examples/features/result_processing.pyindex 6d0980323..b65212afd 100644--- a/examples/features/result_processing.py+++ b/examples/features/result_processing.py@@ -22,11 +22,8 @@ async def main():async with BrowserSession(browser_profile=BrowserProfile(headless=False,- disable_security=True,trace_path='./tmp/result_processing',- no_viewport=False,- window_width=1280,- window_height=1000,+ window_size={'width': 1280, 'height': 1000},user_data_dir='~/.config/browseruse/profiles/default',)) as browser_session:diff --git a/examples/use-cases/web_voyager_agent.py b/examples/use-cases/web_voyager_agent.pyindex 7ea771405..68b1d2c1b 100644--- a/examples/use-cases/web_voyager_agent.py+++ b/examples/use-cases/web_voyager_agent.py@@ -36,14 +36,9 @@ else:browser_session = BrowserSession(browser_profile=BrowserProfile(headless=False, # This is True in production- disable_security=True,minimum_wait_page_load_time=1, # 3 on prodmaximum_wait_page_load_time=10, # 20 on prod- # Set no_viewport=False to constrain the viewport to the specified dimensions- # This is useful for specific cases where you need a fixed viewport size- no_viewport=False,- window_width=1280,- window_height=1100,+ viewport={'width': 1280, 'height': 1100},user_data_dir='~/.config/browseruse/profiles/default',# trace_path='./tmp/web_voyager_agent',)