Skip to content

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

Update how we import buildDomTree

magmueller55e561def69f
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.py
index 22d388451..ae8f21498 100644
--- a/browser_use/dom/service.py
+++ b/browser_use/dom/service.py
@@ -28,7 +28,7 @@ class DomService:
return DOMState(element_tree=element_tree, selector_map=selector_map)
async def _build_dom_tree(self, highlight_elements: bool) -> DOMElementNode:
- js_code = resources.files('browser_use.dom').joinpath('buildDomTree.js').read_text()
+ js_code = resources.read_text('browser_use.dom', 'buildDomTree.js')
eval_page = await self.page.evaluate(
js_code, [highlight_elements]
diff --git a/pyproject.toml b/pyproject.toml
index 7803b901f..786689820 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -46,15 +46,4 @@ docstring-code-format = true
[build-system]
requires = ["hatchling"]
-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",
-]
+build-backend = "hatchling.build"
\ No newline at end of file