Bug description
selectByVisibleText() in WebDriverSelect selects options that are not visible to the user, I'm not sure if this is expected behaviour or not though it might make things like end to end tests a little bit more unreliable.
Looking at java tests for the selenium project it seems like it should throw NoSuchElementException on elements hidden by css rules:
● Here's the html:
https://github.com/SeleniumHQ/selenium/blob/bad5038a4096eb8229d8d6da27a0c87f9c1cd2f6/common/src/web/formPage.html#L84
● test method:
https://github.com/SeleniumHQ/selenium/blob/bad5038a4096eb8229d8d6da27a0c87f9c1cd2f6/java/test/org/openqa/selenium/support/ui/SelectElementTest.java#L176
● and java's selectByVisibleText implementation:
https://github.com/SeleniumHQ/selenium/blob/bad5038a4096eb8229d8d6da27a0c87f9c1cd2f6/java/src/org/openqa/selenium/support/ui/Select.java#L200
How could the issue be reproduced
I added inline style="display: none;" css on form.html on my fork:
https://github.com/php-webdriver/php-webdriver/compare/main...FFederi:php-webdriver:main
and the tests still pass.
Expected behavior
Maybe selectByVisibleText should throw NoSuchElementException if the option is not actually visible
Php-webdriver version
1.15.2
PHP version
8.1.2-1ubuntu2.20
How do you start the browser driver or Selenium server
selenium in docker
Selenium server / Selenium Docker image version
selenium/standalone-chrome:4.27.0-20250101
Browser driver (chromedriver/geckodriver...) version
No response
Browser name and version
No response
Operating system
No response
Additional context
No response
Bug description
selectByVisibleText() in WebDriverSelect selects options that are not visible to the user, I'm not sure if this is expected behaviour or not though it might make things like end to end tests a little bit more unreliable.
Looking at java tests for the selenium project it seems like it should throw NoSuchElementException on elements hidden by css rules:
● Here's the html:
https://github.com/SeleniumHQ/selenium/blob/bad5038a4096eb8229d8d6da27a0c87f9c1cd2f6/common/src/web/formPage.html#L84
● test method:
https://github.com/SeleniumHQ/selenium/blob/bad5038a4096eb8229d8d6da27a0c87f9c1cd2f6/java/test/org/openqa/selenium/support/ui/SelectElementTest.java#L176
● and java's selectByVisibleText implementation:
https://github.com/SeleniumHQ/selenium/blob/bad5038a4096eb8229d8d6da27a0c87f9c1cd2f6/java/src/org/openqa/selenium/support/ui/Select.java#L200
How could the issue be reproduced
I added inline style="display: none;" css on form.html on my fork: https://github.com/php-webdriver/php-webdriver/compare/main...FFederi:php-webdriver:main and the tests still pass.Expected behavior
Maybe selectByVisibleText should throw NoSuchElementException if the option is not actually visible
Php-webdriver version
1.15.2
PHP version
8.1.2-1ubuntu2.20
How do you start the browser driver or Selenium server
selenium in docker
Selenium server / Selenium Docker image version
selenium/standalone-chrome:4.27.0-20250101
Browser driver (chromedriver/geckodriver...) version
No response
Browser name and version
No response
Operating system
No response
Additional context
No response