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

Skip if selected #604

Merged
merged 2 commits into from
Jul 15, 2024
Merged

Skip if selected #604

merged 2 commits into from
Jul 15, 2024

Conversation

LawyZheng
Copy link
Collaborator

@LawyZheng LawyZheng commented Jul 15, 2024

🚀 This description was created by Ellipsis for commit ecd7cef

Summary:

Refactored handle_select_option_action to check for already selected options in normal_select and updated getSelectOptions to return the selected option's text.

Key points:

  • Updated handle_select_option_action in skyvern/webeye/actions/handler.py to remove the check for already selected options.
  • Moved the check for already selected options to normal_select in skyvern/webeye/actions/handler.py.
  • Modified getSelectOptions in skyvern/webeye/scraper/domUtils.js to return the selected option's text along with the options list.
  • Added handling for selected attribute in buildTreeFromBody in skyvern/webeye/scraper/domUtils.js.

Generated with ❤️ by ellipsis.dev

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.

❌ Changes requested. Reviewed everything up to ecd7cef in 48 seconds

More details
  • Looked at 94 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_NpYpT8zh3f1Z7pU1


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -828,9 +820,16 @@ async def normal_select(
action: actions.SelectOptionAction,
skyvern_element: SkyvernElement,
) -> List[ActionResult]:
try:
current_text = await skyvern_element.get_attr("selected")
Copy link
Contributor

Choose a reason for hiding this comment

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

The change from using locator.input_value() to skyvern_element.get_attr("selected") might not always reflect the current state of the UI, especially in dynamic web applications. Consider verifying this approach's reliability in handling dynamically updated select elements.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A good point here. Such as if the previous action caused the select value reset, the logic might be wrong. But maybe we can re-do the select in the next step. So it's not a blocker here.

action_result: List[ActionResult] = []
is_success = False
locator = skyvern_element.locator
locator = skyvern_element.get_locator()
Copy link
Contributor

Choose a reason for hiding this comment

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

whoa seems like a big bug

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

? What do you mean? I don't follow

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the confusion! Did the old.locator implementation work? If not that's a huge bug! Nice find.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh both of them could work. I just refactor it into the same format.

@@ -828,9 +820,16 @@ async def normal_select(
action: actions.SelectOptionAction,
skyvern_element: SkyvernElement,
) -> List[ActionResult]:
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a good change. How can the LLM "unselect" an option? Here doing select option on an already selected option would unselect it before, but now that can never be the case right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean unselect before select? I don't understand.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If llm want to unselect sth. He can return the value represented the "unselect" right? What the problem here?

return [selectOptions, ""];
}

return [selectOptions, removeMultipleSpaces(selectedOption.textContent)];
Copy link
Contributor

Choose a reason for hiding this comment

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

is the selected value always textContent? could it be the "value" attribute of the element?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because when we parse the option. We only use the textContext to represent the value. I think we should be consistent with the logic we do in the option parsing.

if current_text == action.option.label or current_text == action.option.value:
return [ActionSuccess()]
except Exception:
LOG.info("failed to confirm if the select option has been done, force to take the action again.")
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we say "force to take the action again"? we're not retrying here, are we?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

em. if the skip logic failed. we try to select again!

@LawyZheng LawyZheng merged commit 9b51df4 into main Jul 15, 2024
2 checks passed
@LawyZheng LawyZheng deleted the skip-if-selected branch July 15, 2024 17:41
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.

3 participants