Skip to content

Instantly share code, notes, and snippets.

@ShamaUgale
Created September 8, 2020 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShamaUgale/cce2da71e0eca5e4240dc88009a2018a to your computer and use it in GitHub Desktop.
Save ShamaUgale/cce2da71e0eca5e4240dc88009a2018a to your computer and use it in GitHub Desktop.
This is a demonstration of applying FluentWait in selenium 4 vs 3.
import java.util.concurrent.TimeUnit; // Selenium 3
import java.time.Duration; // Selenium 4
// selenium 3 usage
FluentWait wait = new FluentWait(driver)
.pollingEvery(20, TimeUnit.MILLISECONDS)
.withTimeout(20, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
//selenium 4 usage
FluentWait wait = new FluentWait(driver)
.pollingEvery(Duration.ofMillis(500))
.ignoring(NoSuchElementException.class)
.withTimeout(Duration.ofSeconds(60));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment