Sunday, 23 June 2019

Selenium waits - FluentWait, PageLoadTimeOut, ImplicitWait and ExplicitWait,

Fluent Wait: Fluent Wait. The fluent wait is used to tell the web driver to wait for a condition, as well as the frequency with which we want to check the condition before throwing an "ElementNotVisibleException" exception.

Wait<WebDriver> fluentWait = new FluentWait<WebDriver>(driver)
    .withTimeout(30, TimeUnit.SECONDS)
    .pollingEvery(1, TimeUnit.SECONDS)
    .ignoring(NoSuchElementException.class);

WebElement content = fluentWait.until(new Function<WebDriver, WebElement>() {
   public WebElement apply(WebDriver driver) {
    return driver.findElement(By.xpath("//h4[text()='Hello World!']"));
   }
});

pageLoadTimeout: if any page is taking more than x amount of time, then we can stop executing that script by seetting up pageLoadTimeout
Throws -  TimeoutException.

driver.manage().timeouts().pageLoadTimeout(1, TimeUnit.MILLISECONDS);

Implicit Wait: If we setup implicit wait, wait for x amount of time for elements avaialbility
Throws : NoSuchElementException

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Explicit Wait: This wait is applicable for specific element based on condition provided
WebDriverWait explicitWait = new WebDriverWait(driver, 10);
explicitWait.until(ExpectedConditions.visibilityOf(content));

Thursday, 6 June 2019

Eclipse - Maven - Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 from any of the configured repositories.

often you might come across below issue while creating maven project in eclipse.




The solution is very simple.

Just Delete .m2 folder ( C:\users\Kranthi\.m2)

That's all ..