-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
fixed 15265-Unifying Select Class Across All Bindings #16152
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
Conversation
|
|
|
Thank you, @Roushan7970835758 for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
|
There is another PR with similar changes but tests are failing due to the changes. The PR also needs to fix tests that will eventually fail due to this changes. |
User description
🔗 Related Issues
Fixes #15265
This aligns
Select.selectByVisibleText()behavior in Java with the expectation that it only interacts with visible options, consistent with other Selenium bindings.💥 What does this PR do?
Updates the Java
SelectclassselectByVisibleText()method to respect element visibility before selection.Previously, the method could select
<option>elements even if they were hidden (display:none,visibility:hidden, oropacity:0).Now, it ensures only visible options are considered, throwing a
NoSuchElementExceptionfor invisible matches.Key changes:
assertSelectIsVisible()at the start of the method.hasCssPropertyAndVisible()before selecting an option.🔧 Implementation Notes
hasCssPropertyAndVisible()method verifies:displayis notnonevisibilityis nothiddenopacityis not0or0.0💡 Additional Considerations
NoSuchElementException.Selectmethods (e.g.,selectByIndex,selectByValue) for complete consistency.🔄 Types of changes
PR Type
Enhancement
Description
Enhanced Java Select class to respect element visibility
Added visibility checks for selectByVisibleText method
Throws NoSuchElementException for invisible options
Aligns Java behavior with other Selenium bindings
Diagram Walkthrough
File Walkthrough
Select.java
Enhanced selectByVisibleText with visibility checksjava/src/org/openqa/selenium/support/ui/Select.java
assertSelectIsVisible()call at method starthasCssPropertyAndVisible()searchTextvariable