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 old tests
Nick Sweeting0c758f889463
diff --git a/tests/test_stress.py b/tests/test_stress.pyindex 07a5e8fab..9b4a666e9 100644--- a/tests/test_stress.py+++ b/tests/test_stress.py@@ -1,4 +1,3 @@-import asyncioimport osimport randomimport string@@ -9,32 +8,20 @@ from langchain_openai import AzureChatOpenAIfrom pydantic import SecretStrfrom browser_use.agent.service import Agent-from browser_use.browser.browser import Browser, BrowserConfig+from browser_use.browser import BrowserProfile, BrowserSessionfrom browser_use.controller.service import Controller[email protected](scope='session')-def event_loop():- loop = asyncio.get_event_loop_policy().new_event_loop()- yield loop- loop.close()--[email protected](scope='session')-async def browser(event_loop):- browser_instance = Browser(- config=BrowserConfig(+async def browser_session():+ browser_session = BrowserSession(+ browser_profile=BrowserProfile(headless=True,))- yield browser_instance- await browser_instance.close()---async def context(browser):- async with await browser.new_context() as context:- yield context+ await browser_session.start()+ yield browser_session+ await browser_session.stop()@pytest.fixture@@ -67,14 +54,13 @@ async def controller():yield controller-async def test_token_limit_with_multiple_extractions(llm, controller, context):+async def test_token_limit_with_multiple_extractions(llm, controller, browser_session):"""Test handling of multiple smaller extractions accumulating tokens"""agent = Agent(task='Call the magical function to get very special text 5 times',llm=llm,controller=controller,- browser_context=context,+ browser_session=browser_session,max_input_tokens=2000,save_conversation_path='tmp/stress_test/test_token_limit_with_multiple_extractions.json',)