1. isDisplayed()
The isDisplayed method in Selenium verifies if a certain element is present and displayed. If the element is displayed, then the value returned is true. If not, then the value returned is false.
The code below verifies if an element with the id attribute value next is displayed.
Syntax:
boolean eleSelected= driver.findElement(By.xpath("xpath")).isDisplayed();
2. isSelected()
This method is often used on radio buttons, checkboxes or options in a menu. It is used to determine is an element is selected. If the specified element is selected, the value returned is true. If not, the value returned is false.
The code below verifies if an element with the id attribute value PersistentCookie is displayed.
Syntax:
boolean elePresent = driver.findElement(By.xpath("xpath")).isSelected();
3. isEnabled()
This method verifies if an element is enabled. If the element is enabled, it returns a true value. If not, it returns a false value.
The code below verifies if an element with the id attribute value next is enabled.
Syntax:
boolean eleEnabled= driver.findElement(By.xpath("xpath")).isEnabled();