Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fallback to input when input selection failed (#1393)
LawyZhenge2f886d9a3b7
diff --git a/skyvern/exceptions.py b/skyvern/exceptions.pyindex 522209b75..551bc4cc1 100644--- a/skyvern/exceptions.py+++ b/skyvern/exceptions.py@@ -545,3 +545,10 @@ class FailedToParseActionInstruction(SkyvernException):class UnsupportedTaskType(SkyvernException):def __init__(self, task_type: str):super().__init__(f"Not supported task type [{task_type}]")+++class InteractWithDropdownContainer(SkyvernException):+ def __init__(self, element_id: str):+ super().__init__(+ f"Select on the dropdown container instead of the option, try again with another element. element_id={element_id}"+ )diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.pyindex d45e85be9..d78ccf90b 100644--- a/skyvern/webeye/actions/handler.py+++ b/skyvern/webeye/actions/handler.py@@ -31,6 +31,7 @@ from skyvern.exceptions import (IllegitComplete,ImaginaryFileUrl,InteractWithDisabledElement,+ InteractWithDropdownContainer,InvalidElementForTextInput,MissingElement,MissingElementDict,@@ -571,15 +572,27 @@ async def handle_input_text_action(task=task,target_value=text,)- if result is not None:+ if result is not None and result.success:return [result]- LOG.info(- "It might not be a selectable auto-completion input, exit the custom selection mode",- task_id=task.task_id,- step_id=step.step_id,- element_id=skyvern_element.get_id(),- action=action,- )++ if result is None:+ LOG.info(+ "It might not be a selectable auto-completion input, exit the custom selection mode",+ task_id=task.task_id,+ step_id=step.step_id,+ element_id=skyvern_element.get_id(),+ action=action,+ )+ else:+ LOG.warning(+ "Custom selection returned an error, continue to input text",+ task_id=task.task_id,+ step_id=step.step_id,+ element_id=skyvern_element.get_id(),+ action=action,+ err_msg=result.exception_message,+ )+except Exception:await skyvern_element.scroll_into_view()LOG.warning(@@ -1951,6 +1964,12 @@ async def select_from_dropdown(try:selected_element = await SkyvernElement.create_from_incremental(incremental_scraped, element_id)+ if await selected_element.get_attr("role") == "listbox":+ single_select_result.action_result = ActionFailure(+ exception=InteractWithDropdownContainer(element_id=element_id)+ )+ return single_select_result+await selected_element.scroll_into_view()await selected_element.get_locator().click(timeout=timeout)single_select_result.action_result = ActionSuccess()