1
votes

I have written some automated tests in Python Selenium Webdriver. I was reading up on Selenose (http://shiningpanda.com/introducing-selenose.html) as I want to try and use this for my test cases to run using the same instance of 1 web browser rather than opening a new browser for each test case.

I am trying to enable the Selenium Driver Plugin using the following command from cmd:

C:\Python27\Scripts>nosetests.exe --with-selenium-driver

I get the error:

      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

I have created a nose.cfg file and saved it in the following path:

C:\Python27\Lib\site-packages\nose-1.3.7-py2.7.egg\nose

nose.cfg

[selenium-driver:ie]
executable_path = C:\Webdriver\IEDriverServer\IEDriverServer.exe
webdriver = ie

[nosetests]
with-selenium-driver = true

I have also tried from the command prompt

C:\Python27\Scripts>nosetests.exe --with-selenium-driver selenium-driver:ie

I get the same error.

Am i storing the nose.cfg file in the wrong place? How do i enable the Selenium Driver plugin?

In my Test Case class I am calling self.driver from the init method, code snippet below:

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()
1

1 Answers

0
votes

ValueError: please provide a driver environment

You are successfully enabling the plugin, but you are not setting the driver environment.

You need to set the --selenium-driver argument value (note the = sign):

$ nosetests.exe --with-selenium-driver --selenium-driver=ie

where ie is a predefined built-in environment.