蝴蝶不菲
每个FluentWait实例都定义了等待条件的最长时间,以及检查条件的频率。此外,用户可以配置等待以在等待时忽略特定类型的异常,例如在页面上搜索元素时的NoSuchElementExceptions。 // Waiting 30 seconds for an element to be present on the page, checking // for its presence once every 5 seconds. Wait wait = new FluentWait(driver) .withTimeout(30, SECONDS) .pollingEvery(5, SECONDS) .ignoring(NoSuchElementException.class);会变慢,因为: // Waiting 30 seconds for an element to be present on the page, checking // for its presence once every 1 second. Wait wait = new FluentWait(driver) .withTimeout(30, SECONDS) .pollingEvery(1, SECONDS) .ignoring(NoSuchElementException.class);因此,这取决于您将使用什么。