skip unnecessary select-dropdown check for input (#862)
This commit is contained in:
@@ -416,7 +416,7 @@ async def handle_input_text_action(
|
|||||||
|
|
||||||
incremental_element: list[dict] = []
|
incremental_element: list[dict] = []
|
||||||
# check if it's selectable
|
# check if it's selectable
|
||||||
if skyvern_element.get_tag_name() == InteractiveElement.INPUT and not await skyvern_element.is_spinbtn_input():
|
if skyvern_element.get_tag_name() == InteractiveElement.INPUT and not await skyvern_element.is_raw_input():
|
||||||
await skyvern_element.scroll_into_view()
|
await skyvern_element.scroll_into_view()
|
||||||
select_action = SelectOptionAction(
|
select_action = SelectOptionAction(
|
||||||
reasoning=action.reasoning,
|
reasoning=action.reasoning,
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ class InteractiveElement(StrEnum):
|
|||||||
|
|
||||||
|
|
||||||
SELECTABLE_ELEMENT = [InteractiveElement.INPUT, InteractiveElement.SELECT]
|
SELECTABLE_ELEMENT = [InteractiveElement.INPUT, InteractiveElement.SELECT]
|
||||||
|
RAW_INPUT_TYPE_VALUE = ["number", "url", "tel", "email", "username", "password"]
|
||||||
|
RAW_INPUT_NAME_VALUE = ["name", "email", "username", "password", "phone"]
|
||||||
|
|
||||||
|
|
||||||
class SkyvernOptionType(typing.TypedDict):
|
class SkyvernOptionType(typing.TypedDict):
|
||||||
@@ -197,6 +199,23 @@ class SkyvernElement:
|
|||||||
button_type = await self.get_attr("type")
|
button_type = await self.get_attr("type")
|
||||||
return button_type == "radio"
|
return button_type == "radio"
|
||||||
|
|
||||||
|
async def is_raw_input(self) -> bool:
|
||||||
|
if self.get_tag_name() != InteractiveElement.INPUT:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if await self.is_spinbtn_input():
|
||||||
|
return True
|
||||||
|
|
||||||
|
input_type = str(await self.get_attr("type"))
|
||||||
|
if input_type.lower() in RAW_INPUT_TYPE_VALUE:
|
||||||
|
return True
|
||||||
|
|
||||||
|
name = str(await self.get_attr("name"))
|
||||||
|
if name.lower() in RAW_INPUT_NAME_VALUE:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
async def is_spinbtn_input(self) -> bool:
|
async def is_spinbtn_input(self) -> bool:
|
||||||
"""
|
"""
|
||||||
confirm the element is:
|
confirm the element is:
|
||||||
|
|||||||
Reference in New Issue
Block a user