February 18, 2017

[SOLVED]Error response status: 6 Selenium error: no such session (Chrome selenium tests on gitlab runner)

Selenium tests with chrome on gitlab gave me this error "Error response status: 6 Selenium error: no such session". I order to fix it

Install virtual display
apt-get install -qq -y xvfb

#try to fool google-chrome to run without sandbox
mv /usr/bin/google-chrome /usr/bin/google-chrome-orig \
    && echo '#!/bin/bash' > /usr/bin/google-chrome \
    && echo '/usr/bin/google-chrome-orig --no-sandbox --disable-setuid-sandbox --allow-sandbox-debugging "$@"' >> /usr/bin/google-chrome  \
    && chmod +x /usr/bin/google-chrome

Before starting your test start virtual display
Xvfb :0 -ac +extension RANDR -screen 0 1366x768x24 &

than run your test in
xvfb-run polymer test -l chrome

Make your own or use my docker image
https://hub.docker.com/r/printminion/polymer-tester/

Example dockerfile: https://github.com/printminion/polymer-tester/blob/master/Dockerfile


Error:
(node:4444) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Installing and starting Selenium server for local browsers
Selenium server running on port 38917
Web server running on port 2000 and serving from /builds/printminion-group/canvas-editor-base
chrome 56                Tests failed: {"message":"[get(\"http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0\")] Error response status: 6 Selenium error: no such session\n  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 38 milliseconds\nBuild info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'\nSystem i...
Test run ended in failure: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c

chrome 56 (error)                    

Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c

error:   cli runtime exception: Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c
error:   Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c
    at /usr/local/lib/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:151:27
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:103:7)
ERROR: Build failed: exit code 1