refactor select handler (#565)

This commit is contained in:
LawyZheng
2024-07-09 02:22:16 +08:00
committed by GitHub
parent 7a75bb3741
commit bcbd738326
4 changed files with 309 additions and 113 deletions

View File

@@ -313,6 +313,11 @@ class ElementIsNotSelect2Dropdown(SkyvernException):
super().__init__(f"element[{element}] is not select2 dropdown. element_id={element_id}")
class ElementIsNotComboboxDropdown(SkyvernException):
def __init__(self, element_id: str, element: dict):
super().__init__(f"element[{element}] is not combobox dropdown. element_id={element_id}")
class NoneFrameError(SkyvernException):
def __init__(self, frame_id: str):
super().__init__(f"frame content is none. frame_id={frame_id}")
@@ -382,3 +387,32 @@ class TaskAlreadyCanceled(SkyvernHTTPException):
class InvalidTaskStatusTransition(SkyvernHTTPException):
def __init__(self, old_status: str, new_status: str, task_id: str):
super().__init__(f"Invalid task status transition from {old_status} to {new_status} for {task_id}")
class ErrFoundSelectableElement(SkyvernException):
def __init__(self, element_id: str, err: Exception):
super().__init__(
f"error when selecting elements in the children list. element_id={element_id}, error={repr(err)}"
)
class NoSelectableElementFound(SkyvernException):
def __init__(self, element_id: str):
super().__init__(f"No selectable elements found in the children list. element_id={element_id}")
class NoDropdownAnchorErr(SkyvernException):
def __init__(self, dropdowm_type: str, element_id: str):
super().__init__(f"No {dropdowm_type} dropdown found. element_id={element_id}")
class MultipleDropdownAnchorErr(SkyvernException):
def __init__(self, dropdowm_type: str, element_id: str):
super().__init__(f"Multiple {dropdowm_type} dropdown found. element_id={element_id}")
class FailedToGetCurrentValueOfDropdown(SkyvernException):
def __init__(self, dropdowm_type: str, element_id: str, fail_reason: str):
super().__init__(
f"Failed to get current value of {dropdowm_type} dropdown. element_id={element_id}, failure_reason={fail_reason}"
)