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
Dont log an error when go back is not fully done
magmuelleree317cd5102c
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex 99b9f9eea..6edcf0167 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -564,18 +564,21 @@ class BrowserContext:"""Navigate back in history"""page = await self.get_current_page()try:- # Add timeout and catch any timeout errors- await page.go_back(timeout=5000, wait_until='domcontentloaded')- await self._wait_for_page_and_frames_load(timeout_overwrite=1.0)+ # 10 ms timeout+ await page.go_back(timeout=10, wait_until='domcontentloaded')+ # await self._wait_for_page_and_frames_load(timeout_overwrite=1.0)except Exception as e:- logger.warning(f'Error during go_back: {e}')- # Continue even if there's an error since the navigation might have succeeded+ # Continue even if its not fully loaded, because we wait later for the page to load+ logger.debug(f'During go_back: {e}')async def go_forward(self):"""Navigate forward in history"""page = await self.get_current_page()- await page.go_forward()- await page.wait_for_load_state()+ try:+ await page.go_forward(timeout=10, wait_until='domcontentloaded')+ except Exception as e:+ # Continue even if its not fully loaded, because we wait later for the page to load+ logger.debug(f'During go_forward: {e}')async def close_current_tab(self):"""Close the current tab"""