Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

The error is:

unknown error: Chrome failed to start: exited abnormally   (Driver info: chromedriver=2.9.248316,platform=Linux 3.2.0-4-686-pae x86) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.55 seconds Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17' System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-4-686-pae', java.version: '1.7.0_25' Driver info: org.openqa.selenium.chrome.ChromeDriver

I have chromedriver 29 with chrome 34.0.1847.76 beta running on Debian 7 32 bits. I am using selenium-java 2.33.0

Following this link, chromedriver 29 is the right version for chrome 34. And anyway, previous versions do not work on Debian 7 because of glibc version …

----------ChromeDriver v2.9 (2014-01-31)---------- Supports Chrome v31-34

[update 1]

I tried with with both java 7 and java 6, still the same problem. May be I should try with java 8 ^^

[update 2]

I am using this command to test the chrome driver, to make sure that is not an issue with jenkins:

curl -X POST -H "Content-Type: application/json; charset=utf-8" -d "{\"desiredCapabilities\":{\"platform\":\"ANY\",\"browserName\":\"chrome\",\"chromeOptions\":{\"args\":[],\"extensions\":[]},\"version\":\"\",\"chrome.switches\":[]}}" localhost:12495/session

I am getting the same error message:

{"sessionId":"210f3f837a798ee68cd91f089976d0c2","status":13,"value":{"message":"unknown error: Chrome failed to start: exited abnormally\n (Driver info: chromedriver=2.9.248316,platform=Linux 3.2.0-4-686-pae x86)"}}

Any help to know what is going on would be appreciated.

Thanks

I finally managed to get Selenium tests starting the Chrome Driver on my laptop (server).

The important bit is to use Xvfb. Don't ask me why but once you accept this fact follow these steps (more detailed than @Anon answer)

  • In you Jenkins settings add a global property

    key : DISPLAY
    value:0:0
    
  • On your server start Xvfb in the background:

     Xvfb :0 -ac -screen 0 1024x768x24 &
                    Thanks for the help! Also, a note that would have helped me: Setting global variables is done via "Manage Jenkins -> Configure System -> Global Properties"
    – Robert Townley
                    Jul 11, 2017 at 18:24
                    Xvfb provides for a virtual display to render the browser onto. Possibly running tests in headless mode could also mitigate the need of rendering the browser that selenium otherwise spawns onto the virtual display.
    – Leo
                    Apr 17, 2018 at 13:52
                    so this comes closest to my error. I voided my X11 session by ssh localhost ing to update  my groups without restarting the X-Session. Persistently firefox and chrome failed in a similar way.
    – dothebart
                    Mar 7, 2021 at 12:01
                    I am not trying to execute the tests in headless mode because I am using a laptop and I have set the screen to stay on even when the lid is closed. But may be I should try in headless mode?
    – redochka
                    Mar 26, 2014 at 10:57
                    Was having this problem on a headless server, making sure DISPLAY was set correctly fixed my problem! Thanks!
    – sbditto85
                    Apr 2, 2014 at 14:09
    
  • Check that you use ChromeDriver version that corresponds to your Chrome version
  • In case you are on Linux without graphical interface "headless" mode must be used
  • Example of WebDriverSettings.java :

    ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("prefs", chromePrefs); options.addArguments("--no-sandbox"); options.addArguments("--headless"); //!!!should be enabled for Jenkins options.addArguments("--disable-dev-shm-usage"); //!!!should be enabled for Jenkins options.addArguments("--window-size=1920x1080"); //!!!should be enabled for Jenkins driver = new ChromeDriver(options);

    I was trying to run selenium on Jenkins with Mocha framework using wdio. So following are the steps to solve this issue:-

    Install google chrome

    sudo apt-get update 
    sudo apt-get install google-chrome-stable
    

    Install chrome-driver

    wget http://chromedriver.storage.googleapis.com/2.23/chromedriver_linux64.zip
    unzip chromedriver_linux64.zip
    

    Run following commands to start selenium web server

    nohup sudo Xvfb :10 -ac
    export DISPLAY=:10
    java -jar vendor/se/selenium-server-standalone/bin/selenium-server-standalone.jar -Dwebdriver.chrome.bin="/usr/bin/google-chrome" -Dwebdriver.chrome.driver="vendor/bin/chromedriver"
    

    After this start you tests with wdio command

    wdio wdio.conf.js
    

    The Mike R's solution works for me. This is the full set of commands:

    Xvfb :99 -ac -screen 0 1280x1024x24 &
    export DISPLAY=:99
    nice -n 10 x11vnc 2>&1 &
    

    Later you can run google-chrome:

    google-chrome --no-sandbox &
    

    Or start google chrome via selenium driver (for example):

    ng e2e --serve true --port 4200 --watch true
    

    Protractor.conf file:

    capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {
            'args': ['no-sandbox']
                    xvfb is a virtual screen somehow it helps if you use terminal only: en.wikipedia.org/wiki/Xvfb
    – changtung
                    Sep 11, 2017 at 8:24
                    "somehow" is because a browser is a graphical application that requires a display to render anything
    – Corey Goldberg
                    Mar 21, 2018 at 14:53
    

    Passing no-sandbox to exec seems important for jenkins on windows in foreground or as service. Here's my solution

    chromedriver fails on windows jenkins slave running in foreground

    I had use no-sandbox while using chrome in a docker container in headless mode (selenium-webdriver 3 & Ruby on Rails). – a2f0 Oct 18, 2017 at 19:37 Running it as root doesn't work unless you use --no-sandbox and many Docker containers run things as root, and some (scarily configured) Jenkins nodes may use root as well. Another option you can add is --headless which helps avoid the need for Xvfb entirely. You may also need --disable-dev-shm-usage specifically in Docker, or you need to bind mount that device in your run with --mount type=bind,source=/dev/shm,target=/dev/shm. – dragon788 Dec 13, 2019 at 22:07 chrome_options = Options() chrome_options.add_argument("--disable-extensions") chrome_options.add_argument("--disable-gpu") chrome_options.add_argument("--no-sandbox") driver = webdriver.Chrome(options=chrome_options) driver.get("www.counterviews.online") no sandbox was the issue as chromedriver does not allow running in sudo in linux without that comman – PDHide Aug 30, 2021 at 13:41

    We had the same issue while trying to launch Selenium tests from Jenkins. I had selected the 'Start Xvfb before the build, and shut it down after' box and passed in the necessary screen options, but I was still getting this error.

    It finally worked when we passed in the following commands in the Execute Shell box.

    Xvfb :99 -ac -screen 0 1280x1024x24 & nice -n 10 x11vnc 2>&1 & killall Xvfb

    I am running a similar setup: Selenium 3.40, Chrome 61, chromedriver 2.33 running with xvfb on ubuntu 16.04.

    I was getting the same Chrome error intermittently. It seems that sometimes, the chromedriver fails to cleanup the temp files associated with the Chrome profile.

    A workaround for me is to cleanup the temp files before running tests:

    rm -rf /tmp/.org.chromium.Chromium*
    

    I expect this will be resolved in future versions of chromedriver, but for now this solves the problem in my case.

    I've been fighting with this issue for a long time, and just y'day I figure out how to make it gone and today I can run a 50 threads process calling selenium without seen this issue anymore and also stop crashing my machine with outofmemory issue with too many open chromedriver processes.

  • I am using selenium 3.7.1, chromedrive 2.33, java.version: '1.8.0', redhat ver '3.10.0-693.5.2.el7.x86_64', chrome browser version: 60.0.3112.90;
  • running an open session with screen, to be sure my session never dies,
  • running Xvfb : nohup Xvfb -ac :15 -screen 0 1280x1024x16 &
  • export DISPLAY:15 from .bashsh/.profile
  • these 4 items are the basic setting everyone would already know, now comes the code, where all made a lot of difference to achieve the success:

    public class HttpWebClient {
        public static ChromeDriverService service;
        public ThreadLocal<WebDriver> threadWebDriver = new ThreadLocal<WebDriver>(){
        @Override
        protected WebDriver initialValue() {
            FirefoxProfile profile = new FirefoxProfile();
            profile.setPreference("permissions.default.stylesheet", 2);
            profile.setPreference("permissions.default.image", 2);
            profile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so", "false");
            profile.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE, "localhost");
            WebDriver driver = new FirefoxDriver(profile);
            return driver;
    public HttpWebClient(){
        // fix for headless systems:
        // start service first, this will create an instance at system and every time you call the 
        // browser will be used
        // be sure you start the service only if there are no alive instances, that will prevent you to have 
        // multiples chromedrive instances causing it to crash
            if (service==null){
                service = new ChromeDriverService.Builder()
                .usingDriverExecutable(new File(conf.get("webdriver.chrome.driver"))) // set the chromedriver path at your system
                .usingAnyFreePort()
                .withEnvironment(ImmutableMap.of("DISPLAY", ":15"))
                .withSilent(true)
                .build();
                service.start();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
    // my Configuration class is for good and easy setting, you can replace it by using values instead.
    public WebDriver getDriverForPage(String url, Configuration conf) {
        WebDriver driver = null;
        DesiredCapabilities capabilities = null;
        long pageLoadWait = conf.getLong("page.load.delay", 60);
        try {
                System.setProperty("webdriver.chrome.driver", conf.get("webdriver.chrome.driver"));
                String driverType = conf.get("selenium.driver", "chrome");
            capabilities = DesiredCapabilities.chrome();
            String[] options = new String[] { "--start-maximized", "--headless" };
            capabilities.setCapability("chrome.switches", options);
                        // here is where your chromedriver will call the browser
                        // I used to call the class ChromeDriver directly, which was causing too much problems 
                        // when you have multiple calls
            driver = new RemoteWebDriver(service.getUrl(), capabilities);
            driver.manage().timeouts().pageLoadTimeout(pageLoadWait, TimeUnit.SECONDS);
            driver.get(url);
                        // never look back
        } catch (Exception e) {
            if (e instanceof TimeoutException) {
                LOG.debug("Crawling URL : "+url);
                LOG.debug("Selenium WebDriver: Timeout Exception: Capturing whatever loaded so far...");
                return driver;
            cleanUpDriver(driver);
            throw new RuntimeException(e);
        return driver;
    public void cleanUpDriver(WebDriver driver) {
        if (driver != null) {
            try {
                                // be sure to close every driver you opened
                driver.close();
                driver.quit();
                //service.stop(); do not stop the service, bcz it is needed
                TemporaryFilesystem.getDefaultTmpFS().deleteTemporaryFiles();
            } catch (Exception e) {
                throw new RuntimeException(e);
    

    Good luck and I hope you don't see that crash issue anymore

    Please comment your success

    Best regards,

    Exporting the DISPLAY variable is definitely the solution but depending on your setup you may have to do this in a slightly different way.

    In my case, I have two different processes: the first one starts Xvfb, the other one launches the tests. So my shell scripting knowledge is a bit rusty but I figured out that exporting the DISPLAY variable from the first process didn't make it available in the second process.

    Fortunately, Selenium WebDriver allows you to 'redefine' your environment. This is my function for creating a driver for Chrome in JS. Pretty sure the equivalent exists for your programming language:

    const caps = require('selenium-webdriver/lib/capabilities');
    const chrome = require('selenium-webdriver/chrome');
    const chromedriver = require('chromedriver');
    module.exports = function (cfg) {
        let serviceBuilder = new chrome.ServiceBuilder(chromedriver.path);
        let options = chrome.Options.fromCapabilities(caps.Capabilities.chrome());
        let service;
        let myENV = new Map();
        // 're-export' the `DISPLAY` variable
        myENV.set('DISPLAY', ':1');
        serviceBuilder.setEnvironment(myENV);
        service = serviceBuilder.build();
        options.addArguments('disable-setuid-sandbox');
        options.addArguments('no-sandbox');
        options.addArguments('allow-insecure-localhost');
        options.excludeSwitches('test-type');
        return chrome.Driver.createSession(options, service);
                    You can execute your xvfb starting script in current shell context environment (stackoverflow.com/questions/16618071/…):   . xvfb.sh
    – Mcmil
                    Jun 23, 2017 at 6:23
    

    I had simillar issue with maven tests on x86 linux which i was using in terminal. I was logging in to linux by ssh. I started my java selenium tests by

    mvn -DargLine="-Dbaseurl=http://http://127.0.0.1:8080/web/" install
    

    Excepting my app, after running these tests I received error in logs:

    unknown error: Chrome failed to start: exited abnormally
    

    I was running these tests as root user. Before this error i received that ChromeDriver is nor present. I moved forward with this by installing ChromeDriver binary and adding it to PATH. But then i had to install google-chrome browser - ChromeDriver alone isn't enough to run tests. So the mistake is problem maybe with screen buffer in terminal window, but You can install Xvfb which is virtual screen buffer. What is important, that you should run your tests not as root, because you may receive another Chrome Browser error. So no as root i run:

    export DISPLAY=:99
    Xvfb :99 -ac -screen 0 1280x1024x24 &
    

    What is important here, that in my case the number related to DISPLAY ought to be same as Xvfb :NN parameter. 99 in that case. I had another problem because i ran Xvfb with another DISPLAY value and I wanted it to stop. In order to restart Xvfb:

    ps -aux | grep Xvfb
    kill -9 PID
    sudo rm /tmp/.X11-unix/X99
    

    So find a process PID with grep. Kill Xvfb process. And then there is lock in /tmp/.X11-unix/XNN , so delete this lock and you can start server again. If You run not as root, set simillar displays, install google-chrome then with maven you can start selenium tests. My tests went fine with these rules and operations.

    Not sure if this is stopping everyone else, but I resolved this by upgrading chromedriver and then ensuring that it was in a place that my user could read from (it seems like a lot of people encountering this are seeing it for permission reasons like me).

    On Ubuntu 16.04: 1. Download chromedriver (version 2.37 for me) 2. Unzip the file 3. Install it somewhere sensible (I chose /usr/local/bin/chromedriver)

    Doesn't even need to be owned by my user as long as it's globally executable (sudo chmod +x /usr/local/bin/chromedriver)

    In my Ubuntu server, following solve the issue

    Xvfb :11 -ac -screen 0 1024x768x24 &
    export DISPLAY=:11
    python selenium_test.py
    killall Xvfb 
    

    dont use the last line if you have multiple Xvfb process are running at the same time.

  •