I have a batch file that kicks off my Selenium script (written in Java), which uses the IEDriverServer. When I run that batch file from the command line, the script works as expected. However, when I use the Windows Task Scheduler to run the exact same batch file, the script times out during a WebDriverWait until statement:
(new WebDriverWait(driver, JAVASCRIPT_TIMEOUT_SECONDS)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().equals(BROWSE_PAGE_TITLE);
}
});
I found this Stack Overflow post:
Selenium runs as scheduled task on Windows Server
which suggests that setting the job to "Run whether the user is logged in or not" can fix the problem, but I already have the job set that way.
I have tried both the 32-bit and 64-bit versions of the IEDriverServer.
It is also worth noting that the sendKeys method is taking about 5 seconds per keystroke when using the Task Scheduler, but not when running the batch file directly.
How can I get Selenium to behave the same way using the Task Scheduler as it does when running from the command line?
Additional Info:
- Windows Server 2008 R2
- IEDriverServer version 2.42.0
- Selenium Java version 2.42.2