我正在使用selenium实现自动化,一个名为“预览”的操作将提交一个提取(金融数据)过程,它将进入一个名为“预览”的阶段。它通常需要2-5分钟的时间来完成“预览”过程,并将舞台更改为“草稿”。
根据这个答案,显式等待是一种方法。Wait for 5 min for an element to appear or a process to complete
有更好的方法吗?宁静是否提供硒以外的任何东西?
发布于 2019-03-06 08:18:20
您可以使用显式等待1分钟,并在within循环中使用它。例如:
WebElement element = driver.findElement(By(Identifier for DRAFT Status));
WebDriverWait wait = new WebDriverWait(driver, 60);
while (element == null) {
element = wait.until(ExpectedConditions.elementToBeClickable(By(Identifier for DRAFT Status));
}发布于 2019-03-08 03:44:34
在经典的宁静页面对象中:
withTimeoutOf(Duration.ofMinutes(5)).waitFor(DRAFT_STATUS_ELEMENT);在剧本中:
WaitUntil.the(DRAFT_STATUS_ELEMENT, isVisible()).forNoMoreThan(300).seconds())https://stackoverflow.com/questions/55014942
复制相似问题