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 missing _update_state method
Nick Sweeting9eec34f916c4
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex 7af12fd85..201820c26 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -133,7 +133,9 @@ class Controller(Generic[Context]):if params.index not in selector_map:# Force a state refresh in case the cache is stalelogger.info(f'Element with index {params.index} not found in selector map, refreshing state...')- await browser_session._update_state() # This will refresh the cached state+ await browser_session.get_state_summary(+ cache_clickable_elements_hashes=True+ ) # This will refresh the cached stateselector_map = await browser_session.get_selector_map()if params.index not in selector_map:@@ -170,7 +172,7 @@ class Controller(Generic[Context]):if 'Execution context was destroyed' in error_msg or 'Cannot find context with specified id' in error_msg:# Page navigated during click - refresh state and return itlogger.info('Page context changed during click, refreshing state...')- await browser_session._update_state()+ await browser_session.get_state_summary(cache_clickable_elements_hashes=True)return ActionResult(error='Page navigated during click. Refreshed state provided.', include_in_memory=True)else:logger.warning(f'Element not clickable with index {params.index} - most likely the page changed')