Chrome run selenium null

selenium
docker

#1

Hi all!

I link https://hub.docker.com/r/selenium/standalone-chrome/

to my build image run tests and get error

DATA {“script”:“return (function () {\n return window._rendered;\n }).apply(null, arguments);”,“args”:[]}
[08:32:47] RESULT null
[08:32:48] COMMAND POST “/wd/hub/session/713822af-dbac-4eca-8f83-a1c221ae520a/execute”
[08:32:48] DATA {“script”:“return (function () {\n return window._rendered;\n }).apply(null, arguments);”,“args”:[]}
[08:32:48] RESULT null

Seems Chrome could run sessions correctly, what I do wrong?


#2

Seems Chrome could not start.

xvfb is running and webdriver could start chrome normally.

The main question: Why?


#3

You may have an incompatible version. Browser testing is extremely complex.

Do any of our browser images work for you?
https://circleci.com/docs/2.0/circleci-images/


#4

04:14:56.387 INFO - Selenium build info: version: ‘3.3.1’, revision: '5234b32’
04:14:56.387 INFO - Launching a standalone Selenium Server
2017-04-26 04:14:56.404:INFO::main: Logging initialized @215ms to org.seleniumhq.jetty9.util.log.StdErrLog
04:14:56.449 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
04:14:56.450 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
04:14:56.450 INFO - Driver class not found: com.opera.core.systems.OperaDriver
04:14:56.450 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
04:14:56.450 INFO - Driver class not found: com.opera.core.systems.OperaDriver
04:14:56.450 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
04:14:56.451 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
2017-04-26 04:14:56.483:INFO:osjs.Server:main: jetty-9.2.20.v20161216
2017-04-26 04:14:56.518:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@604ed9f0{/,null,AVAILABLE}
2017-04-26 04:14:56.532:INFO:osjs.AbstractConnector:main: Started ServerConnector@6fd02e5{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-04-26 04:14:56.533:INFO:osjs.Server:main: Started @344ms
04:14:56.533 INFO - Selenium Server is up and running

I need Chrome latest version.

xvfb and Chrome installed on build image where I am pack project.

Google Chrome 58.0.3029.81 from official Google Chrome repo

Run xvfb command…

echo “Starting X virtual framebuffer (Xvfb) in background…” &&
Xvfb -ac :99 -screen 0 1280x1024x16 & sleep 3 &&
export DISPLAY=:99 && \

Maybe in wdio.conf.js wrong?

desiredCapabilities: {
browserName: process.env.BROWSER || ‘chrome’,
chromeOptions: {
forceDevToolsScreenshot: true,
args: [’–no-sandbox’]
prefs: {
‘download.default_directory’: __dirname + ‘/tmp/test/download’,
‘download.prompt_for_download’: false
}
}
},


#5

Full stack trace error…

[18:46:33]  SET SESSION ID 364f1d6a-ce6b-4d0f-95b3-73e336c13de3
[18:46:33]  RESULT		 {"networkConnectionEnabled":true,"webdriver.remote.sessionid":"364f1d6a-ce6b-4d0f-95b3-73e336c13de3","locationContextEnabled":true,"webStorageEnabled":true,"takesScreenshot":true,"javascriptEnabled":true,"message":"unknown error: Chrome failed to start: exited abnormally\n  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-53-generic x86_64)","hasTouchScreen":true,"platform":"ANY","cssSelectorsEnabled":true}
[18:46:33]  COMMAND	POST 	 "/wd/hub/session/364f1d6a-ce6b-4d0f-95b3-73e336c13de3/timeouts/async_script"
[18:46:33]  DATA		 {"ms":240000}
[18:46:33]  INFO	Retry #1
[18:46:33]  ERROR	ServerError	no such session
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-53-generic x86_64) (WARNING: The server did not provide any stacktrace information)

[18:46:33]  INFO	Retry #2
[18:46:33]  ERROR	ServerError	no such session
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-53-generic x86_64) (WARNING: The server did not provide any stacktrace information)

[18:46:33]  INFO	Gave up after 3 tries
ERROR: no such session
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-53-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: '5beac6ce1414', ip: '172.17.0.5', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-53-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-53-generic x86_64), platform=ANY}]
Session ID: 23db7dc2e799af36383fe5b816a2eb81

Error
    at new ErrorHandler.RuntimeError (/app/node_modules/webdriverio/lib/utils/ErrorHandler.js:93:12)
    at Request._callback (/app/node_modules/webdriverio/lib/utils/RequestHandler.js:59:33)
    at Request.self.callback (/app/node_modules/webdriverio/node_modules/request/request.js:373:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:194:7)
    at Request.<anonymous> (/app/node_modules/webdriverio/node_modules/request/request.js:1318:14)
    at emitOne (events.js:101:20)
    at Request.emit (events.js:191:7)
    at IncomingMessage.<anonymous> (/app/node_modules/webdriverio/node_modules/request/request.js:1266:12)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:975:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

[18:46:33]  COMMAND	DELETE 	 "/wd/hub/session/364f1d6a-ce6b-4d0f-95b3-73e336c13de3"
[18:46:33]  DATA		 {}
[18:46:33]  RESULT		 null
Kill Server
Send kill signal
Server exited with code null
Server Exited

Exited with code 1

#6

Also i try more new version…

nohup Xvfb -ac :99 -screen 0 1280x1024x16 +extension RANDR > /dev/null 2>&1 &

export DISPLAY=:99

Before running Selenium also do up commands.

[11:28:36]  SET SESSION ID 7018f9eb-8a98-4f2c-b77a-792e39747e29
[11:28:36]  RESULT		 {"networkConnectionEnabled":true,"webdriver.remote.sessionid":"7018f9eb-8a98-4f2c-b77a-792e39747e29","locationContextEnabled":true,"webStorageEnabled":true,"takesScreenshot":true,"javascriptEnabled":true,"message":"unknown error: Chrome failed to start: exited abnormally\n  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-53-generic x86_64)","hasTouchScreen":true,"platform":"ANY","cssSelectorsEnabled":true}
[11:28:36]  COMMAND	POST 	 "/wd/hub/session/7018f9eb-8a98-4f2c-b77a-792e39747e29/timeouts/async_script"
[11:28:36]  DATA		 {"ms":240000}
[11:28:36]  INFO	Retry #1
[11:28:36]  ERROR	ServerError	no such session
  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-53-generic x86_64) (WARNING: The server did not provide any stacktrace information)

[11:28:37]  INFO	Retry #2
[11:28:37]  ERROR	ServerError	no such session
  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-53-generic x86_64) (WARNING: The server did not provide any stacktrace information)

[11:28:37]  INFO	Gave up after 3 tries
ERROR: no such session
  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-53-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: '23a523cb6edc', ip: '172.17.0.5', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-53-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-53-generic x86_64), platform=ANY}]
Session ID: a9f5eb5ab37f7bdf5c6a28fc6e947f23

Too long with no output
#7

Have you modified Chrome to start in headless mode?


#8

Hi! Not try, add new option.

 desiredCapabilities: {
    browserName: process.env.BROWSER || 'chrome',
    chromeOptions: {
      args: [
           // '--enable-logging',
            '--headless',
            '--no-sandbox',
          ],
      prefs: {
        'download.default_directory': __dirname + '/tmp/test/download',
        'download.prompt_for_download': false
      }
    }

add headless and commit, must whait…


#9

Wooohooo, work, thx.

But I have another error…

[19:10:38]  DATA		 {"value":["s","i","m","u","l","a","t","i","o","n"]}
[19:10:38]  INFO	Retry #1
[19:10:38]  ERROR	ServerError	unknown error: an X display is required for keycode conversions, consider using Xvfb
[19:10:38]  INFO	Retry #2
[19:10:38]  ERROR	ServerError	unknown error: an X display is required for keycode conversions, consider using Xvfb
[19:10:38]  INFO	Gave up after 3 tries

How to fix this?


#10

I think this is your problem now:

nohup Xvfb -ac :99 -screen 0 1280x1024x16 +extension RANDR > /dev/null 2>&1 &

Try this instead:

- run:
    command: Xvfb -ac :99 -screen 0 1280x1024x16 +extension RANDR > /dev/null 2>&1
    background: true

#11

How to do right exec this command in build image?


#12

I’d first try the same thing I just posted but with a docker exec


#13

Hi! Like this?

docker exec idg sh -c "- run:
    command: Xvfb -ac :99 -screen 0 1280x1024x16 +extension RANDR > /dev/null 2>&1
    background: true"

#14
/bin/sh: syntax error: unterminated quoted string
Exited with code 2

Here is error.


#15

still not working :frowning:


#16

Hello,

You should download the chromeDriver in a folder, and add this folder in your PATH variable. You’ll have to restart your console to make it works.

public class Chrome {

 public static void main(String[] args) {

    System.setProperty("webdriver.chrome.driver", "E://chromedriver.exe");
    WebDriver driver = new ChromeDriver();              
    driver.get("http://www.google.com");

 }

}

Initialize your driver object in the following manner - Selenium

System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");

WebDriver driver = new ChromeDriver();

By doing this the chrome driver works properly.

Thanks


#17

The problem is actual, xvfb run, selenium run, chromedriver last, chrome last…

Parallel testing not working!


#18

No it’d be

docker exec idg sh -c "command: Xvfb -ac :99 -screen 0 1280x1024x16 +extension RANDR > /dev/null 2>&1"

You can’t just shove the YAML syntax into a shell and expect it to work :frowning:


#19

Hi!

I remove docker container and base image alpine…

my build.

https://circleci.com/gh/dmapper/idg/804


#20

https://circleci.com/gh/dmapper/idg/815

Also i try to move debian base image, also not working (((

Please, help!