Skip to content
Advertisement

Selecting Element from dropdown with style=”display: none” doesn’t work in Selenium

JavaScript
JavaScript

In the dropdown I’d like to select ‘Text3’, but it doesn’t work. What I tried:

JavaScript

and as well:

JavaScript

I’m stuck and don’t know how to solve this. Need some help, thanks!

Advertisement

Answer

With Selenium, AFAIK, you cannot select elements with display:none, if you want to force it, you’ll need to change the display property to something visible.

JavaScript

An example about how to execute JS scritps from Selenium: https://pythonbasics.org/selenium-execute-javascript/

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement