I want to make a page wait for 15 minutes but neither Thread.sleep or Web driver wait seems to be working.Can anyone suggest a solution for my problem?
See Question&Answers more detail:osI want to make a page wait for 15 minutes but neither Thread.sleep or Web driver wait seems to be working.Can anyone suggest a solution for my problem?
See Question&Answers more detail:osIf you are looking to make a Web Page
wait for 15 minutes, Thread.sleep();
or WebDriverWait
are not the intended ways. To make the Web Page
wait you have to inject Javascript
within the Web Browser
As you tried Thread.sleep()
and WebDriverWait
, here are a few details :
Thread.sleep()
: Is a Java
based method from Thread Class
which holds any further execution of a thread for the specified amount of time.WebDriverWait
: Is a Selenium
based Class
which extends org.openqa.selenium.support.ui.FluentWait<WebDriver>
and is a specialization of FluentWait
that uses WebDriver
instances and is invoked over WebElements
to attain a certain characteristics over a period of timespan. From your question, I am not sure about the problem you are facing with Thread.sleep();
or WebDriverWait
but Thread.sleep();
seems works fine for 15 minutes
as follows :
package demo;
public class SLEEP
{
public static void main(String[] args) throws InterruptedException
{
System.out.println("Program Started");
Thread.sleep(1000*60*1);
System.out.println("Program Ended");
}
}
Program Started
Program Ended
Note : However while working with
Selenium
,Thread.sleep();
should be avoided as it degrades theTest Performance
. Instead we must useExpectedConditions
with a proper method from thislist
.