Skip to content
Advertisement

Selenium how to select first option if page has multiple select box using python

I have 3 select box’s in my page

example :

JavaScript

If there has 5 or 6 select box I will always select 1st option, I am unable to do it using selenium. I have tried below code

JavaScript

But no any impact, How can I solve this problem ?

Advertisement

Answer

You are very near of the solution !

JavaScript

See the documentation carefully how they select First input child element of the form element with attribute id set to loginForm.

note : It’s elements not element !

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