This tutorial is all about how to find if an element is displayed on the screen.
Web Application has got so much diversity. So testing a web application is a challenges that too by using an automation tool. Few element become visible immediately while others takes time to load. So automated test fails sometime.
WebDriver provides the user following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.
boolean buttonPresence = driver.findElement(By.id(“myid”)).isDisplayed();
boolean buttonSelected = driver.findElement(By.id(“myid”)).isDisplayed();
boolean searchIconEnabled = driver.findElement(By.id(“myid”)).isEnabled();