Drop-down values multiple types of selections
country list
. Dropdown seletion there are multiple type of code in selenium webdriver
new select(driver.findelement(By.xpath("//select[@name='country']"))).selectByVisibleText("india");
(or)
webelement country = driver.findElement (By.xpath("//select[@name='country']"));
select countryname = new select (country);
countryname.selectByVisibleText("india");
(or)
Select country = new Select(driver.findElement (By.xpath("//select[@name='country']")));
country.selectByVisibleText("india");
. Dropdowns values you can select the required in 3 ways. consider an HTML file
. In webdriver support SELECT tag , SELECT is a class it is a perform multiple task on dropdowns and multiple select object.
new Select(driver.findElement(By.name("country"))).selectByVisibleText("India");
new Select(driver.findElement(By.name("country"))).selectByIndex(index);
new Select(driver.findElement(By.name("country"))).selectByValue(value);