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

+1 vote

Sep 29, 2019 in Selenium by Mounika
• 130 points
790 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, 2019 by Abha
• 27,920 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, 2019 by Anvi
• 14,070 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,510 points
11,873 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,710 points
265 views
0 votes
1 answer
0 votes
1 answer

How to print text from a list of all web elements with same class name in Selenium?

@Rajni, following test case is somewhat similar ...READ MORE

answered Jun 20, 2019 in Selenium by Avantika
11,828 views
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,510 points
3,529 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,710 points
1,347 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,710 points
6,972 views
+1 vote
1 answer

How to handle a combobox which when clicked open in new window with list of items(to be clicked) in selenium java ?

@Pavithra, you can try using following commands ...READ MORE

answered Oct 29, 2019 in Selenium by Abha
• 27,920 points
261 views
+1 vote
1 answer