java 在selenoid中启动 selenium 化物测试时出错(w3c功能中出现非法键值:[enableVNC])

ztyzrc3y  于 2023-06-20  发布在  Java
关注(0)|答案(1)|浏览(158)

当我尝试对selenoid运行 selenium 化物测试时,我得到了下一个错误。你能帮我弄清楚哪里出了问题吗?
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [enableVNC]
以下是我的Docker compose:

version: '3.8'

services:
  selenoid:
    image: aerokube/selenoid:latest-release
    container_name: selenoid
    network_mode: bridge
    ports:
      - "4444:4444"
    volumes:
      - ".:/etc/selenoid"
      - "/var/run/docker.sock:/var/run/docker.sock"
    command: ["-limit=4", "-capture-driver-logs", "-max-timeout=0h5m0s"]

  selenoid-ui:
    image: aerokube/selenoid-ui:latest-release
    container_name: selenoid-ui
    network_mode: bridge
    ports:
      - "8080:8080"
    links:
      - selenoid
    depends_on:
      - selenoid
    command: [ "--selenoid-uri", "http://selenoid:4444" ]

  chrome113:
    image: selenoid/vnc_chrome:113.0

下面是我确定浏览器的代码:

import static com.codeborne.selenide.Configuration.*;

browser = CHROME;
        browserVersion = "113.0";
        browserSize = "1920x1080";     
        capabilities.setCapability("enableVNC", true);
        browserCapabilities = capabilities;

selenide.remote=http://localhost:4444/wd/hub

请帮助了解什么是错误的。先谢谢你。

解决方案:

ChromeOptions options = new ChromeOptions();
    options.setCapability("browserVersion", "113.0");
    options.setCapability("selenoid:options", new HashMap<String, Object>() {{
        /* How to add test badge */
        put("name", scenario.getName());
        /* How to set session timeout */
        put("enableVideo", true);
        put("enableVNC", true);
        put("videoName", scenario.getName());
    }});
    browserCapabilities = options;
r3i60tvu

r3i60tvu1#

W3C标准中的Selenoid功能应该放在供应商前缀下。在Selenoid的情况下,这个前缀是selenoid:options。因此,enableVNC和其他特定于Selenoid的功能应该位于selenoid:options密钥下。www.example.com https://aerokube.com/selenoid/latest/#_specifying_capabilities_via_protocol_extensions

相关问题