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
Update how we import buildDomTree
magmueller7daac738313e
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.pyindex ddeec5ea9..22d388451 100644--- a/browser_use/dom/service.py+++ b/browser_use/dom/service.py@@ -28,8 +28,7 @@ class DomService:return DOMState(element_tree=element_tree, selector_map=selector_map)async def _build_dom_tree(self, highlight_elements: bool) -> DOMElementNode:- with resources.files('browser_use.dom').joinpath('buildDomTree.js').open('r') as f:- js_code = f.read()+ js_code = resources.files('browser_use.dom').joinpath('buildDomTree.js').read_text()eval_page = await self.page.evaluate(js_code, [highlight_elements]diff --git a/pyproject.toml b/pyproject.tomlindex cb259665c..7803b901f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ description = "Make websites accessible for AI agents"authors = [{ name = "Gregor Zunic" }]-version = "0.1.13"+version = "0.1.14"readme = "README.md"requires-python = ">=3.11"classifiers = [@@ -51,6 +51,9 @@ build-backend = "hatchling.build"[tool.hatch.build.targets.wheel]packages = ["browser_use"]+[tool.hatch.build.targets.wheel.force-include]+"browser_use/dom/buildDomTree.js" = "browser_use/dom/buildDomTree.js"+[tool.hatch.build]include = ["browser_use/**/*.js",