Skip to content

Commit 7f325b4

Browse files
committed
patch and changeset
1 parent fc0cb89 commit 7f325b4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stagehand": patch
3+
---
4+
5+
Add support for handling OS-level dropdowns

stagehand/a11y/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def _clean_structural_nodes(
5757
page
5858
and logger
5959
and backend_node_id is not None
60-
and node_role in ("generic", "none")
60+
and node_role in ("generic", "combobox", "none")
6161
):
6262
try:
6363
resolved_node = await page.send_cdp(
@@ -78,6 +78,8 @@ async def _clean_structural_nodes(
7878
)
7979
result_value = tag_name_result.get("result", {}).get("value")
8080
if result_value:
81+
if node_role == "combobox" and result_value == "select":
82+
result_value = "select"
8183
node["role"] = result_value
8284
node_role = result_value
8385
except Exception as tag_name_error:
@@ -98,7 +100,7 @@ async def _clean_structural_nodes(
98100
# Rename `combobox` to `select` as they are functionally equivalent.
99101
if node_role == "combobox":
100102
node_role = "select"
101-
node['role'] = node_role
103+
node["role"] = node_role
102104

103105
# Remove redundant StaticText children
104106
cleaned_children = _remove_redundant_static_text_children(node, cleaned_children)

0 commit comments

Comments
 (0)