Refrence: Speeding up end-to-end tests
I tried removing ImplicitWaits
and I found myself ending up writing too much code for every click and sendkeys etc. I have to put wait condition for every base function.
Implicit Wait:
public WebDriver openBrowser() {
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + getProperty("chromeDriver_exe"));
driver = new ChromeDriver();
}
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
Click Function:
public void click(String locatorKey) {
//Put Wait condition else element will be remain unattended/notFound
driver.findElement(By.xpath(xpathExpression)).click();
logger("Clicked on " + locatorKey);
}