我正在尝试设置我的selenium测试套件来使用Firefox,我使用selenoid来dockorize浏览器以进行测试。从我的理解,我做的一切都正确,但我得到一个InvalidArgumentException。
这里是我定义webdriver的地方。远程:
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)
这是我的浏览器的内容。硒oid正在使用的Json文件:
{
"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
。