Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

Java Selenium Drop down menu Options

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.


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

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...