[英]Selenium ExpectedConditions NOT elementToBeClickable
Working in Java, with an entry-level knowledge. 在Java中工作,具有入门级知识。 We are in the process of moving to Selenium 3, and I was told WebDriverWait needs to use ExpectedConditions, using other methods could lead to having to redo it after the upgrade.
我们正在迁移到Selenium 3,我被告知WebDriverWait需要使用ExpectedConditions,使用其他方法可能导致在升级后必须重做它。 Not sure about this, but I'm going to follow orders here.
不确定这一点,但我会在这里遵循命令。
I'm trying to get rid of a hard wait in an automation spec. 我正试图摆脱自动化规范中的艰难等待。 I'm trying to setup a wait to make sure an element becomes unclickable.
我正在尝试设置等待以确保元素变得不可点击。 More or less trying to do the opposite of
或多或少地试图做相反的事情
WebDriverWait(driver, Timeout.SHORT)
.until(ExpectedConditions.elementToBeClickable(By.id(elementID)));
There was a single post on SO that referenced this. SO上有一篇文章引用了这一点。 I tried to implement their answer, but alas it did not work.
我试图实现他们的答案,但唉它没有用。 That answer can be found here: How to wait for an element NOT to be clickable using Selenium Webdriver?
这个答案可以在这里找到: 如何使用Selenium Webdriver等待元素不可点击?
I was getting some errors on top of some issues related to the use of Predicate class. 我在使用Predicate类的一些问题上遇到了一些错误。
Any and all help/suggestions would be greatly appreciated. 任何和所有的帮助/建议将不胜感激。
The ExpectedConditions
of Selenium come with ExpectedConditions.not()
which should be exactly what you are asking for (link to documentation ). Selenium的
ExpectedConditions
带有ExpectedConditions.not()
,这应该是你要求的(链接到文档 )。
WebDriverWait(driver, Timeout.SHORT)
.until(ExpectedConditions.not(
ExpectedConditions.elementToBeClickable(By.id(elementID)))
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.