Reputation: 3
I am trying to place time gap between each web element. For example i want first webelement should work after 10 seconds and second web element should work after 30 seconds.But thats not working for me.
And is that possible if element1 i clicked manually then 2nd will work automatically, because in current case if i click 1st one manually then 2nd element not working automatically.
driver = new FirefoxDriver(options);
driver.get("http://demo.com");
((JavascriptExecutor) driver).executeScript("window.focus();");
WebDriverWait wait = new WebDriverWait(driver, 600);
// First path
WebElement element1 = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[2]/div[2]/div[2]/div/div/form/div[5]/div/input")));
element1.click();
// Second path
WebElement element2 = wait.until(
ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='sbt67Pin']")));
element2.click();
// Third path
Upvotes: 0
Views: 49
Reputation: 33384
Try Thread.sleep()
like that.If want to halt your scripts running.
Thread.sleep(10000);
WebElement element1 = driver.findElement(By.xpath("/html/body/div[2]/div[2]/div[2]/div/div/form/div[5]/div/input"));
element1.click();
hread.sleep(20000);
// Second path
WebElement element2 = driver.findElement(By.xpath("//*[@id='sbt67Pin']"));
element2.click();
// Third path
Thread.sleep(30000);
Upvotes: 1