Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using selenium for a project. I want my program to interact with a dropdown menu. At times my desired selection will not be present in the dropdown menu. In that case I would like to select a different dropdown element. How do I work around the scenario in which the desired selection is not present.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
316 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try to use Select class in Selenium. You can add WebElements from dropdown into List and select whatever element is desired(by Name, by index ...)

Here is the documentation: Select Selenium


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...