Skip to content

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

default window size squareish

Gregor Žunič5e545d724276
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.py
index b0aa26d2d..b2f3e28f6 100644
--- a/browser_use/browser/context.py
+++ b/browser_use/browser/context.py
@@ -10,7 +10,7 @@ import os
import re
import time
import uuid
-from dataclasses import dataclass
+from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Optional, TypedDict
from playwright.async_api import Browser as PlaywrightBrowser
@@ -64,7 +64,10 @@ class BrowserContextConfig:
wait_between_actions: 1.0
Time to wait between multiple per step actions
- browser_window_size: {'width': 1280, 'height': 1024}
+ browser_window_size: {
+ 'width': 1280,
+ 'height': 1100,
+ }
Default browser window size
no_viewport: False
@@ -84,7 +87,9 @@ class BrowserContextConfig:
disable_security: bool = False
- browser_window_size: Optional[BrowserContextWindowSize] = None
+ browser_window_size: BrowserContextWindowSize = field(
+ default_factory=lambda: {'width': 1280, 'height': 1100}
+ )
no_viewport: Optional[bool] = None
save_recording_path: str | None = None
diff --git a/examples/web_voyager_agent.py b/examples/web_voyager_agent.py
index e6dce67da..cc6f28c37 100644
--- a/examples/web_voyager_agent.py
+++ b/examples/web_voyager_agent.py
@@ -18,8 +18,8 @@ browser = Browser(
disable_security=True,
new_context_config=BrowserContextConfig(
disable_security=True,
- minimum_wait_page_load_time=4,
- maximum_wait_page_load_time=20,
+ minimum_wait_page_load_time=1, # 3 on prod
+ maximum_wait_page_load_time=10, # 20 on prod
# no_viewport=True,
browser_window_size={
'width': 1280,
@@ -42,7 +42,7 @@ llm = AzureChatOpenAI(
# TASK = """
# Browse Coursera, which universities offer Master of Advanced Study in Engineering degrees? Tell me what is the latest application deadline for this degree? on https://www.coursera.org/"""
TASK = """
-Find the names of people in ArXiv's Leadership Team. on https://arxiv.org/
+Find and book a hotel in Paris with suitable accommodations for a family of four (two adults and two children) offering free cancellation for the dates of February 14-21, 2025. on https://www.booking.com/
"""