Home > Software engineering >  InvalidArgumentException When using Selenoid WebDriver.Remote
InvalidArgumentException When using Selenoid WebDriver.Remote

Time:05-24

I'm trying to setup my selenium test suite to use Firefox, I'm using selenoid to dockorize the browser for testing. From my understanding I'm doing everything correctly but I'm getting an InvalidArgumentException.

Here is where I'm defining the webdriver.Remote:

firefox_caps = {
  "browserName": "firefox",
  "browserVersion": "97.0",
  "selenoid:options": {
    "enableVNC": True,
    "enableVideo": False
  }
}
cls.driver = webdriver.Remote(command_executor="http://localhost:4444/wd/hub", desired_capabilities=firefox_caps)

And here is the contents of my browsers.json file that selenoid is using:

{
        "chrome": {
                "default": "88.0",
                "versions": {
                        "88.0": {
                                "image": "selenoid/vnc_chrome:88.0",
                                "port": "4444",
                                "path": "/",
                                "env": ["TZ=America/Denver"]
                        }
                }
        },
        "firefox": {
                "default": "97.0",
                "versions": {
                        "97.0": {
                                "image": "selenoid/vnc_firefox:97.0",
                                "port": "4444",
                                "path": "/"}
                }
        }
}

Here is the error message I'm getting when I star the tests:

Traceback (most recent call last):
  File "/Users/ryannygard/selenium/extensions/test_suite.py", line 38, in _handleClassSetUp
    setUpDomain(self.env)
  File "/Users/ryannygard/selenium/automation/core/tests/base.py", line 146, in setUpDomain
    cls.driver = webdriver.Remote(command_executor="http://localhost:4444/wd/hub", desired_capabilities=firefox_caps, browser_profile=FirefoxProfile())
  File "/Users/ryannygard/.local/share/virtualenvs/selenium-8l3DWFXO/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Users/ryannygard/.local/share/virtualenvs/selenium-8l3DWFXO/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Users/ryannygard/.local/share/virtualenvs/selenium-8l3DWFXO/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Users/ryannygard/.local/share/virtualenvs/selenium-8l3DWFXO/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Requested environment is not available

CodePudding user response:

For Firefox images path should be /wd/hub.

  • Related