-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[java] feat: Add method to select options containing the provided text #14426
[java] feat: Add method to select options containing the provided text #14426
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. This looks good to me. Presumably we should add a matching deselect
method, but that can be done in a follow-up PR.
Thank you for the review. I will request you again after adding the function to deselect with the same concept. |
Signed-off-by: Viet Nguyen Duc <[email protected]>
Merged based on approval and CI passed. Thank you, @syber911911 ! |
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Add method to select options containing the provided text.
Motivation and Context
The existing selectByVisibleText method only allowed selecting options that exactly match the provided text. However, when using Selenium for crawling, situations arose where selecting options that contain the provided text became necessary.
As a Korean developer, I often encounter cases where suffixes or particles are appended to words, making exact matches insufficient.
For example, if the option text is "1년납" and the provided text is "1년", there was no way to match these semantically similar terms. Therefore, I added a new method to handle such cases by selecting options that contain the provided text.
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
selectByContainsVisibleText
in theISelect
interface and its implementation.Changes walkthrough 📝
ISelect.java
Add method to select options containing text
java/src/org/openqa/selenium/support/ui/ISelect.java
selectByContainsVisibleText
.Select.java
Implement method to select options by partial text
java/src/org/openqa/selenium/support/ui/Select.java
selectByContainsVisibleText
method.SelectElementTest.java
Add tests for selecting options by partial text
java/test/org/openqa/selenium/support/ui/SelectElementTest.java
selectByContainsVisibleText
method.SelectTest.java
Add mock tests for selectByContainsVisibleText method
java/test/org/openqa/selenium/support/ui/SelectTest.java
selectByContainsVisibleText
.