Skip to content

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

Merge branch 'main' into mert/fix_error_messages

Mert Unsalf5284c996fd7
diff --cc browser_use/browser/default_action_watchdog.py
index d9384c827,5ee463821..512739bc7
--- a/browser_use/browser/default_action_watchdog.py
+++ b/browser_use/browser/default_action_watchdog.py
@@@ -203,16 -222,15 +222,15 @@@ class DefaultActionWatchdog(BaseWatchdo
element_type = element_node.attributes.get('type', '').lower() if element_node.attributes else ''
if tag_name == 'select':
- raise Exception('Cannot click on <select> elements. Use select_dropdown_option action instead.')
+ raise Exception('<llm_error_msg>Cannot click on <select> elements. Use select_dropdown_option action instead.</llm_error_msg>')
if tag_name == 'input' and element_type == 'file':
- raise Exception('Cannot click on file input elements. File uploads must be handled programmatically.')
+ raise Exception('<llm_error_msg>Cannot click on file input elements. File uploads must be handled programmatically.</llm_error_msg>')
# Get CDP client
- cdp_session = await self.browser_session.get_or_create_cdp_session()
+ cdp_session = await self.browser_session.get_or_create_cdp_session(target_id=element_node.target_id, focus=False)
# Get the correct session ID for the element's frame
- # session_id = await self._get_session_id_for_element(element_node)
session_id = cdp_session.session_id
# Get element bounds