Selenium Python 测试批处理文件未在任务计划程序中运行,浏览器未打开.批处理文件在没有任务调度程序的情况下运行正常 [英] Selenium Python test batch file does not run in Task Scheduler, browser does not open. Batch file does run ok without task scheduler

查看:83
本文介绍了Selenium Python 测试批处理文件未在任务计划程序中运行,浏览器未打开.批处理文件在没有任务调度程序的情况下运行正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Selenium Python 测试,我可以从批处理文件中运行它,如下所示:

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?

如何从 Task Scheduler 获取运行 Selenium 测试的批处理文件?

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

谢谢,里亚兹

推荐答案

我现在可以运行它了.在 Task Scheduler 中,要以不隐藏的方式运行任务,应选中设置单选按钮仅在用户登录时运行".

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.

然后在批处理文件运行时打开浏览器进行 Selenium 测试.

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

很多用户都遇到过这个问题:我从这里找到了解决方案: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

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

这篇关于Selenium Python 测试批处理文件未在任务计划程序中运行,浏览器未打开.批处理文件在没有任务调度程序的情况下运行正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆