Tuesday, March 15, 2022

[SOLVED] WCT is not able to detect google chrome browser in Redhat Linux

Issue

WCT is not able to detect google chrome browser in Redhat Linux when running

polymer test --skip-selenium-install

and is throwing below error:

cli runtime exception: Error: {"value":{"stacktrace":"org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed\n  (Driver info: chromedriver\u003d2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform\u003dLinux 3.10.0-693.21.1.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 60.11 seconds\nBuild info: version: \u00273.8.1\u0027, revision: \u00276e95a6684b\u0027, time: \u00272017-12-01T19:05:32.194Z\u0027\nSystem info: host: \u0027user-docker\u0027, ip: \u0027172.18.0.2\u0027, os.name: \u0027Linux\u0027, os.arch: \u0027amd64\u0027, os.version: \u00273.10.0-693.21.1.el7.x86_64\u0027, java.version: \u00271.8.0_162\u0027\nDriver info: driver.version: unknown\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at next (native)
    at fulfilled (/home/user/IdeaProjects/project/node_modules/web-component-tester/runner/steps.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:109:7)

We are working in docker containers

I tried below and none of them are working

  1. polymer test --local chrome

  2. sudo ln -s /usr/bin/google-chrome-stable /usr/bin/google-chrome

  3. export LAUNCHPAD_CHROME=/usr/bin/google-chrome-stable


Version information:

Redhat 7.3
Polymer: v2.0.0
webcomponents: v1.0.0
polymer-cli: 1.5.6


I've opened github issue


Solution

I've tried to debug further and found that we are not able to launch google-chrome in docker container which is throwing an error Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted Trace/breakpoint trap (core dumped).

So while investigating the issue I found that there was an issue in chrome which prevents chrome to startup in docker environment. run google chrome headless in docker.

With all these options now I managed to resolve this issue.

I'm using configuration file for WCT and passing the --no-sandbox option in config file.

So now WCT is launching google-chrome

My wct.conf.json file is

{
  "plugins": {
    "local": {
      "browsers": [
        "chrome"
      ],
      "browserOptions": {
        "chrome": [
          "--no-sandbox"
        ]
      }
    }
  }
}


Answered By - Gangadhar JANNU
Answer Checked By - Clifford M. (WPSolving Volunteer)