Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve reliability of radio button clicks #448

Merged
merged 5 commits into from
Feb 1, 2025
Merged

Conversation

seanmcguire12
Copy link
Collaborator

why

  • clicking a radio button with playwright can be finnicky
  • often, it is best to just click the label which corresponds to the radio button instead of trying to click the radio button itself

what changed

  • this PR introduces a step in _performPlaywrightMethod where we directly check if the target element is a radio button.
  • if true, it will run through a series of checks to try and find the corresponding label for the radio button
  • if a label is found, then the label is clicked instead of the radio button itself

Copy link

changeset-bot bot commented Jan 31, 2025

🦋 Changeset detected

Latest commit: efaf2a0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@browserbasehq/stagehand Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@seanmcguire12 seanmcguire12 added act These changes pertain to the act function observe These changes pertain to the observe function labels Jan 31, 2025
@seanmcguire12 seanmcguire12 requested a review from kamath January 31, 2025 04:44
@kamath
Copy link
Contributor

kamath commented Jan 31, 2025

@seanmcguire12 should we add more evals here? i.e. specifically for radio buttons/checkboxes?

@seanmcguire12
Copy link
Collaborator Author

@seanmcguire12 should we add more evals here? i.e. specifically for radio buttons/checkboxes?

@kamath yeah ideally it is tested somehow, but i wasn't sure it warranted the addition of some evals considering we run 5 trials per model per eval. I spun up some hosted sites that outline the edge cases that this PR fixes, so I could easily throw them into evals, but personally I think unit tests would be best for something like this. Lmk your thoughts

@kamath kamath merged commit b216072 into main Feb 1, 2025
14 of 20 checks passed
@kamath kamath deleted the actHandler/handle_edge_case branch February 1, 2025 21:26
@github-actions github-actions bot mentioned this pull request Feb 1, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
act These changes pertain to the act function observe These changes pertain to the observe function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants