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
Enhance error reporting in retry_async_function by including the exception message in ActionResult. Update scroll height retrieval logic to correctly negate the result, improving clarity and consistency in error handling.
Magnus Mülleraf09713d1572
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex 388d01fd9..92da630da 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -60,7 +60,7 @@ async def retry_async_function(await asyncio.sleep(sleep_seconds)logger.debug(f'Error (attempt {attempt + 1}/{n_retries}): {e}')if attempt == n_retries - 1: # Last attempt failed- return None, ActionResult(error=error_message)+ return None, ActionResult(error=error_message + str(e))# Should never reach here but make type checker happyreturn None, ActionResult(error=error_message)@@ -527,11 +527,11 @@ Explain the content of the page and that the requested information is not availaelse:# Get window height with retriesdy_result, action_result = await retry_async_function(- lambda: -(page.evaluate('() => window.innerHeight')), 'Scroll up failed due to an error.'+ lambda: page.evaluate('() => window.innerHeight'), 'Scroll up failed due to an error.')if action_result:return action_result- dy = dy_result+ dy = -(dy_result)try:await browser_session._scroll_container(dy)