When using FluentWait in Selenium, it is possible to configure the polling duration of the FluentWait
As far as I know, that is the frequency of checking if the element exists, for example
So, if the timeout is 3 seconds, and the polling duration set is 250 milliseconds, the driver will check for element 12 times before ultimately throwing an exception when it checks for the element the 13th time.
To my understanding, and by that logic, decreasing the polling duration makes the script perform better because it will check for the element more times
Below you can find my implementation of the FluentWait
public static void waitForElementWithDuration(By locator, Duration duration) {
FluentWait<org.openqa.selenium.WebDriver> wait = new FluentWait<>(Base.driver);
wait.withTimeout(duration)
.pollingEvery(ConfigurationManager.DEFAULT_POLLING_DURATION)
.ignoring(NoSuchElementException.class, ElementClickInterceptedException.class)
.until(ExpectedConditions.and(
ExpectedConditions.presenceOfElementLocated(locator),
ExpectedConditions.elementToBeClickable(locator)));
}
I am thinking about making the default polling duration in my configuration manager class shorter (right now it is at 250ms) Would there be any potential drawbacks of me setting the polling duration to 10ms? As the flow I am automating is rather long, and needs to be repeated for many times, implementing a shorter polling duration would make the total time needed to run the tests much shorter
I have been working as a Test Automation Engineer for 1.5 years, so I am still new, and would appreciate some help from more experienced Test Automation Engineers