19 November, 2014

How to select an option from the Dropdown element in Selenium Webdriver?

Step1: Create a Web-element and assign the path of Drop-down element to the Web-element.          
 WebElement Dropdownelementtest = driver.findelement(by.-----());  

Step2: Create a Select object and assign a Web-element object to the Select object created.          
  Select Dropdownoptiontest = new Select(Dropdownelementtest);  

Step3: Select the value from the Dropdown element.
           We have three types of method available to select option from Dropdown list
            Select by Index          
 Dropdownoptiontest.selectByIndex(" ");  

           Select by value          
 Dropdownoptiontest.selectByValue(" ");  

           Select by Visible Text          
 Dropdownoptiontest.selectByVisibleText(" ");  

No comments:

Post a Comment