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
fix: Add ARIA menu roles to interactiveRoles for proper selector map inclusion
claude[bot]bcff6eec96ac
diff --git a/browser_use/dom/dom_tree/index.js b/browser_use/dom/dom_tree/index.jsindex b9d06cb92..3dcf074c1 100644--- a/browser_use/dom/dom_tree/index.js+++ b/browser_use/dom/dom_tree/index.js@@ -710,7 +710,9 @@const interactiveRoles = new Set(['button', // Directly clickable element// 'link', // Clickable link- // 'menuitem', // Clickable menu item+ 'menu', // Menu container (ARIA menus)+ 'menubar', // Menu bar container+ 'menuitem', // Clickable menu item'menuitemradio', // Radio-style menu item (selectable)'menuitemcheckbox', // Checkbox-style menu item (toggleable)'radio', // Radio button (selectable)@@ -722,7 +724,7 @@'combobox', // Dropdown with text input'searchbox', // Search input field'textbox', // Text input field- // 'listbox', // Selectable list+ 'listbox', // Selectable list'option', // Selectable option in a list'scrollbar' // Scrollable control]);diff --git a/tests/ci/test_aria_menu_dropdown.py b/tests/ci/test_aria_menu_dropdown.pyindex dc069e4ee..90cdd50c2 100644--- a/tests/ci/test_aria_menu_dropdown.py+++ b/tests/ci/test_aria_menu_dropdown.py@@ -131,6 +131,7 @@ async def browser_session():headless=True,user_data_dir=None,keep_alive=True,+ chromium_sandbox=False, # Disable sandbox for CI environment))await browser_session.start()@@ -170,13 +171,17 @@ class TestARIAMenuDropdown:# Find the ARIA menu element in the selector mapmenu_index = Nonefor idx, element in selector_map.items():- # Look for the UL with role="menu"- if element.tag_name.lower() == 'ul' and 'menu' in str(element.attributes.get('role', '')):+ # Look for the main UL with role="menu" and id="pyNavigation1752753375773"+ if (+ element.tag_name.lower() == 'ul'+ and element.attributes.get('role') == 'menu'+ and element.attributes.get('id') == 'pyNavigation1752753375773'+ ):menu_index = idxbreakassert menu_index is not None, (- f'Could not find ARIA menu element in selector map. Available elements: {[f"{idx}: {element.tag_name}" for idx, element in selector_map.items()]}'+ f'Could not find ARIA menu element in selector map. Available elements: {[f"{idx}: {element.tag_name} id={element.attributes.get('id', 'None')} role={element.attributes.get('role', 'None')}" for idx, element in selector_map.items()]}')# Create a model for the get_dropdown_options action@@ -226,13 +231,17 @@ class TestARIAMenuDropdown:# Find the ARIA menu element in the selector mapmenu_index = Nonefor idx, element in selector_map.items():- # Look for the UL with role="menu"- if element.tag_name.lower() == 'ul' and 'menu' in str(element.attributes.get('role', '')):+ # Look for the main UL with role="menu" and id="pyNavigation1752753375773"+ if (+ element.tag_name.lower() == 'ul'+ and element.attributes.get('role') == 'menu'+ and element.attributes.get('id') == 'pyNavigation1752753375773'+ ):menu_index = idxbreakassert menu_index is not None, (- f'Could not find ARIA menu element in selector map. Available elements: {[f"{idx}: {element.tag_name}" for idx, element in selector_map.items()]}'+ f'Could not find ARIA menu element in selector map. Available elements: {[f"{idx}: {element.tag_name} id={element.attributes.get('id', 'None')} role={element.attributes.get('role', 'None')}" for idx, element in selector_map.items()]}')# Create a model for the select_dropdown_option action