1

当我运行很长的测试用例时,我收到了这个错误。这主要发生在詹金斯身上。

操作系统:Ubuntu 18.04

码头工人版本:19.03.8

Docker API 版本:1.40

容器数量:4

内存:30GB

处理器:i7 9700k

浏览器.json

    {
    "chrome": {
        "default": "81.0",
        "versions": {
            "81.0": {
                "image": "selenoid/vnc:chrome_81.0",
                "port": "4444",
                "path": "/",
                "shmSize" : 1068435456
            },
            "80.0": {
                "image": "selenoid/vnc:chrome_80.0",
                "port": "4444",
                "path": "/",
                "shmSize" : 1068435456
            },
            "79.0": {
                "image": "selenoid/vnc:chrome_79.0",
                "port": "4444",
                "path": "/",
                "shmSize" : 1068435456
            }
        }
    }
}

错误输出:

  { TimeoutError: timeout: Timed out receiving message from renderer: 300.000
    matchdciprotractor_1   |   (Session info: chrome=81.0.4044.92)
    matchdciprotractor_1   |   (Driver info: chromedriver=81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776}),platform=Linux 5.3.0-46-generic x86_64)
    matchdciprotractor_1   |     at Object.checkLegacyResponse (/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
    matchdciprotractor_1   |     at parseHttpResponse (/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
    matchdciprotractor_1   |     at doSend.then.response (/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
    matchdciprotractor_1   |     at process._tickCallback (internal/process/next_tick.js:68:7)
    matchdciprotractor_1   | From: Task: WebDriver.switchTo().defaultContent()
    matchdciprotractor_1   |     at thenableWebDriverProxy.schedule (/protractor/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
    matchdciprotractor_1   |     at TargetLocator.defaultContent (/protractor/node_modules/selenium-webdriver/lib/webdriver.js:1798:25)
    matchdciprotractor_1   |     at Function.<anonymous> (/protractor/src/elements/utils.ts:112:38)
    matchdciprotractor_1   |     at step (/protractor/dist/src/elements/utils.js:44:23)
    matchdciprotractor_1   |     at Object.next (/protractor/dist/src/elements/utils.js:25:53)
    matchdciprotractor_1   |     at /protractor/dist/src/elements/utils.js:19:71
    matchdciprotractor_1   |     at new Promise (<anonymous>)
    matchdciprotractor_1   |     at __awaiter (/protractor/dist/src/elements/utils.js:15:12)
    matchdciprotractor_1   |     at Function.Utils.doSwitch (/protractor/dist/src/elements/utils.js:179:16)
    matchdciprotractor_1   |     at Function.<anonymous> (/protractor/src/elements/utils.ts:98:20) name: 'TimeoutError', remoteStacktrace: '' }
4

2 回答 2

0

添加SessionTimeout能力,如以下示例:

capabilities.setCapability("sessionTimeout","30m");

  • 这会将 timeOut 设置为 30 分钟
  • 超时以 Golang 持续时间格式指定,例如 30m 或 10s 或 1h5m
于 2022-03-01T11:18:18.647 回答
0

尝试以下配置。根据您的需要将主机文件夹安装到容器中。

每个节点仅限于 1 个浏览器。还要确保从测试框架中提供适当的功能。比如:--disable-gpu --no-sandbox

您也可以尝试使用 --disable-dev-shm-usage

不要忘记应用适当的 selenoid 功能:

来自打字稿的示例,您可以将它们添加到所有编程语言中。

'selenoid:options': {
                version: '81',
                enableVNC: false,
                enableVideo: false,
                enableLog: false, // save session logs
                videoScreenSize: '1920x1080',
                videoFrameRate: 24,
                videoCodec: 'mpeg4',
                screenResolution: '1920x1080x24'
            },

码头工人组成:

version: '3'
services:
  selenoid:
    image: "aerokube/selenoid:1.9.2"
    container_name: selenoid
    network_mode: bridge
    ports:
      - "4444:4444"
    volumes:
      - "./:/etc/selenoid/:ro"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./video/:/opt/selenoid/video/"
      - "./logs/:/opt/selenoid/logs/"
    environment:
    command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs", "-limit", "3", "-timeout", "5m"]
  selenoid-ui:
    image: "aerokube/selenoid-ui:1.8.0"
    container_name: selenoid-ui
    network_mode: bridge
    links:
      - selenoid
    ports:
      - "9090:9090"
    command: ["--selenoid-uri", "http://selenoid:4444", "--listen", ":9090"]

浏览器.json

{
    "chrome": {
        "default": "81",
        "versions": {
            "81": {
                "image": "selenoid/chrome:81.0",
                "env": [
                    "NODE_MAX_SESSION", "1",
                    "NODE_MAX_INSTANCES", "1",
                    "SCREEN_WIDTH", "1920",
                    "SCREEN_HEIGHT", "1080",
                    "SCREEN_DEPTH", "24",
                    "DBUS_SESSION_BUS_ADDRESS", "/dev/null"
                ],
                "port": "4444",
                "tmpfs": {
                    "/tmp": "size=512m"
                }
            },
            "81_vnc": {
                "image": "selenoid/vnc:chrome_81.0",
                "env": [
                    "NODE_MAX_SESSION", "1",
                    "NODE_MAX_INSTANCES", "1",
                    "SCREEN_WIDTH", "1920",
                    "SCREEN_HEIGHT", "1080",
                    "SCREEN_DEPTH", "24",
                    "DBUS_SESSION_BUS_ADDRESS", "/dev/null"
                ],
                "port": "4444",
                "tmpfs": {
                    "/tmp": "size=512m"
                }
            }
        }
    }
}
于 2020-04-27T05:58:15.303 回答