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
Merge branch 'main' into #582-detect-if-page.evaluate()-works-properly
Magnus Müller2c0c2970c3b8
diff --cc browser_use/dom/service.pyindex b802fad45,4255de97f..649aa9d90--- a/browser_use/dom/service.py+++ b/browser_use/dom/service.py@@@ -40,12 -45,10 +45,13 @@@ class DomServicehighlight_elements: bool,focus_element: int,viewport_expansion: int,- ) -> DOMElementNode:+ ) -> tuple[DOMElementNode, SelectorMap]:+ if await self.page.evaluate('1+1') != 2:+ raise ValueError('The page cannot evaluate javascript code properly')+- js_code = resources.read_text('browser_use.dom', 'buildDomTree.js')-+ # NOTE: We execute JS code in the browser to extract important DOM information.+ # The returned hash map contains information about the DOM tree and the+ # relationship between the DOM elements.args = {'doHighlightElements': highlight_elements,'focusHighlightIndex': focus_element,