Fluent Wait and WebDriver Wait - Differences

前端 未结 1 1714
北荒
北荒 2020-12-31 18:55

I have seen both FluentWait and WebDriverWait in code using Selenium. FluentWait uses a Polling Technique i.e. it will be poll every f

1条回答
  •  天命终不由人
    2020-12-31 19:09

    In your example wait.until(ExpectedConditions...) will keep looking (every 0.5s) for linkText 'Account' for 18 seconds before timing out.

    WebDriverWait is a subclass of FluentWait. In FluentWait you have more options to configure, along with maximum wait time, like polling interval, exceptions to ignore etc. Also, in your code, you don't need to wait and then findElement in the next step, you could do:

    WebElement element = wait.until(
            ExpectedConditions.elementToBeClickable(By.linkText("Account")));
    

    0 讨论(0)
提交回复
热议问题