Skip to content

Instantly share code, notes, and snippets.

Last active August 10, 2020 17:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Explanation about how to change the default timeout using explicitly wait in Selenium WebDriver
public class ExplicitlyWaitExampleTest {
private WebDriver driver;
private WebDriverWait wait;
public void preCondition() {
driver = new ChromeDriver();
public void beforeEachTest() {
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
public void usingRegularTimeout1() {
WebElement menu = driver.findElement("buger"));
public void usingRegularTimeout2() {
By cpf ="cpf_document");
public void overridingDefaultTimeout() {
By uploadSuccessfull = By.cssSelector(".sucess.upload");
// overriding the default timeout only for this wait
withMessage("timeout while waiting for upload to finish").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment