Posts

Showing posts with the label dynamic wait

what is WebDriver wait?

when running test suite if need to wait for an element the webDriver has to wait till the element appears, this can be done either by defining static time out in such cases though the element is displayed still webDriver has to wait till the time out occurs. An implementation of the  Wait  interface that may have its timeout and polling interval configured on the fly. But Using WebDriver wait interface, WebDriver will wait for that particular amount of X duration in such a way that it will check for every Y duration(Both X,Y are configurable) whether the element is displayed or not, it is like dynamic wait. Syntax: // Waiting 30 seconds for an element to be present on the page, checking // for its presence once every 5 seconds. FluentWait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(30, SECONDS) .pollingEvery(5, SECONDS) .ignoring(NoSuchElementException.class); The below code can be used in a method, ...