9

What I'm trying to achieve Successfully run my protractor tests on headless chrome on Ubuntu 14 non gui.

Set up Using multiple reference pages I have managed to successfully install: Xvfb Chrome latest browser Protractor 3.3.0 Java 7 (also tried with Java 8) and also set the LOCAL_HOME. Also, managed to start the Xvfb using this reference.

Protractor conf

exports.config = {
    baseUrl: 'http://<qa environment>',
    framework: 'jasmine',
    seleniumAddress: 'http://localhost:4444/wd/hub',
    jasmineNodeOpts: {
        showColors:true,
        defaultTimeoutInterval: 2500000
    },
     capabilities: {
    'browserName': 'chrome'
  },

    specs: ['administration/*-spec.js'],  //'signinandout/*-spec.js', 'homepage/*-spec.js',
    onPrepare: function(){
        //browser.driver.manage().window().setSize(1280, 1080);
    }
}

Exception stack trace:

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:26 constructor(opt_error) { ^ WebDriverError: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.13.0-87-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.16 seconds Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42' System info: host: 'vagrant-ubuntu-trusty-64', ip: '10.0.2.15', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-87-generic', java.version: '1.7.0_101' Driver info: org.openqa.selenium.chrome.ChromeDriver at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:26:26) at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:580:13) at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:64:13 at Promise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1329:14) at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2790:14) at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2773:21) at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2652:27 at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7 at process._tickCallback (internal/process/next_tick.js:103:7) From: Task: WebDriver.createSession() at acquireSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:62:22) at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:295:12) at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24) at Hosted.DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33) at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:182:43) at /usr/local/lib/node_modules/protractor/built/runner.js:255:30 at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13) at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49 [01:09:14] E/launcher - Process exited with error code 1

Community
  • 1
  • 1
Rattan Behl
  • 171
  • 1
  • 7
  • Tried with java 8 and same result. Absolutely clueless at the moment. – Rattan Behl Jun 10 '16 at 04:50
  • What version of webdriver-manager are you using to download the binaries? Have you tried to remove these binaries and get them again? In newer versions of webdriver-manager the command is `webdriver-manager clean` and `webdriver-manager update`. Also, are you starting this with `webdriver-manager start`? If so, does it start okay? What is the stack trace from those logs? – cnishina Dec 23 '16 at 18:21

4 Answers4

2

Check your Google chrome Version and its compatibility with the chrome driver.

You can check that from the Chromedriver Site and download the compatible version.

It worked for me.

0

probably your window screen size is not matching try giving maximize in onPrepare:

onPrepare: function(){
browser.driver.manage().window().maximize();
    }
Ram Pasala
  • 4,931
  • 3
  • 16
  • 26
  • Thanks for your comment but that didn't help. Unfortunately because of the number of dependencies the cause of failure could be anything, its so difficult to figure out from this generic stacktrace what is wrong. – Rattan Behl Jun 09 '16 at 00:15
0
  1. Open your project and Please update your npm modules by the following command.

    project_root:\> npm update
    
  2. Now update your selenium driver to the latest version using the following command

    project_root:\> webdriver-manager update  
    
  3. Run your tests again.

Raj Kumar
  • 758
  • 6
  • 12
-2

Error due to Xvfb display is not specified here. Here , Selenium scripts are running using headless browser testing concept which is without GUI.

Hope u have used chromedriver, chrome binaries and XVfb. here chromedriver is initializing chrome binaries but chrome binary not able to sits on the monitor with XVfb .Thats y its throwing error as " Chrome failed to start:exit abnormally"

please follow the below steps before executing ur script.Example:(Execute this cmd in ur Unix server (ex.putty))

usr/bin/Xvfb :2 -ac -screen 0 1280x1024x24 &

export DISPLAY=:2

It will work definitely.