Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix tests

Nick Sweeting072ad02a1b7e
diff --git a/tests/ci/test_sequential_agents_reuse.py b/tests/ci/test_sequential_agents_reuse.py
index 5c8bea46a..44429aedd 100644
--- a/tests/ci/test_sequential_agents_reuse.py
+++ b/tests/ci/test_sequential_agents_reuse.py
@@ -171,45 +171,30 @@ class TestSequentialAgentsReuse:
urls3 = [h.state.url for h in history3.history if h.state and h.state.url]
assert httpserver.url_for('/page3') in urls3, f'Expected {httpserver.url_for("/page3")} in URLs: {urls3}'
- # Agent 4: Extract content from page 3
+ # Agent 4: Take a screenshot to confirm we're on page 3
agent4_actions = [
"""{
- "thinking": "Extracting page content",
+ "thinking": "Taking screenshot on page 3",
"evaluation_previous_goal": "Successfully navigated to page 3",
- "memory": "On page 3, need to capture content",
- "next_goal": "Extract page content",
- "action": [
- {"extract_page_content": {}}
- ]
- }""",
- """{
- "thinking": "Taking screenshot",
- "evaluation_previous_goal": "Extracted content",
- "memory": "Content extracted, taking screenshot",
- "next_goal": "Take screenshot",
+ "memory": "On page 3, need to take screenshot",
+ "next_goal": "Take screenshot of page 3",
"action": [
{"screenshot": {}}
]
- }""",
+ }"""
]
agent4 = Agent(
- task='Extract content from page 3',
+ task='Take screenshot on page 3',
llm=create_mock_llm(agent4_actions),
browser_session=browser_session,
)
- history4 = await agent4.run(max_steps=3)
+ history4 = await agent4.run(max_steps=2)
assert len(history4.history) >= 1
- # Verify all agents completed successfully
- found_success = False
- for step in history4.history:
- for result in step.result:
- if hasattr(result, 'extracted_content') and result.extracted_content:
- if 'Success!' in result.extracted_content:
- found_success = True
- break
- assert found_success, "Did not find 'Success!' in extracted content"
+ # Verify that agent 4 was on page 3
+ urls4 = [h.state.url for h in history4.history if h.state and h.state.url]
+ assert httpserver.url_for('/page3') in urls4, f'Expected {httpserver.url_for("/page3")} in URLs: {urls4}'
# Clean up
await browser_session.stop()