InvalidArgumentException 使用 Selenoid 时 WebDriver.Remote

InvalidArgumentException When using Selenoid WebDriver.Remote

我正在尝试设置我的 selenium 测试套件以使用 Firefox,我正在使用 selenoid 对接浏览器以进行测试。根据我的理解,我做的一切都是正确的,但我得到了一个 InvalidArgumentException。

这里是我定义 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)

这是我的 browsers.json selenoid 使用的文件的内容:

{
        "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": "/"}
                }
        }
}

这是我在对测试加注星标时收到的错误消息:

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

对于 Firefox 图片路径应该是 /wd/hub