Styrow.dev
Question 52 of 82

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();


šŸ“² Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.