Skip to main content

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();

If you want to implement dynamic wait, try this:

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();

If you want to implement dynamic wait, try this:

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();
Source Link
kotoj
  • 325
  • 1
  • 11

If you want to implement dynamic wait, try this:

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();