Aug 22, 2019 in Selenium
Q: How to find whether an element is displayed on the web page?

1 Answer

0 votes
Aug 22, 2019
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()

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

1

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

isSelected()

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

1

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

isEnabled()

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

1

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

Related questions

0 votes
Aug 22, 2019 in Selenium
0 votes
Aug 19, 2019 in Selenium
...