0

我有以下配置文件 browsers.json:

{
    "chrome": {
        "default": "69.0",
        "versions": {
            "60.0": {
                "image": "selenoid/chrome:60.0",
                "port": "4444",
                "path": "/",
                "tmpfs": {
                    "/tmp": "size=128m"
                }
            },
            "69.0": {
                "image": "selenoid/chrome:69.0",
                "port": "4444",
                "path": "/",
                "tmpfs": {
                    "/tmp": "size=128m"
                }
},
    "firefox": {
        "default": "60.0",
        "versions": {
            "50.0": {
                "image": "selenoid/firefox:50.0",
                "port": "4444",
                "path": "/wd/hub",
                "tmpfs": {
                    "/tmp": "size=128m"
                }
            },
            "60.0": {
                "image": "selenoid/firefox:60.0",
                "port": "4444",
                "path": "/wd/hub",
                "tmpfs": {
                    "/tmp": "size=128m"
        }
            }
        }
    },

在测试中,我有以下代码:

capabilities = {
                "browserName": "chrome",
                "version": "60.0"
            }
            options = webdriver.ChromeOptions()
            options.add_argument('--ignore-certificate-errors')
            options.add_argument('--no-sandbox')
            self.driver = webdriver.Remote(
                command_executor="http://localhost:4444/wd/hub",
                desired_capabilities=capabilities, options=options)

问题:为什么我不能运行特定的浏览器版本?它给了我例外:

WebDriverException: Message: Requested environment is not available

如果我没有在功能中指定版本,则测试会成功运行。

4

1 回答 1

0

As I have already said in Github issue and in AT forum - your config and code seem to be correct. Make sure your config file is used by Selenoid (either restart its container or do docker kill -s HUP selenoid). If that does not help - notice ENVIRONMENT_NOT_AVAILABLE messages in Selenoid log, they specify which browser name and version in fact arrive to Selenoid from your tests.

于 2018-06-06T03:54:39.343 回答