improve date picker selection (#2018)
This commit is contained in:
@@ -647,31 +647,31 @@ async def handle_input_text_action(
|
|||||||
target_value=text,
|
target_value=text,
|
||||||
)
|
)
|
||||||
|
|
||||||
if select_result is None or select_result.dropdown_menu is None:
|
if select_result is not None:
|
||||||
try_to_quit_dropdown = False
|
if select_result.action_result and select_result.action_result.success:
|
||||||
|
try_to_quit_dropdown = False
|
||||||
|
return [select_result.action_result]
|
||||||
|
|
||||||
elif select_result.action_result is None:
|
if select_result.dropdown_menu is None:
|
||||||
LOG.info(
|
try_to_quit_dropdown = False
|
||||||
"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,
|
|
||||||
)
|
|
||||||
|
|
||||||
elif select_result.action_result.success:
|
if select_result.action_result is None:
|
||||||
try_to_quit_dropdown = False
|
LOG.info(
|
||||||
return [select_result.action_result]
|
"It might not be a selectable auto-completion input, exit the custom selection mode",
|
||||||
|
task_id=task.task_id,
|
||||||
else:
|
step_id=step.step_id,
|
||||||
LOG.warning(
|
element_id=skyvern_element.get_id(),
|
||||||
"Custom selection returned an error, continue to input text",
|
action=action,
|
||||||
task_id=task.task_id,
|
)
|
||||||
step_id=step.step_id,
|
else:
|
||||||
element_id=skyvern_element.get_id(),
|
LOG.warning(
|
||||||
action=action,
|
"Custom selection returned an error, continue to input text",
|
||||||
err_msg=select_result.action_result.exception_message,
|
task_id=task.task_id,
|
||||||
)
|
step_id=step.step_id,
|
||||||
|
element_id=skyvern_element.get_id(),
|
||||||
|
action=action,
|
||||||
|
err_msg=select_result.action_result.exception_message,
|
||||||
|
)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
@@ -1939,6 +1939,31 @@ async def sequentially_select_from_dropdown(
|
|||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# if it's a <input> date picker, try to input the current date directly first
|
||||||
|
if (
|
||||||
|
input_or_select_context.is_date_related
|
||||||
|
and skyvern_element.get_tag_name() == InteractiveElement.INPUT
|
||||||
|
and action.option.label
|
||||||
|
):
|
||||||
|
LOG.info(
|
||||||
|
"It's a <input> date picker, going to input the current date directly",
|
||||||
|
step_id=step.step_id,
|
||||||
|
task_id=task.task_id,
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
await skyvern_element.input_sequentially(action.option.label)
|
||||||
|
result = CustomSingleSelectResult(skyvern_frame=skyvern_frame)
|
||||||
|
result.action_result = ActionSuccess()
|
||||||
|
return result
|
||||||
|
except Exception:
|
||||||
|
LOG.warning(
|
||||||
|
"Failed to input the current date directly, trigger the selection mode",
|
||||||
|
exc_info=True,
|
||||||
|
step_id=step.step_id,
|
||||||
|
task_id=task.task_id,
|
||||||
|
)
|
||||||
|
await skyvern_element.input_clear()
|
||||||
|
|
||||||
# TODO: only suport the third-level dropdown selection now
|
# TODO: only suport the third-level dropdown selection now
|
||||||
MAX_SELECT_DEPTH = 3
|
MAX_SELECT_DEPTH = 3
|
||||||
values: list[str | None] = []
|
values: list[str | None] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user