我已经用Python Selenium Webdriver编写了一些自动化测试。我正在阅读Selenose (http://shiningpanda.com/introducing-selenose.html),因为我想尝试使用它来让我的测试用例使用同一个web浏览器的实例运行,而不是为每个测试用例打开一个新的浏览器。
我正在尝试使用cmd中的以下命令启用Selenium驱动程序插件:
C:\Python27\Scripts>nosetests.exe --with-selenium-driver我得到了错误:
File "C:\Python27\Scripts\nosetests-script.py", line 9, in <module>
load_entry_point('nose==1.3.7', 'console_scripts', 'nosetests')()
File "C:\Python27\lib\site-packages\nose-1.3.7-py2.7.egg\nose\core.py", line 1
21, in __init__
**extra_args)
File "C:\Python27\lib\unittest\main.py", line 94, in __init__
self.parseArgs(argv)
File "C:\Python27\lib\site-packages\nose-1.3.7-py2.7.egg\nose\core.py", line 1
45, in parseArgs
self.config.configure(argv, doc=self.usage())
File "C:\Python27\lib\site-packages\nose-1.3.7-py2.7.egg\nose\config.py", line
346, in configure
self.plugins.configure(options, self)
File "C:\Python27\lib\site-packages\nose-1.3.7-py2.7.egg\nose\plugins\manager.
py", line 284, in configure
cfg(options, config)
File "C:\Python27\lib\site-packages\nose-1.3.7-py2.7.egg\nose\plugins\manager.
py", line 99, in __call__
return self.call(*arg, **kw)
File "C:\Python27\lib\site-packages\nose-1.3.7-py2.7.egg\nose\plugins\manager.
py", line 167, in simple
result = meth(*arg, **kw)
File "C:\Python27\lib\site-packages\selenose-1.3-py2.7.egg\selenose\plugins.py
", line 78, in configure
raise ValueError('please provide a driver environment')
ValueError: please provide a driver environment我已经创建了一个nose.cfg文件,并将其保存在以下路径中:
C:\Python27\Lib\site-packages\nose-1.3.7-py2.7.egg\nosenose.cfg
[selenium-driver:ie]
executable_path = C:\Webdriver\IEDriverServer\IEDriverServer.exe
webdriver = ie
[nosetests]
with-selenium-driver = true我也尝试过从命令提示符
C:\Python27\Scripts>nosetests.exe --with-selenium-driver selenium-driver:ie我得到了同样的错误。
我是否将nose.cfg文件存储在错误的位置?如何启用Selenium驱动程序插件?
在我的测试用例类中,我从init方法调用self.driver,代码片段如下:
from selenose.cases import SeleniumTestCase
class AdministrationPage_TestCase(SeleniumTestCase):
def __init__(self):
self.driver.get(Globals.URL_riaz_pc)
self.login_page = login.LoginPage(self.driver)
self.driver.implicitly_wait(120)
self.driver.maximize_window()发布于 2016-02-05 03:16:09
ValueError:请提供驱动程序环境
您正在成功启用插件,但没有设置驱动程序环境。
您需要设置--selenium-driver参数值(请注意=符号):
$ nosetests.exe --with-selenium-driver --selenium-driver=ie其中ie是预定义的内置环境。
https://stackoverflow.com/questions/35209571
复制相似问题