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
Tests
Magnus Müller32ce9161befc
diff --git a/tests/ci/test_browser_event_ClickElementEvent.py b/tests/ci/test_browser_event_ClickElementEvent.pyindex 7dae50a38..33a52e6b3 100644--- a/tests/ci/test_browser_event_ClickElementEvent.py+++ b/tests/ci/test_browser_event_ClickElementEvent.py@@ -72,21 +72,6 @@ def tools():class TestClickElementEvent:"""Test cases for ClickElementEvent and click action."""- async def test_error_handling(self, tools, browser_session):- """Test error handling when an action fails."""- # Create an action with an invalid index- invalid_action = {'click': ClickElementAction(index=999)} # doesn't exist on page-- from browser_use.agent.views import ActionModel-- class ClickActionModel(ActionModel):- click: ClickElementAction | None = None-- # This should fail since the element doesn't exist- result: ActionResult = await tools.act(ClickActionModel(**invalid_action), browser_session)-- assert result.error is not None-async def test_click_element_by_index(self, tools, browser_session, base_url, http_server):"""Test that click correctly clicks an element and handles different outcomes."""# Add route for clickable elements test pagediff --git a/tests/ci/test_browser_event_GetDropdownOptionsEvent.py b/tests/ci/test_browser_event_GetDropdownOptionsEvent.pyindex 2bac37996..a761b7a92 100644--- a/tests/ci/test_browser_event_GetDropdownOptionsEvent.py+++ b/tests/ci/test_browser_event_GetDropdownOptionsEvent.py@@ -452,32 +452,6 @@ class TestGetDropdownOptionsEvent:assert 'type' in dropdown_dataassert dropdown_data['type'] == 'custom'- @pytest.mark.skip(reason='Timeout issue - test takes too long to complete')- async def test_element_not_found_error(self, tools, browser_session: BrowserSession, base_url):- """Test get_dropdown_options with invalid element index."""- # Navigate to any test page- goto_action = {'navigate': GoToUrlAction(url=f'{base_url}/native-dropdown', new_tab=False)}-- class NavigateActionModel(ActionModel):- navigate: GoToUrlAction | None = None-- await tools.act(NavigateActionModel(**goto_action), browser_session)- await browser_session.event_bus.expect(NavigationCompleteEvent, timeout=10.0)-- # Try to get dropdown options with invalid index- class GetDropdownOptionsModel(ActionModel):- get_dropdown_options: dict[str, int]-- result = await tools.act(- action=GetDropdownOptionsModel(get_dropdown_options={'index': 99999}),- browser_session=browser_session,- )-- # Should return an error- assert isinstance(result, ActionResult)- assert result.error is not None- assert 'not found' in result.error.lower()-class TestSelectDropdownOptionEvent:"""Test SelectDropdownOptionEvent functionality for various dropdown types."""