首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Python Selenose启用Selenium驱动程序插件显示提供环境错误

Python Selenose启用Selenium驱动程序插件显示提供环境错误
EN

Stack Overflow用户
提问于 2016-02-05 03:11:49
回答 1查看 97关注 0票数 1

我已经用Python Selenium Webdriver编写了一些自动化测试。我正在阅读Selenose (http://shiningpanda.com/introducing-selenose.html),因为我想尝试使用它来让我的测试用例使用同一个web浏览器的实例运行,而不是为每个测试用例打开一个新的浏览器。

我正在尝试使用cmd中的以下命令启用Selenium驱动程序插件:

代码语言:javascript
复制
C:\Python27\Scripts>nosetests.exe --with-selenium-driver

我得到了错误:

代码语言:javascript
复制
      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文件,并将其保存在以下路径中:

代码语言:javascript
复制
C:\Python27\Lib\site-packages\nose-1.3.7-py2.7.egg\nose

nose.cfg

代码语言:javascript
复制
[selenium-driver:ie]
executable_path = C:\Webdriver\IEDriverServer\IEDriverServer.exe
webdriver = ie

[nosetests]
with-selenium-driver = true

我也尝试过从命令提示符

代码语言:javascript
复制
C:\Python27\Scripts>nosetests.exe --with-selenium-driver selenium-driver:ie

我得到了同样的错误。

我是否将nose.cfg文件存储在错误的位置?如何启用Selenium驱动程序插件?

在我的测试用例类中,我从init方法调用self.driver,代码片段如下:

代码语言:javascript
复制
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()
EN

回答 1

Stack Overflow用户

发布于 2016-02-05 03:16:09

ValueError:请提供驱动程序环境

您正在成功启用插件,但没有设置驱动程序环境。

您需要设置--selenium-driver参数值(请注意=符号):

代码语言:javascript
复制
$ nosetests.exe --with-selenium-driver --selenium-driver=ie

其中ie是预定义的内置环境。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35209571

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档