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
Remove tab
Magnus Müller096b29c9f730
diff --git a/tests/ci/test_browser_session_tab_management.py b/tests/ci/test_browser_session_tab_management.pyindex c6aa6452d..92a7d3ce1 100644--- a/tests/ci/test_browser_session_tab_management.py+++ b/tests/ci/test_browser_session_tab_management.py@@ -7,7 +7,6 @@ from pytest_httpserver import HTTPServerload_dotenv()-from browser_use.agent.views import ActionModelfrom browser_use.browser.events import NavigateToUrlEventfrom browser_use.browser.profile import BrowserProfilefrom browser_use.browser.session import BrowserSession@@ -94,27 +93,6 @@ class TestTabManagement:# Helper methods- async def _execute_action(self, tools, browser_session: BrowserSession, action_data):- """Generic helper to execute any action via the tools."""- # Dynamically create an appropriate ActionModel class- action_type = list(action_data.keys())[0]- action_value = action_data[action_type]-- # Create the ActionModel with the single action field- class DynamicActionModel(ActionModel):- pass-- # Dynamically add the field with the right type annotation- setattr(DynamicActionModel, action_type, type(action_value) | None)-- # Execute the action- result = await tools.act(DynamicActionModel(**action_data), browser_session)-- # Give the browser a moment to process the action- await asyncio.sleep(0.5)-- return result-async def _reset_tab_state(self, browser_session: BrowserSession, base_url: str):# await browser_session.event_bus.dispatch(CloseTabEvent(target_id=browser_session.agent_focus.target_id))# TODO: close all tabs using events + create new tab + focus it