Explicit wait example
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement myDynamicElement= wait.until(ExpectedConditions.element
Implicit waits are used to provide a waiting time (say 30 seconds) between each consecutive test steps across the entire test script or program. Next step only executed when the 30 Seconds (or whatever time is given is elapsed) after execution of previous step
Syntax:
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
Explicit waits are used to halt the execution till the time a particular condition is met or the maximum time which is defined , has elapsed. Implicit wait has applied between each consecutive test steps across the entire test script or programs while Explicit waits are applied for a particular instance only.
Syntax:
WebDriver driver = new FirefoxDriver();
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable("Locator"));