Skip to content

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

Add cursor:pointer handling in buildDomTree and update test URLs

satya-nutellaea4afadd1d8d
diff --git a/browser_use/dom/buildDomTree.js b/browser_use/dom/buildDomTree.js
index 2919ce6ab..c247e2804 100644
--- a/browser_use/dom/buildDomTree.js
+++ b/browser_use/dom/buildDomTree.js
@@ -933,6 +933,11 @@
return false;
}
+ // treat any element with cursor:pointer as distinct (e.g. expansion icons)
+ const style = getCachedComputedStyle(element);
+ if (style && style.cursor === 'pointer') {
+ return true;
+ }
const tagName = element.tagName.toLowerCase();
const role = element.getAttribute('role');
diff --git a/browser_use/dom/tests/extraction_test.py b/browser_use/dom/tests/extraction_test.py
index 5d3010429..78af0507f 100644
--- a/browser_use/dom/tests/extraction_test.py
+++ b/browser_use/dom/tests/extraction_test.py
@@ -62,6 +62,8 @@ async def test_focus_vs_all_elements():
context = BrowserContext(browser=browser, config=config)
websites = [
+ 'https://demos.telerik.com/kendo-react-ui/treeview/overview/basic/func?theme=default-ocean-blue-a11y',
+ 'https://www.ycombinator.com/companies',
'https://kayak.com/flights',
# 'https://en.wikipedia.org/wiki/Humanist_Party_of_Ontario',
# 'https://www.google.com/travel/flights?tfs=CBwQARoJagcIARIDTEpVGglyBwgBEgNMSlVAAUgBcAGCAQsI____________AZgBAQ&tfu=KgIIAw&hl=en-US&gl=US',