0

I try to start tests by webdriver-manager and protractor.

Verify versions: Google Chrome 73.0.3683.86 ChromeDriver 73.0.3683.68

start webdriver-manager webdriver-manager start and start protractor

I got error by protractor

enviroment: test
[12:20:23] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[12:20:23] E/driverProvider - Error code: 135
[12:20:23] E/driverProvider - Error message: unknown error: Chrome failed to start: exited abnormally
[12:20:23] E/driverProvider - Error: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.9.0-8-amd64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 172 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'dev', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.0-8-amd64', java.version: '1.8.0_212'
Driver info: driver.version: unknown
    at Hosted.<anonymous> (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:69:23)
    at Generator.throw (<anonymous>)
    at rejected (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:5:65)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[12:20:23] E/launcher - Process exited with error code 135

and info by webdriver-manager

12:19:38.934 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "count": 1
}
12:19:38.947 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 15966
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

protractor.conf.js in project folder (where I execute command protractor --host https://MySite

let test_url = '';
let enviroment = process.env.NODE_ENV;
console.log('enviroment:', enviroment);
//console.log('process.env:', process.env);

let settings = {
        seleniumAddress: 'http://localhost:4444/wd/hub',
        //directConnect: true,
        specs: ['./e2e/todo-spec.js'],
        // Options to be passed to Jasmine-node.
        params: {
                host: 'http://localhost:3000'
        },
        capabilities: {
                browserName: 'chrome'
        },
        onPrepare: function() {
            // The require statement must be down here, since jasmine-reporters@1.0
            // needs jasmine to be in the global and protractor does not guarantee
            // this until inside the onPrepare function.
            var jasmineReporters = require('jasmine-reporters');
            jasmine.getEnv().addReporter(
                new jasmineReporters.JUnitXmlReporter('xmloutput', true, true)
            );
        },
        jasmineNodeOpts: {
                showColors: true,
                defaultTimeoutInterval: 30000
        }
}
if(process.env.hasOwnProperty('npm_config_host') && process.env.npm_config_host){
        settings.params.host = process.env.npm_config_host
}


exports.config = settings;
Andrey Kadnikov
  • 455
  • 5
  • 13

3 Answers3

1

In your chromeOptions, can you try adding --no-sandbox and --disable-dev-shm-usage and then try running the tests . Also try downgrading the browser version to see if the code is working as expected.

"chromeOptions": {
                    "args": ['--no-sandbox','--disable-dev-shm-usage'],
demouser123
  • 4,108
  • 9
  • 50
  • 82
  • Got same error `22:19:07.928 INFO [ActiveSessionFactory.apply] - Capabilities are: { "browserName": "chrome", "chromeOptions": { "args": [ "--no-sandbox", "--disable-dev-shm-usage" ] }, "count": 1 } 22:19:07.931 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 23495 Only local connections are allowed.` I was try 74 and 73 vers – Andrey Kadnikov Mar 31 '19 at 19:20
  • And couldn't find 72 version of google-chrome for linux(xvfb) for try older version – Andrey Kadnikov Mar 31 '19 at 19:22
0

Remove seleniumAddress: fomr your config and add the below one.

exports.config = {
      directConnect: true,
}

When you add dirctConnect=true you don't need to start the webdriver separately.

Hope it help you

Madhan Raj
  • 1,404
  • 1
  • 7
  • 13
  • This is not a problem with Selenium server not starting. This is an issue with Chrome not being able to start. Please read the stack trace carefully. Your solution is not correct. – demouser123 Mar 28 '19 at 07:37
  • @demouser123 I am sure that i have read the question before answering.it may not be a actual solution but it is a workaround to fix the problem. I faced the same problem and fixed in this way. – Madhan Raj Mar 28 '19 at 10:05
  • Thanks for answer, but I got another trouble. `Error: WebDriverError: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)` – Andrey Kadnikov Mar 28 '19 at 10:47
0

Please make sure you have

127.0.0.1 localhost

in your /etc/hosts file.

To check it, you should go to the terminal and run

sudo vi /etc/hosts

type your user password and paste

127.0.0.1 localhost 

to an empty row.

Additionally, please make sure you have ChromeDriver -or the driver of the browser you intend to use- is installed and your program knows the path of ChromeDriver.

You can follow the steps explained here https://www.browserstack.com/guide/run-selenium-tests-using-selenium-chromedriver.