remove hard wait time in input action (#3229)
This commit is contained in:
@@ -974,7 +974,17 @@ async def handle_input_text_action(
|
|||||||
action=action,
|
action=action,
|
||||||
)
|
)
|
||||||
|
|
||||||
await asyncio.sleep(5)
|
try:
|
||||||
|
await skyvern_frame.get_frame().wait_for_load_state("load", timeout=3000)
|
||||||
|
await skyvern_frame.safe_wait_for_animation_end()
|
||||||
|
except Exception:
|
||||||
|
LOG.info(
|
||||||
|
"Timeout to wait for the frame to load, ignore the timeout and continue to execute the action",
|
||||||
|
task_id=task.task_id,
|
||||||
|
step_id=step.step_id,
|
||||||
|
element_id=skyvern_element.get_id(),
|
||||||
|
action=action,
|
||||||
|
)
|
||||||
|
|
||||||
incremental_element = await incremental_scraped.get_incremental_element_tree(
|
incremental_element = await incremental_scraped.get_incremental_element_tree(
|
||||||
clean_and_remove_element_tree_factory(
|
clean_and_remove_element_tree_factory(
|
||||||
@@ -1115,8 +1125,19 @@ async def handle_input_text_action(
|
|||||||
LOG.warning("Failed to clear the input field", action=action, exc_info=True)
|
LOG.warning("Failed to clear the input field", action=action, exc_info=True)
|
||||||
return [ActionFailure(InvalidElementForTextInput(element_id=action.element_id, tag_name=tag_name))]
|
return [ActionFailure(InvalidElementForTextInput(element_id=action.element_id, tag_name=tag_name))]
|
||||||
|
|
||||||
# wait 2s for blocking element to show up
|
# wait for blocking element to show up
|
||||||
await asyncio.sleep(2)
|
try:
|
||||||
|
await skyvern_frame.get_frame().wait_for_load_state("load", timeout=3000)
|
||||||
|
await skyvern_frame.safe_wait_for_animation_end()
|
||||||
|
except Exception:
|
||||||
|
LOG.info(
|
||||||
|
"Timeout to wait for the frame to load, ignore the timeout and continue to execute the action",
|
||||||
|
task_id=task.task_id,
|
||||||
|
step_id=step.step_id,
|
||||||
|
element_id=skyvern_element.get_id(),
|
||||||
|
action=action,
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
blocking_element, exist = await skyvern_element.find_blocking_element(
|
blocking_element, exist = await skyvern_element.find_blocking_element(
|
||||||
dom=dom, incremental_page=incremental_scraped
|
dom=dom, incremental_page=incremental_scraped
|
||||||
@@ -2154,7 +2175,15 @@ async def choose_auto_completion_dropdown(
|
|||||||
try:
|
try:
|
||||||
await skyvern_element.press_fill(text)
|
await skyvern_element.press_fill(text)
|
||||||
# wait for new elemnts to load
|
# wait for new elemnts to load
|
||||||
await asyncio.sleep(5)
|
try:
|
||||||
|
await asyncio.sleep(0.5)
|
||||||
|
await skyvern_frame.get_frame().wait_for_load_state("load", timeout=3000)
|
||||||
|
await skyvern_frame.safe_wait_for_animation_end()
|
||||||
|
except Exception:
|
||||||
|
LOG.warning(
|
||||||
|
"Failed to wait for load state or animation end after input the value, will continue to get incremental element tree",
|
||||||
|
exc_info=True,
|
||||||
|
)
|
||||||
incremental_element = await incremental_scraped.get_incremental_element_tree(
|
incremental_element = await incremental_scraped.get_incremental_element_tree(
|
||||||
clean_and_remove_element_tree_factory(
|
clean_and_remove_element_tree_factory(
|
||||||
task=task, step=step, check_filter_funcs=[check_existed_but_not_option_element_in_dom_factory(dom)]
|
task=task, step=step, check_filter_funcs=[check_existed_but_not_option_element_in_dom_factory(dom)]
|
||||||
|
|||||||
@@ -2650,18 +2650,7 @@ function isAnimationFinished() {
|
|||||||
if (!unfinishedAnimations || unfinishedAnimations.length == 0) {
|
if (!unfinishedAnimations || unfinishedAnimations.length == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const unfinishedAnimationsWithoutBlocked = unfinishedAnimations.filter(
|
return false;
|
||||||
(a) => {
|
|
||||||
const element = a.effect?.target;
|
|
||||||
if (!element) {
|
|
||||||
_jsConsoleLog("Unfinished animation without element:", a);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const result = getBlockElementUniqueID(element);
|
|
||||||
return !result[1];
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return unfinishedAnimationsWithoutBlocked.length === 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user