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
magmueller8512f2e42deb
diff --git a/.gitignore b/.gitignoreindex a293a00e5..480107853 100644--- a/.gitignore+++ b/.gitignore@@ -129,6 +129,7 @@ venv/ENV/env.bak/venv.bak/+test_env/# Spyder project settings.spyderprojectdiff --git a/browser_use/dom/service.py b/browser_use/dom/service.pyindex 6058bd13d..ddeec5ea9 100644--- a/browser_use/dom/service.py+++ b/browser_use/dom/service.py@@ -1,4 +1,5 @@import logging+from importlib import resourcesfrom typing import Optionalfrom playwright.async_api import Page@@ -27,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:- with open('browser_use/dom/buildDomTree.js', 'r') as f:+ with resources.files('browser_use.dom').joinpath('buildDomTree.js').open('r') as f:js_code = f.read()eval_page = await self.page.evaluate(diff --git a/pyproject.toml b/pyproject.tomlindex 8fae2d33b..cb259665c 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.12"+version = "0.1.13"readme = "README.md"requires-python = ">=3.11"classifiers = [@@ -47,3 +47,11 @@ docstring-code-format = true[build-system]requires = ["hatchling"]build-backend = "hatchling.build"++[tool.hatch.build.targets.wheel]+packages = ["browser_use"]++[tool.hatch.build]+include = [+ "browser_use/**/*.js",+]