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.

Ad-Hoc Testing

Ad-Hoc Testing is the testing type which is performed without any proper procedure and without any Requirement Specification. Ad-Hoc testing is totally informal testing which have intension to break the application as early as possible and found important defect early.  In Ad-hoc testing tester do not have any test cases so only the users who have very high knowledge regarding the application only they can perform Ad-Hoc Testing.

XPath Expression to locate Web Element

In last article i mentioned you how to locate the Web Element with id, Name, LinkText, Partial LinkText, CSS Selectors, Class Name and Tag Name. We use FireBug add-one to use these 7 locators to locate the Web Element on Web Page. Now we are talking about XPath expression. Which is also a type of Locator. We need FirePath add-ons to use it.