Automation QA Testing Course Content

WebElement Boolean Methods in Selenium WebDriver

1)isDisplayed():it checks whether the given element is present in the page or not

//identify the element and assign it to a variable
WebElement el=driver.findElement(By.locator("locatorvalue"));

if(el.isDisplayed()){
true actions;
}else{
false statements;
}

2)isEnabled():it checks whether the given element is enabled or disabled;
WebElement el1=driver.findElement(By.locator("locatorvalue"));

if(el1.isEnabled()){
true actions;
}else{
false statements;
}

3)isSelected():it checks whether the checkbox/radiobutton/
dropdown is selected or not
WebElement el2=driver.findElement(By.locator("locatorvalue"));

if(el2.isSelected()){
true actions;
}else{
false statements;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.