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 clickaction error handling test
Nick Sweeting06488e11ba10
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yamlindex feab79ed2..3c92038c9 100644--- a/.github/workflows/test.yaml+++ b/.github/workflows/test.yaml@@ -1,9 +1,11 @@name: testpermissions:- contents: read+ actions: read+ contents: writepull-requests: write # Allow writing comments on PRsissues: write # Allow writing comments on issuesstatuses: write # Allow writing statuses on PRs+ discussions: writeon:push:diff --git a/tests/ci/test_controller.py b/tests/ci/test_controller.pyindex 7a6384877..e19e3105c 100644--- a/tests/ci/test_controller.py+++ b/tests/ci/test_controller.py@@ -268,17 +268,14 @@ class TestControllerIntegration:async def test_error_handling(self, controller, browser_session):"""Test error handling when an action fails."""# Create an action with an invalid index- invalid_action = {'click_element_by_index': ClickElementAction(index='abc')} # wrong type, expects a number+ invalid_action = {'click_element_by_index': ClickElementAction(index=999)} # doesn't exist on pageclass ClickActionModel(ActionModel):click_element_by_index: ClickElementAction | None = None# This should fail since the element doesn't exist- with pytest.raises(Exception) as excinfo:- await controller.act(ClickActionModel(**invalid_action), browser_session)-- # Verify that an appropriate error is raised- assert 'does not exist' in str(excinfo.value) or 'Element with index' in str(excinfo.value)+ result = await controller.act(ClickActionModel(**invalid_action), browser_session)+ assert result.success is Falseasync def test_wait_action(self, controller, browser_session):"""Test that the wait action correctly waits for the specified duration."""