If you want to implement dynamic waitdynamic wait, try this:
WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(elementToBeClickable(By.xpath(".//*[@id='header2']/nav/div/ul/li/a"))).click();
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(elementToBeClickable(By.xpath(".//*[@id='header2']/nav/div/ul/li/a"))).click();
instead of this:
Thread.sleep(3000); driver.findElement(By.xpath(".//*[@id='header2']/nav/div/ul/li/a")).click();
Thread.sleep(3000);
driver.findElement(By.xpath(".//*[@id='header2']/nav/div/ul/li/a")).click();