Styrow.dev
Question 52 of 64

How to find whether an element is displayed on the web page?

Question

How to find whether an element is displayed on the web page?

Answer

Below methods can be used to check the visibility of the web elements

isDisplayed():

boolean elePresent = driver.findElement(By.xpath(""xpath"")).isDisplayed();

isSelected():

boolean eleSelected= driver.findElement(By.xpath(""xpath"")).isSelected();

isEnabled()

boolean eleEnabled= driver.findElement(By.xpath(""xpath"")).isEnabled();