Answer a question

What is the difference between isDisplayed() and isVisible() methods in Selenium? Both are used to identify whether web element is or is not hidden in web page.

Answers

Short answer is that isVisible is method of old Selenium RC and isDisplayed is method of Selenium 2.

If you are talking about WebDrivers WebElement, it contains only isDisplayed() method, which by the doc:

Is this element displayed or not? This method avoids the problem of having to parse an element's "style" attribute.

Before webdriver we had Selenium RC, which is now long deprecated, the DefaultSelenium class had isVisible() method that:

Determines if the specified element is visible. An element can be rendered invisible by setting the CSS "visibility" property to "hidden", or the "display" property to "none", either for the element itself or one if its ancestors. This method will fail if the element is not present.

reference

Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐