Improve listbox option selection handling by using get() method and adding a check for None (#2788)
This commit is contained in:
committed by
GitHub
parent
9740de8054
commit
11ca5b7250
@@ -3421,7 +3421,9 @@ async def click_listbox_option(
|
|||||||
action: actions.SelectOptionAction,
|
action: actions.SelectOptionAction,
|
||||||
listbox_element_id: str,
|
listbox_element_id: str,
|
||||||
) -> bool:
|
) -> 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
|
# this is a listbox element, get all the children
|
||||||
if "children" not in listbox_element:
|
if "children" not in listbox_element:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user