Skip to main content

How to retrieve all the values of a drop down using Selenium Web Driver

Now we want to retrieve all the value of any select box then we can use the getOptions method. It will return the complete list of all the values in a drop down field. It takes no parameter and return list of all the values in the select box.
Now if you want to get the all values of month drop down then you can use the getOptions method like below

Automation Testing, Selenium Web Driver, getOptions, Retun all values
In First code i am showing you how to print the count of total values

This will print the total value in the drop down. In this example it is showing 13 because month also in the drop down
Now i am showing you how to print the all values in the console



This will print the all values in the drop down. See below snapshot


Comments

Popular posts from this blog

Why Jmeter is best option for Performance Testing?

There are multiple tools in market for performance testing of any software but Jmeter is the best solution among all of them due to some reason listed below 1) Jmeter is the open source application so users who use this application will not to pay anything. 2) You can use Jmeter for performance of any web application,  Databases and Web Services (REST and SOAP APIs). 3) Jmeter have the user friendly UI component so it is very easy to use. 4) Jmeter can be used to simulate to put maximum number of concurrent users on a server, network or object to test its strength or to analyze overall performance under different load types. 5) Jmeter also use for functional testing for static( JavaScript and HTML) and dynamic( JSP, Servlets and AJAX) resources. 6) Jmeter provides Verity of graphical representations for performance report so it is easy to understand.

Guide to Setup Selenium Web Driver

In this Article i am describing you how to setup Selenium Web Driver in your Machine Step 1: First You need to install Java in your Computer. To download the java Click Here