Google News
logo
Selenium - Interview Questions
How can you find if an element in displayed on the screen?
WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.
 
* isDisplayed()
* isSelected()
* isEnabled()

Syntax :
 
isDisplayed()boolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();
 
isSelected()boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();
 
isEnabled() : boolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();
Advertisement