over 8 years ago
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);
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");
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)