We Have 3 Methods in Select class To handle the drop down's:First we have to create object to that class and then we can call that methods as shown in bellow.
/*
* drop down select by visible text method
*/
public void selectDropDownByVisibleText(WebElement dropdown,String visibleText){
Select select=new Select(dropdown);
select.selectByVisibleText(visibleText);
}
/*
* drop down select by index method
*/
public void selectDropDownByIndex(WebElement dropdown,int index){
Select select=new Select(dropdown);
select.selectByIndex(index);
}
/*
* drop down select by value method
*/
public void selectDropDownByValue(WebElement dropdown,String value){
Select select=new Select(dropdown);
select.selectByValue(value);
}
No comments:
Post a Comment