Improve listbox option selection handling by using get() method and adding a check for None (#2788)

This commit is contained in:
Prakash Maheshwaran
2025-06-26 21:31:09 -04:00
committed by GitHub
parent 9740de8054
commit 11ca5b7250

View File

@@ -3421,7 +3421,9 @@ async def click_listbox_option(
action: actions.SelectOptionAction,
listbox_element_id: str,
) -> bool:
listbox_element = scraped_page.id_to_element_dict[listbox_element_id]
listbox_element = scraped_page.id_to_element_dict.get(listbox_element_id)
if listbox_element is None:
return False
# this is a listbox element, get all the children
if "children" not in listbox_element:
return False