Skip to content

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

Linter

Magnus Mülleraa500c98737c
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 6d327cbbe..21c892abe 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -2894,9 +2894,7 @@ class BrowserSession(BaseModel):
)
object_id = result.get('object', {}).get('objectId')
if not object_id:
- raise ValueError(
- f'Could not find backendNodeId={node.backend_node_id} in target_id={cdp_session.target_id}'
- )
+ raise ValueError(f'Could not find backendNodeId={node.backend_node_id} in target_id={cdp_session.target_id}')
return cdp_session
except (ValueError, Exception) as e:
# Fall back to main session if frame not found
@@ -2911,9 +2909,7 @@ class BrowserSession(BaseModel):
)
object_id = result.get('object', {}).get('objectId')
if not object_id:
- raise ValueError(
- f'Could not find backendNodeId={node.backend_node_id} in target_id={cdp_session.target_id}'
- )
+ raise ValueError(f'Could not find backendNodeId={node.backend_node_id} in target_id={cdp_session.target_id}')
except Exception as e:
self.logger.debug(f'Failed to get CDP client for target {node.target_id}: {e}, using main session')
diff --git a/browser_use/browser/watchdogs/default_action_watchdog.py b/browser_use/browser/watchdogs/default_action_watchdog.py
index 0c281d2e1..bbda1655e 100644
--- a/browser_use/browser/watchdogs/default_action_watchdog.py
+++ b/browser_use/browser/watchdogs/default_action_watchdog.py
@@ -300,9 +300,7 @@ class DefaultActionWatchdog(BaseWatchdog):
element_type = element_node.attributes.get('type', '').lower() if element_node.attributes else ''
if tag_name == 'select':
- msg = (
- f'Cannot click on <select> elements. Use dropdown_options(index={element_node.backend_node_id}) action instead.'
- )
+ msg = f'Cannot click on <select> elements. Use dropdown_options(index={element_node.backend_node_id}) action instead.'
self.logger.warning(msg)
raise BrowserError(
message=msg,