Stay on the page for 30 minutes then do the operations (Webdriver-Java)

I have a script where I enter my application, do a download operation, and then wait (stay) on this page for 30 minutes, and then do the download operation again.

Is implicitwait

within 30 minutes of the script? Is there a better option?

+3


source to share


2 answers


An implicit wait is to tell the WebDriver

DOM to poll for a specific amount of time when trying to find an element or elements that are not immediately available. It won't be useful for the current scenario.

You can use Thread.sleep

or TimeUnit.sleep

like



try {
     TimeUnit.MINUTES.sleep(30);
} catch (InterruptedException e) {
    //Handle exception
}

      

For more information: I cannot use Thread.sleep (x) or wait (): java.lang.InterruptedException; must be caught or declared abandoned

+5


source


You don't need to use implicit wait. Use instead Thread.Sleep(30*60*1000);

. This will sleep the main thread of your tests until a specified value of milliseconds is specified.



driver.Navigate().GoToUrl("http://yourapplication.com");
Thread.Sleep(30*60*1000); 
// Download Files

      

+3


source







All Articles