March 2015
Intermediate to advanced
194 pages
3h 59m
English
A Select function allows you select or deselect values from a drop-down box or a radio button. It includes a list of Selenium API methods to work with select boxes that contain the <select>…</select> tags. These functions interact with the UI comboboxes to select options.
Select select = new Select(driver.findElement(By.locatorType("path")));Some helpful snippets using select functions are given below:
selectByIndex(index) method selects an option using the index value. The following is the syntax for this function:select.selectByIndex(index);
Let's get into the bookstore and select a product from a drop-down list. Here, we select the products at the top of the options list using the selectByTndex() method:
driver.get("http://www.barnesandnoble.com/"); ...Read now
Unlock full access