Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Python test batch file does not run in Task Scheduler, browser does not open. Batch file does run ok without task scheduler

I have a Selenium Python test and I can run it from the batch file as follows:

set TEST_HOME=%~dp0
cd %~dp0

SET PATH=%PATH%;G:\test_runners\selenium_regression_test_5_1_1\IEDriverServer\64bit

cd %~dp0selenium_regression_test_5_1_1

set PYTHONPATH=%~dp0selenium_regression_test_5_1_1

c:\Python27\Scripts\nosetests.exe "%~dp0selenium_regression_test_5_1_1\Regression_TestCase\split_into_parts\RegressionProject_TestCase_Part1.py" --with-html --html-file="%~dp0selenium_regression_test_5_1_1\TestReport\SeleniumTestReport_part1.html"

I need to run this batch file through Task Scheduler. I have setup the task in task scheduler and when it runs the test fails because the browser does not open. The dev says the Task Scheduler runs in the background, headless browser. It will not open the browser. Can I not run this batch file from Task Scheduler?

How can i get the batch file which runs the Selenium test to run from Task Scheduler?

Thanks, Riaz

like image 734
Riaz Ladhani Avatar asked May 18 '26 17:05

Riaz Ladhani


1 Answers

I have got it to run now. In Task Scheduler to run the task as not hidden the setting radio button "Run only when user is logged on" should be checked.

The browser then open for the Selenium test when the batch file runs.

Many users have faced this issue: I found the solution from here: http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/why-is-a-windows-7-scheduled-task-running-hidden/d5196c53-5ebd-40a9-8180-d97bde69d060?auth=1

like image 148
Riaz Ladhani Avatar answered May 21 '26 19:05

Riaz Ladhani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!