Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom select optimize #985

Merged
merged 1 commit into from
Oct 16, 2024
Merged

custom select optimize #985

merged 1 commit into from
Oct 16, 2024

Conversation

LawyZheng
Copy link
Collaborator

@LawyZheng LawyZheng commented Oct 16, 2024

Important

Improves dropdown interaction robustness by handling timeouts and custom options in handler.py and dom.py.

  • Behavior:
    • In handle_input_text_action() in handler.py, added a try-except block to handle TimeoutError when pressing "ArrowDown" to open dropdowns, logging a message and continuing execution.
    • In handle_select_option_action() in handler.py, added logic to handle cases where custom select logic fails, checking if the element is a custom option and performing a click action if so.
  • Functions:
    • Added is_custom_option() to SkyvernElement in dom.py to check if an element is a custom option by tag name or role attribute.
  • Misc:
    • Minor logging improvements in handler.py to provide more context during dropdown interactions.

This description was created by Ellipsis for 52fab51. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 52fab51 in 19 seconds

More details
  • Looked at 53 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. skyvern/webeye/utils/dom.py:151
  • Draft comment:
    Simplify the return statement in is_custom_option method for better readability.
return self.get_tag_name() == "li" or (await self.get_attr("role")) == "option"
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The method is_custom_option in SkyvernElement class is checking for a tag name of 'li' or a role attribute of 'option'. This logic seems correct for identifying custom options in a dropdown. However, the method could be more efficient by using a single return statement.
2. skyvern/webeye/actions/handler.py:455
  • Draft comment:
    Include exception details in the log message for better debugging.
LOG.info(
    "Timeout to press ArrowDown to open dropdown, 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,
    exc_info=True
)
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The handle_input_text_action function in handler.py has a try-except block for press_key method. The exception handling is appropriate, but the log message could be more informative by including the exception details.

Workflow ID: wflow_7TXGHn4z02V92hxa


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@LawyZheng LawyZheng merged commit ba6ef89 into main Oct 16, 2024
2 checks passed
@LawyZheng LawyZheng deleted the lawy/custom-select-optimize branch October 16, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant