How to keep selenium step to be keep waiting for 1 hour?

Selecting a button on a page generates new window. New window keeps loading for 1 hour as it will generate files from DataBase to local. How do I keep selenium to wait until for 1 hour?? i am trying to automate this scenario. New window will have print statements after completion of db files generation in the background.

3 answers

  • answered 2018-11-08 07:46 Raheela Aslam

    Please use WebDriverWait as below:

    WebDriverWait wait = new WebDriverWait(WebDriver, timeoutInSeconds);

  • answered 2018-11-08 07:54 Waqar Nadir

    use following to wait for 1 hour.

    int hourInSecond = 3600;
    WebDriverWait wait = new WebDriverWait(WebDriver, hourInSecond);

    1 hour = 3600 seconds;

  • answered 2018-11-08 08:09 H0axD3

    Well as we all should assume the file generations can take more or less time.

    So you maybe need something more flexible, like this:

    WebDriverWait wait = new WebDriverWait(webdriver, waitForElementTimeout).until(ExpectedConditions.attributeToBe(webelement, "text", expected));

    this code would wait until the Statement variable, which will be printed, gets the right value.