7
votes

I am a new Protractor. I am trying to run a sample unit test on my first Angular2 application.

my conf.js file has :

exports.config = { 
    seleniumAddress: 'http://localhost:3000/login', 
    specs: ['todo-spec.js'], 
    capabilities: { 
       'browserName': 'chrome', 
        chromeOnly:true , 
        directConnect: true } 
    };

2.my 'todo-spec.js' file has :

describe('Authentication capabilities', function() {
  var email = element(by.id('inputusername'));
  var password = element(by.id('inputPassword'));
  var loginButton = element(by.class('btn-success'));


it('should redirect to the login page if trying to load protected page while not authenticated', function() {
    browser.get('http://localhost:3000/login');
    loginURL = browser.getCurrentUrl();
    email.sendKeys("demo");
    password.sendKeys("demo");
    loginButton.click();

  });  
 });

but when i try to run the protractor by the following command "protractor "filepath\conf.js",

Getting " E/launcher - Process exited with error code 199" error.

can anyone please let me know, where I'm doing mistake?

8
your config is wrong - radio_head
could you pls elaborate where i have done mistake? - Sarav

8 Answers

3
votes

Check if you have the latest JDK and JRE are installed (Selenium somewhat seems to have dependencies with them).This was something unexpected that I found the hard way after finding that the server was not being initialised while running Protractor test tasks with gulp.

2
votes

I fixed it by adding useAllAngular2AppRoots: true, in my config file.

also, commented "seleniumAddress: 'http://localhost:4444/wd/hub"

so right now my code is like this,and working.

exports.config = {
//seleniumAddress: 'http://localhost:4444/wd/hub',
//directConnect: true,
specs: ['todo-spec.js'],

capabilities: {
    'browserName': 'chrome',

},
useAllAngular2AppRoots: true,
framework: 'jasmine'
};
2
votes

I was also facing the same issue. Eventually, I got the solution after updating the chrome latest version. I was using the Chrome version 79.0 and I have updated it to the latest version 80.0.3987.87 (Official Build) (64-bit).

Just try updating the latest chrome version as it worked for me.

1
votes
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
//directConnect: true,
specs: ['todo-spec.js'],
capabilities: {
    'browserName': 'chrome'
},

framework: 'jasmine'
};

if you want to use directConnect, uncomment it and comment the seleniumAddress

1
votes

Check that your browser has the latest version (in my case this error disappeared after Chrome become latest version)

1
votes

you have to update your chromedriver. Might be that you're locked in an older version of webdriver-manager that doesn't download chromedriver 78 for you. Doing npm install -f protractor should help for that.

1
votes

I was also facing the same issue. Eventually, I got the solution after downgrading the node version to 11.15.0. I was using the node version 12.0.0.

Now i have 11.15.0 and protractor tests with chrome works perfectly fine.

-1
votes

I had to update my old version of protractor in package.json.