顯式等待 Explicit wait
Function<WebDriver, Boolean> waitFn = new Function<WebDriver, Boolean>() { @Override public Boolean apply(WebDriver driver) { Point newPos = page.getWDGAttrDetail().getLocation(); return newPos.getY() != prePos.getY(); } }; SeleniumUtil.createWait(page.getDriver()).until(waitFn);
?
WebElement myDynamicElement = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(locator))
?
new WebDriverWait(driver, 10). until(ExpectedConditions.elementToBeClickable(locator));
?
new WebDriverWait(driver, 10). until(ExpectedConditions.visibilityOf(locator));
?
//wait for processing icon present Function<WebDriver, WebElement> waitFn = new Function<WebDriver, WebElement>() { @Override public WebElement apply(WebDriver driver) { return el.findElement(By.cssSelector("div.rptstatus.rptcomplete")); } }; WebDriverWait wait = new WebDriverWait(driver, 120, 2); wait.withMessage("A processing icon should appear in the Status column of the row '"+templateName+"'."); wait.until(waitFn);
?
隱式等待 Implicit wait
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS)
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
