Sunday, June 1, 2014

How to select items in a DropDown using selenium webdriver


Step 1:
Taking the xpath of Drop Down Arrow  and build the WebElement

 driver object created from Web Driver

WebElement dropDownArrow = driver.findElement(By.xpath("Xpath or CSS of the DropDownarrow"));

After clicking arrow hold select the item


Step2:

//Selecting Drop Down Item;
        Actions builder = new Actions(driver);
        builder.clickAndHold(dropDownArrow).build().perform();
        driver.findElement("xpath of the selected item")).click();
       

No comments:

Post a Comment