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

余生颓废 提交于 2021-01-01 06:28:09

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/37207128/selenium-python-test-batch-file-does-not-run-in-task-scheduler-browser-does-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!