WebDriverWait +搜索项目 [英] WebDriverWait + search for an item
问题描述
创建激活码后,需要1至60秒的时间将代码上传到系统中.因此,在创建新代码之后,我想使用WebDriverWait 60秒钟来确保,并且在此时间段内每3秒钟我要单击搜索按钮".有什么办法吗?
(new WebDriverWait(driver, 60))
.until(ExpectedConditions.textToBePresentInElement(By.xpath("//*[@id='searchResults']"), activationCode));
WebDriverWait
附带免费".
在创建WebDriverWait
时可以设置一个值,以告诉它应该多久尝试运行一次代码(单击搜索按钮):
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/support/ui/FluentWait.html#pollingEvery(long ,java.util.concurrent.TimeUnit)>
因此,只需将pollingEvery
设置为等于 3秒.
After creating an Activation Code it takes 1-60 seconds for the code to be uploaded into the system. So right after creating a new code, I want to use WebDriverWait for 60 sec to make sure and in this time period every 3 sec I want to click on Search Button. Is there any way to do this?
(new WebDriverWait(driver, 60))
.until(ExpectedConditions.textToBePresentInElement(By.xpath("//*[@id='searchResults']"), activationCode));
This comes "for free" with WebDriverWait
.
There is a value you can set when creating the WebDriverWait
to tell it how often it should be attempting to run your code (which is clicking the search button):
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/support/ui/FluentWait.html#pollingEvery(long, java.util.concurrent.TimeUnit)
So just set pollingEvery
equal to three seconds.
这篇关于WebDriverWait +搜索项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!