Selenium WebDriver的isDisplayed()方法如何工作 [英] How does Selenium WebDriver's isDisplayed() method work

查看:778
本文介绍了Selenium WebDriver的isDisplayed()方法如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有很多情况需要验证页面(及其所有元素)是否正确显示. WebElement的isDisplayed()方法似乎是执行此操作的逻辑方法,但是我想准确地了解此方法在确定是否显示"元素时正在做什么. javadoc 对内部该方法的工作以及网络上的其他信息似乎很少.

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.

推荐答案

WebDriver拥有自己的 W3C规范.

WebDriver has its own W3C specification.

关于确定可见性的部分是您所追求的.

The section about determining visibility is what you are after.

我会警告说显示"是一个如此宽泛的术语,因此存在许多场景.因此,很可能存在WebDriver无法解决的情况.

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.

所以重要的是 vital 实际上,要记住被显示"或可见"的东西具有许多含义. (以同样的方式,页面完全加载也有很多含义.)

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.)

还请记住,Selenium是完全开放的源代码.没有什么可以阻止您从获得存储库的新签出并在本地对其进行检查.

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

这篇关于Selenium WebDriver的isDisplayed()方法如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆