t.me/atinfo_chat Telegram группа по автоматизации тестирования

Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/root/.m2/repository/webdriver/chromedriver/linux64/81.0.4044.20/chromedriver" (in directory "."): error=2, No such file or directory)

docker
selenoid
java
selenide
webdriver
Теги: #<Tag:0x00007fb2f621f3a8> #<Tag:0x00007fb2f621f240> #<Tag:0x00007fb2f621f100> #<Tag:0x00007fb2f621efc0> #<Tag:0x00007fb2f621ee80>

(Назар Маслій) #1

Sorry guys, I’ll try to explain my problem on English if you don’t mind.
Tets are running in docker container with selenoid

Code example:

compose file: 
version: '3'
services:
  selenoid:
    image: "aerokube/selenoid:latest"
    container_name: selenoid
    ports:
      - "4445:4444"
    networks:
      - selenoid
    volumes:
      - ".:/etc/selenoid"
      - "./target:/output"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./target:/opt/selenoid/video"
    environment:
      - "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
    command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "selenoid"]
  selenoid-ui:
    image: "aerokube/selenoid-ui:latest"
    container_name: selenoid-ui
    links:
      - selenoid
    ports:
      - "8083:8080"
    networks:
      - selenoid
    command: ["--selenoid-uri", "http://selenoid:4444"]
  chrome_79.0:
    image: "selenoid/vnc:chrome_79.0"
    container_name: chrome_79.0
    links:
      - selenoid
      - selenoid-ui
    depends_on:
      - selenoid
      - selenoid-ui
    networks:
      - selenoid
    volumes:
      - "/dev/shm:/dev/shm"
  test:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: selenoid_test
    depends_on:
      - selenoid
      - selenoid-ui
      - chrome_79.0
    networks:
      - selenoid
    volumes:
#      - "./target:/tmp/target"
      - "./allure-results:/tmp/allure-results"
      - "./logs:/tmp/logs"
networks:
  selenoid:
    external:
      name: selenoid

browsers.json:

{
  "firefox": {
    "default": "72.0",
    "versions": {
      "72.0": {
        "image": "selenoid/vnc:firefox_72.0",
        "port": "4444",
        "env": [
          "TZ=Europe/Kiev"
        ]
      }
    }
  },
  "chrome": {
    "default": "79.0",
    "versions": {
      "79.0": {
        "image": "selenoid/vnc:chrome_79.0",
        "port": "4444"
      }
    }
  }
}

method for set configs for selenide browser:

private static void setUpSelenoid() {
        log.info("Set up starts");
        final DesiredCapabilities capabilities = new DesiredCapabilities();
        String path = System.getProperty("FILE_PATH");
        Configuration.remote = "http://selenoid:4444/wd/hub";
        Configuration.browser = "chrome";
        Configuration.browserVersion = "79.0";
        Configuration.browserCapabilities = capabilities;
        capabilities.setCapability("enableVNC", true);
        capabilities.setCapability("enableVideo", false);
        Configuration.startMaximized = true;
        Configuration.browserSize = "1920x1080";
    }

Logs:

[INFO ] | 2020-02-20 22:21:14 | wdm.WebDriverManager (WebDriverManager.java:904) - Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
selenoid_test  | [INFO ] | 2020-02-20 22:21:16 | wdm.WebDriverManager (WebDriverManager.java:807) - Latest version of chromedriver is 81.0.4044.20
selenoid_test  | [INFO ] | 2020-02-20 22:21:16 | wdm.Downloader (Downloader.java:125) - Downloading https://chromedriver.storage.googleapis.com/81.0.4044.20/chromedriver_linux64.zip
selenoid_test  | [INFO ] | 2020-02-20 22:21:17 | wdm.Downloader (Downloader.java:180) - Extracting binary from compressed file chromedriver_linux64.zip
selenoid_test  | [INFO ] | 2020-02-20 22:21:17 | wdm.WebDriverManager (WebDriverManager.java:939) - Exporting webdriver.chrome.driver as /root/.m2/repository/webdriver/chromedriver/linux64/81.0.4044.20/chromedriver

Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/root/.m2/repository/webdriver/chromedriver/linux64/81.0.4044.20/chromedriver" (in directory "."): error=2, No such file or directory)

If I run tests on local machine everything works fine:

java
Logs:
[INFO ] | 2020-02-21 00:46:13 | wdm.WebDriverManager (WebDriverManager.java:551) - Using chromedriver 80.0.3987.106 (since Google Chrome 80 is installed in your machine)
[INFO ] | 2020-02-21 00:46:14 | wdm.WebDriverManager (WebDriverManager.java:939) - Exporting webdriver.chrome.driver as /Users/nazar/.m2/repository/webdriver/chromedriver/mac64/80.0.3987.106/chromedriver
[INFO ] | 2020-02-21 00:46:14 | wdm.WebDriverManager (WebDriverManager.java:939) - Exporting webdriver.chrome.driver as /Users/nazar/.m2/repository/webdriver/chromedriver/mac64/80.0.3987.106/chromedriver
[INFO ] | 2020-02-21 00:46:14 | wdm.WebDriverManager (WebDriverManager.java:939) - Exporting webdriver.chrome.driver as /Users/nazar/.m2/repository/webdriver/chromedriver/mac64/80.0.3987.106/chromedriver
StartiStaSrting nCtarhg Chrrting ChromeDrivero 8momeDriver 80.0.3987.106 e0.0.398Dr7.106 ((fi680f6v965er 807.406.03992380695708c4609230cf9b635cd784cfb1bf81f7.19b606 (bb5f6806953743609230cf9b6355ca-refs/bradcd78748c4nfb1bf81bb53a-refs/brcach-nfchh-hb1bfeaeds8/a3987@{#882}) 1onds/3987@{#8 pobb5r82}t 23100
3a-refs/branOnly local connections are a)lclowed.
Please prote ct ports used by ChromeDrih-heads/3987@{#882}) on pvort 46692
Only local connections are allowed.

Software:
macOS Catalina version 10.15.1
Docker version 2.2.0.0