Skip to content

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

fixed old tests

Gregor Žunič5574220b9108
diff --git a/tests/test_core_functionality.py b/tests/test_core_functionality.py
index b4a184960..f81b333fb 100644
--- a/tests/test_core_functionality.py
+++ b/tests/test_core_functionality.py
@@ -166,15 +166,15 @@ async def test_scroll_down(llm, controller):
)
# Get the browser instance
browser = controller.browser
- driver = browser._get_driver()
+ page = await browser.get_current_page()
# Navigate to the page and get initial scroll position
await agent.run(max_steps=1)
- initial_scroll_position = driver.execute_script('return window.pageYOffset;')
+ initial_scroll_position = await page.evaluate('window.scrollY;')
# Perform the scroll down action
await agent.run(max_steps=2)
- final_scroll_position = driver.execute_script('return window.pageYOffset;')
+ final_scroll_position = await page.evaluate('window.scrollY;')
# Validate that the scroll position has changed
assert final_scroll_position > initial_scroll_position, 'Page did not scroll down'