How does Selenium WebDriver's isDisplayed() method work


I currently have a large number of circumstances where I need to verify that a page (along with all of its elements) are displaying correctly. The isDisplayed() method of WebElement appears to be a logical way to do this, however I would like to understand precisely what this method is doing to determine whether or not an element “is displayed”. The javadoc does not shed any light on the inner workings of the method and other information on the web appears to be sparse at best.

If anyone could provide a detailed description of how this method works, I would be very grateful.

  • You must to post comments

WebDriver has its own W3C specification.

The section about determining visibility is what you are after.

I would warn that saying something “is displayed” is such a broad term, and thus there are many scenarios to it. Therefore, there may well be situations that WebDriver does not account for.

So it’s important, vital in fact, to remember that something being “displayed” or “visible” has many meanings. (In the same way a page being fully loaded, also has many meanings.)

Also remember Selenium is entirely open source. There is nothing stopping you from getting a fresh checkout of the repository and inspecting it locally.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.