Unable to run Headless Chrome Browser on Linux Machine using Selenium Webdriver java

1,189 views
Skip to first unread message

Ajay Chandra

unread,
Dec 28, 2017, 6:06:37 AM12/28/17
to Selenium Users

Used Selenium Webdriver(V2.29), selenium-api version(3.4.0), Chrome Version (62.0.3202.9464 bit and tried to run chrome browser in linux machine with the below code.

    WebDriver driver;
    String chromeBinaryPath = "/data/Package/CHROME_NEW";
    String driverPath = "/data/Package/Selenium/WebDrivers/ChromeDrivers/chromedriver_linux32/chromedriver";

    System.setProperty("webdriver.chrome.driver", driverPath);
    System.setProperty("webdriver.chrome.verboseLogging","true");
    System.setProperty("webdriver.chrome.logfile","/data/Package/log/chromedriver.log");


    ChromeOptions optionsLinux64 = new ChromeOptions();

    optionsLinux64.setBinary(chromeBinaryPath);
    optionsLinux64.addArguments("--headless");
    optionsLinux64.addArguments("--no-sandbox");
    optionsLinux64.addArguments("--disable-gpu");
    optionsLinux64.addArguments("--headless");

    driver = new ChromeDriver(optionsLinux64);

When tried to create a chrome session, getting below exception:

unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.10 seconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'el4014.bc', ip: '10.120.94.70', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.5.2.el7.x86_64', java.version: '1.8.0_151' Driver info: driver.version: ChromeDriver

Installed Chrome at /data/Package/CHROME_NEW folder using rpm file.

Message in chromedriver.log:

[0.204][DEBUG]: DevTools request: http://localhost:12111/json/version
LaunchProcess: failed to execvp:
/data/Package/CHROME_NEW/
[0.379][DEBUG]: DevTools request failed

Can anyone help me in resolving with the above issue.

⇜Krishnan Mahadevan⇝

unread,
Dec 28, 2017, 6:09:04 AM12/28/17
to Selenium Users
What happens when you try again using Selenium 3.8.1 ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d9672b93-8c42-4108-933a-5db09745f908%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ajay Chandra

unread,
Dec 29, 2017, 1:32:56 AM12/29/17
to Selenium Users
Tried using Selenium 3.8.1 and chrome driver 2.34 , getting same below errors.

⇜Krishnan Mahadevan⇝

unread,
Dec 29, 2017, 1:43:38 AM12/29/17
to Selenium Users
I know you mentioned "Same errors", but it would still be great, if you could share the complete stacktrace when you used Selenium 3.8.1 in conjunction with chromedriver 2.34

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

Ajay Chandra

unread,
Dec 29, 2017, 2:04:34 AM12/29/17
to Selenium Users
Stacktrace information:

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64) (WARNING: The server did not provie any stacktrace information)
Command duration or timeout: 60.07 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'el4014.bc', ip: '10.120.94.70', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.5.2.el7.x86_64', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
        at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
        at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
        at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)

Is this the one you are asking?

On Thursday, December 28, 2017 at 4:36:37 PM UTC+5:30, Ajay Chandra wrote:

Krishnan Mahadevan

unread,
Dec 29, 2017, 10:09:15 AM12/29/17
to seleniu...@googlegroups.com

Ok, just to check if your installation is all fine (Chrome installation and Chromedriver setup), can you please do the following on your linux machine ?

 

  1. Open up a command terminal and type: “chromedriver” . This should basically show you a terminal that looks like[1]
2.  Open up another command terminal and type:  curl -X POST http://0.0.0.0:9515/session -d '{"desiredCapabilities":{"browserName":"chrome","goog:chromeOptions":{"args":["--headless", "disable-gpu"]}}}'

This should basically show you a terminal that looks like [2]

 

[1] - Terminal output

Starting ChromeDriver 2.34.522913 (36222509aa6e819815938cbf2709b4849735537c) on port 9515

Only local connections are allowed.

[2] - Terminal output

curl -X POST http://0.0.0.0:9515/session -d '{"desiredCapabilities":{"browserName":"chrome","goog:chromeOptions":{"args":["--headless", "disable-gpu"]}}}'

{"sessionId":"9b2a946c039085399229ac5376e44687","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.34.522913 (36222509aa6e819815938cbf2709b4849735537c)","userDataDir":"/tmp/.org.chromium.Chromium.fI40F8"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Linux","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"63.0.3239.108","webStorageEnabled":true}}

 

If you don’t see both, then you first need to sort out your chrome browser installation and your chromedriver path.

 

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1b906ccf-8e73-4fc4-9c2f-3a98d1e819ff%40googlegroups.com.

Ajay Chandra

unread,
Jan 1, 2018, 1:28:44 AM1/1/18
to Selenium Users
I have tried executing the below commands as you suggested and got the below output.

{"message":"unknown error: cannot find Chrome binary\n  (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64)"}}

Hence I have passed binary location in the request 

Request: curl -X POST http://0.0.0.0:9515/session -d '{"desiredCapabilities":{"browserName":"chrome","goog:chromeOptions":{"args":["--headless", "disable-gpu"],"binary":"/data/Package/CHROME_NEW"}}}'

Response: {"sessionId":"4c62ded584afc51b08fd55be7568c88c","status":13,"value":{"message":"unknown error: Chrome failed to start: exited abnormally\n  (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64)"}}

Same error I could see here too. Can you please help me to proceed further.

Thanks!

On Thursday, December 28, 2017 at 4:36:37 PM UTC+5:30, Ajay Chandra wrote:
Reply all
Reply to author
Forward
0 new messages