how to display all items in the list in the drop down?

+1 vote

Sep 29 in Selenium by Mounika
• 130 points
49 views

2 answers to this question.

0 votes

Hey Mounika, you can checkout this thread to resolve your problem: https://www.edureka.co/community/51833/how-get-options-dropdown-webpage-using-selenium-webdriver

answered Sep 30 by Abha
• 23,820 points
0 votes

Try using following code: 

 WebElement dropdown = driver.findElement(By.id("id_dropdown"));

 Select list = new Select(dropdown);

 List<WebElement> dropdown_list = list.getOptions();

 for (int i = 0; i < dropdown_list.size(); i++) {

   String dropdown_value = dropdown_list.get(i).getText();

   System.out.println("dropdown values are " + dropdown_value);

 }
answered Sep 30 by Anvi
• 13,220 points

Related Questions In Selenium

0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
7,694 views
0 votes
1 answer

How to choose from a drop-down in Selenium 2?

You can probably use the 'Select' class ...READ MORE

answered Apr 24, 2018 in Selenium by king_kenny
• 3,650 points
123 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,090 points
2,125 views
0 votes
1 answer
0 votes
1 answer

How to open a browser windows silently in the background?

It is a little bit of a ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,650 points
216 views
0 votes
1 answer

How to handle the popup of file upload in Windows OS with WebDriver?

The value of name locator has probably ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,650 points
3,426 views
0 votes
1 answer

How to input text in the text box without calling the sendKeys()?

Hi Rohan, you can use Javascript Executer ...READ MORE

answered May 29 in Selenium by Abha
• 23,820 points
834 views