代码之家  ›  专栏  ›  技术社区  ›  L.V.A

使用W3C WebDriver API启动Chromedriver会话

  •  0
  • L.V.A  · 技术社区  · 7 年前

    我正在尝试使用chromedriver和w3c WebDriver API启动chromium会话,我向 http://localhost:9515/session 带着尸体

    {
        "capabilities": {
            "alwaysMatch": {
                "platformName": "linux",
                "chrome:browserOptions": {
                    "binary": "/usr/bin/chromium",
                    "args": ["--start-page=about:blank"]
                }
            },
            "firstMatch": [
                {"browserName": "chrome"}
            ]
        }
    }
    

    我得到下一个答复

    {
        "sessionId": "b1a413df152017cd223dbabbcf1d2ffe",
        "status": 33,
        "value": {
            "message": "session not created exception: Missing or invalid capabilities (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.14.47-1-MANJARO x86_64)"
        }
    }
    

    哪些功能缺失或无效?

    2 回复  |  直到 6 年前
        1
  •  3
  •   Remember Monica    7 年前

    capabilities.alwaysMatch.goog:chromeOptions.w3c: true

    geckodriver

        2
  •  0
  •   Artem Yakovlev    6 年前

        ChromeOptions options = new ChromeOptions();
        options.setExperimentalOption("w3c", true);
        new ChromeDriver(options);