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
Test linter
Magnus Müller566bc3e2ab6b
diff --git a/tests/ci/test_browser_event_GetDropdownOptionsEvent.py b/tests/ci/test_browser_event_GetDropdownOptionsEvent.pyindex 1c3bbf1ac..87be20a1c 100644--- a/tests/ci/test_browser_event_GetDropdownOptionsEvent.py+++ b/tests/ci/test_browser_event_GetDropdownOptionsEvent.py@@ -356,8 +356,11 @@ class TestGetDropdownOptionsEvent:menu_index = idxbreak- assert menu_index is not None, (- f'Could not find ARIA menu element in selector map. Available elements: {[f"{idx}: {element.tag_name} role={element.attributes.get('role', 'None')}" for idx, element in selector_map.items()]}'+ assert menu_index is not None, 'Could not find ARIA menu element in selector map. Available elements: [%s]' % (+ ', '.join(+ '{}: {} role={}'.format(idx, element.tag_name, element.attributes.get('role', 'None'))+ for idx, element in selector_map.items()+ ))# Test via tools action@@ -410,8 +413,11 @@ class TestGetDropdownOptionsEvent:dropdown_index = idxbreak- assert dropdown_index is not None, (- f'Could not find custom dropdown element in selector map. Available elements: {[f"{idx}: {element.tag_name} id={element.attributes.get('id', 'None')}" for idx, element in selector_map.items()]}'+ assert dropdown_index is not None, 'Could not find custom dropdown element in selector map. Available elements: [%s]' % (+ ', '.join(+ '{}: {} id={}'.format(idx, element.tag_name, element.attributes.get('id', 'None'))+ for idx, element in selector_map.items()+ ))# Test via tools actiondiff --git a/tests/ci/test_browser_session_start.py b/tests/ci/test_browser_session_start.pyindex a6ccd9f27..4b39c2fce 100644--- a/tests/ci/test_browser_session_start.py+++ b/tests/ci/test_browser_session_start.py@@ -549,7 +549,7 @@ class TestBrowserSessionReusePatterns:task='The second task...',llm=mock_llm,browser_profile=reused_profile,- # Disable memory for tests+ # Disable memory for tests)await agent2.run()@@ -580,7 +580,7 @@ class TestBrowserSessionReusePatterns:task='The first task...',llm=mock_llm,browser_session=reused_session,- # Disable memory for tests+ # Disable memory for tests)await agent1.run()@@ -592,7 +592,7 @@ class TestBrowserSessionReusePatterns:task='The second task...',llm=mock_llm,browser_session=reused_session,- # Disable memory for tests+ # Disable memory for tests)await agent2.run()diff --git a/tests/ci/test_browser_watchdog_downloads.py b/tests/ci/test_browser_watchdog_downloads.pyindex 6350b5775..426da3359 100644--- a/tests/ci/test_browser_watchdog_downloads.py+++ b/tests/ci/test_browser_watchdog_downloads.py@@ -15,6 +15,7 @@ from browser_use.browser.events import (BrowserStoppedEvent,ClickElementEvent,FileDownloadedEvent,+ NavigateToUrlEvent,)from browser_use.browser.profile import BrowserProfilefrom browser_use.browser.session import BrowserSessiondiff --git a/tests/ci/test_registry.py b/tests/ci/test_registry.pyindex 263a7e627..a402430b9 100644--- a/tests/ci/test_registry.py+++ b/tests/ci/test_registry.py@@ -766,11 +766,8 @@ class TestDecoratedFunctionBehavior:"""Decorated function should ignore extra kwargs for easy unpacking"""registry = Registry()- class MockPage:- pass-@registry.action('Simple action')- async def simple_action(value: int, page: Page):+ async def simple_action(value: int):return ActionResult(extracted_content=str(value))# Should work even with extra kwargs@@ -813,7 +810,6 @@ class TestParamsModelGeneration:assert 'include_images' in model_fields# Should NOT include special params- assert 'page' not in model_fieldsassert 'browser_session' not in model_fieldsdef test_preserves_type_annotations(self):@@ -875,7 +871,6 @@ class TestErrorMessages:error_msg = str(e)assert 'page: str' in error_msgassert 'conflicts' in error_msg- assert f'page: {repr(Page)}' in error_msg # Show expected typeassert 'bad' in error_msg.lower() # Show function name@@ -905,17 +900,6 @@ class TestParameterOrdering:assert set(model_fields.keys()) == {'first', 'second', 'third'}assert model_fields['third'].default is True- def test_all_params_at_end(self):- """Should work with all action params at the end"""- registry = Registry()-- @registry.action('Params at end')- async def params_at_end(page: Page, query: str, limit: int = 10):- return ActionResult()-- action = registry.registry.actions['params_at_end']- assert set(action.param_model.model_fields.keys()) == {'query', 'limit'}-def test_extract_content_pattern_registration(self):"""Test that the extract_content pattern with mixed params registers correctly"""registry = Registry()diff --git a/tests/scripts/test_frame_hierarchy.py b/tests/scripts/test_frame_hierarchy.pyindex 7f9225ef8..3d3ea148b 100755--- a/tests/scripts/test_frame_hierarchy.py+++ b/tests/scripts/test_frame_hierarchy.py@@ -134,7 +134,7 @@ async def analyze_frame_hierarchy(url):for tid, sess_id in target_sessions.items():try:await session.cdp_client.send.Target.detachFromTarget(params={'sessionId': sess_id})- except:+ except Exception:passprint('\n📊 Frame Statistics:')