Selenium Web driver wait a long time
Can I wait for the Selenium web driver for a long period of time?
Even though I can set the implicitlywait command like below, I am not waiting for the time I gave.
driver.manage().timeouts().implicitlyWait(5, TimeUnit.MINUTES);
Is there something wrong here?
In my case, I need to execute one test case and wait 4 minutes and then execute the next test case. I am using Java here.
source to share
This is not really my answer. Two days ago I saw this answer here, but I didn't have time to apply it. Today I tried and what I wanted.
Unfortunately now I don't see this answer here. So I added this answer and all credits should be sent to the user who posted this answer here.
In this case, I would like to wait for the driver for 5 minutes so that the periodic cron job is executed.
Thread.sleep(4000);
to pause the program.
source to share
Considering that you need to wait for a specific element, I would do something in the ExplicitWait lines like below.
WebDriverWait wait = new WebDriverWait(driver, 300); // The int here is the maximum time in seconds the element can wait.
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("someId")));
In this case, you can use whatever ExpectedConditions you want. It also doesn't need to use long latency in some special cases. This is imho good practice.
source to share