我已经用Python编写了一些自动化测试。我正在阅读Selenose
(http://shiningpanda.com/introducing-selenose.html)
因为我想尝试使用它来运行我的测试用例,使用1个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
我创造了一个鼻子.cfg文件,并将其保存在以下路径中:
C:\Python27\Lib\site-packages\nose-1.3.7-py2.7.egg\nose
你知道吗鼻子.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
我也有同样的错误。你知道吗
我是在储存鼻子.cfg文件放错地方了? 如何启用Selenium驱动程序插件?你知道吗
在我的测试用例类中,我正在调用自动驾驶在init方法中,代码段如下:
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()
您已成功启用插件,但未设置驱动程序环境。你知道吗
您需要设置
selenium-driver
参数值(注意=
符号):其中
ie
是预定义的内置环境。你知道吗相关问题 更多 >
编程相关推荐