Value can be selected from the drop down, using the "Select" class:
Select sel = new Select(driver.findElement(By.xpath("xpath_of_dropdown")));
sel.selectByIndex(index_of_value_to_select);
OR
Select sel = new Select(driver.findElement(By.xpath("xpath_of_dropdown")));
sel.selectByValue(value_to_be_selected);
OR
Select sel = new Select(driver.findElement(By.xpath("xpath_of_dropdown")));
sel.selectByVisibleText(name_of_value);
Eg: We have to select "March" from month dropdown
sel.selectByIndex(3); // because march is on third index.
sel.selectByValue(23); // Value associated with march is 23.
sel.selectByVisibleText("March");
0 Comment(s)