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

What is API?

In general way, API (Application Programming Interface) is the intermediate software which is useful for two applications to communicate. API is the tool which is used for interaction of two applications. If developer developing any software which have multiple blocks (Modules) than developer use APIs to put them together.

Structural Testing

Structural Testing is the type of testing in which user should have the knowledge of the code because in this testing user need to check the structure of the system. Structural Testing is White Box Testing.