Skip to content

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

Enhance example scripts and improve test handling

Magnus Müller14229cd6e3da
diff --git a/examples/custom-functions/notification.py b/examples/custom-functions/notification.py
index 0892eedf7..f5d0e0deb 100644
--- a/examples/custom-functions/notification.py
+++ b/examples/custom-functions/notification.py
@@ -13,7 +13,7 @@ from browser_use import ActionResult, Agent, ChatOpenAI, Tools
tools = Tools()
[email protected]('Done with task ')
[email protected]('Done with task')
async def done(text: str):
import yagmail # type: ignore
diff --git a/examples/simple.py b/examples/simple.py
index 0979c0ff9..3b563f2a0 100644
--- a/examples/simple.py
+++ b/examples/simple.py
@@ -1,8 +1,11 @@
-from browser_use import Agent, ChatOpenAI
+from browser_use import Agent, Browser, ChatOpenAI, Tools
+
+browser = Browser()
+tools = Tools()
+llm = (ChatOpenAI(model='gpt-4.1-mini'),)
agent = Agent(
task='Ask human for help',
- llm=ChatOpenAI(model='gpt-4.1-mini'),
)
agent.run_sync()
diff --git a/tests/ci/test_browser_session_tab_management.py b/tests/ci/test_browser_session_tab_management.py
index 19d29355f..c6aa6452d 100644
--- a/tests/ci/test_browser_session_tab_management.py
+++ b/tests/ci/test_browser_session_tab_management.py
@@ -166,7 +166,7 @@ class TestTabManagement:
print(f'WARNING: Expected 1 tab but found {initial_tab_count} tabs after _reset_tab_state')
# For now, let's adjust the test to work with the actual count
# TODO: fix this initial tab count issue
- return
+ pytest.skip('Initial tab count issue')
# We expect at least 1 tab but there might be more due to event-driven architecture
assert initial_tab_count >= 1
diff --git a/tests/ci/test_browser_watchdog_downloads_upload_full_circle.py b/tests/ci/test_browser_watchdog_downloads_upload_full_circle.py
index 931a3f7b1..f0ec60219 100644
--- a/tests/ci/test_browser_watchdog_downloads_upload_full_circle.py
+++ b/tests/ci/test_browser_watchdog_downloads_upload_full_circle.py
@@ -122,6 +122,8 @@ def download_upload_server():
server.expect_request('/download-page').respond_with_data(download_page_html, content_type='text/html')
+ # stop
+ server.stop()
# Skip complex HTTPServer attribute assignment - not supported
pytest.skip('Complex HTTPServer attribute assignment not supported')