0

I am currently trying to launch protractor e2e tests on Firefox web browser , however i got this error, can any one have an idea to solve this issue? Thanks for your time

[webdriver-start] Running Firefox as root in a regular user's session is not supported.  ($HOME is /Users/x which is owned by x)
[protractor    ] [19:38:09] E/launcher - invalid argument: can't kill an exited process
[protractor    ] Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
[protractor    ] System info: host: 'MacBook-Pro.local', ip: '192.168.1.3', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_151'
[protractor    ] Driver info: driver.version: unknown
  • Are you trying to execute protractor with `sudo`? – alecxe Dec 09 '19 at 12:00
  • @alecxe yes , with sudo npm test – Lakmal Rajith Dec 09 '19 at 12:17
  • That `invalid argument: can't kill an exited process` error is likely because of version incompatibility between firefox and geckodriver. I'd check this first. Related thread: https://stackoverflow.com/questions/52534658/webdriverexception-message-invalid-argument-cant-kill-an-exited-process-with – alecxe Dec 09 '19 at 12:19
  • @alecxe thanks, however I tried with with the FF 71.0 (64-bit) and the geckodriver v0.26.0 with admin permission and i am still getting the error – Lakmal Rajith Dec 10 '19 at 06:39
  • @alecxe thanks Finally able to get the working tests on firefox, with small edit on conf.js file thanks for the support, also i would like to know how to run both FF and chrome on headless in the same tests, thank you – Lakmal Rajith Dec 11 '19 at 03:04

2 Answers2

1

Read the comments and saw that you got the answer to your question. The answer to your question in the comment is as follows:

To run both FF and Chrome on headless in the same tests, you will need to add something called multiCapabilities in your configuration. Here is a code snippet:

    multiCapabilities: [
        {
            browserName: 'chrome',
            chromeOptions: {
                args: [
                    "--headless", '--disable-gpu'
                ]
            },
            shardTestFiles: true,
            maxInstances: 4,
            platformName: "OS X 10.9",
            version: '63.0'
        },
        {
            browserName: 'firefox',
            'moz:firefoxOptions': {
                'args': [
                    "--headless"
                ]
            },
            shardTestFiles: true,
            maxInstances: 4
        },
        {
            browserName: 'safari',
            'safari.options': {
                cleanSession: true
            }
        }],

This way you can run multiple browsers together.

  • Hi Sankalan , thanks this worked smooth for Firefox and chrome, is there any extra config have to done for the test up and ruining on safari browser ? – Lakmal Rajith Jan 01 '20 at 07:00
  • Hey Lakmal, Please accept the answer if it worked for you! For Safari you will need to download the binaries for it if webdriver manager update is not doing the job. You can get more information on it [here](https://github.com/angular/protractor/issues/4169) – Sankalan Parajuli Jan 01 '20 at 08:15
  • Hi sankalan marked as accepted answer , thanks for the tip on safari, how ever when runing on the second time it was given an error for the chrome browser: Runner process exited unexpectedly with error code: 1 – Lakmal Rajith Jan 01 '20 at 08:46
  • Hey Lakmal you accepted the other answer. What environment are you running your tests on? Have you written browser.close and browser.quit when your tests end in your configuration file? – Sankalan Parajuli Jan 01 '20 at 09:05
1

Here is a working example for Firefox which I tested recently in the latest protractor . Make sure that you have the latest version of Firefox and protractor. Mine is
protractor -Version 5.4.2 and Firefox 71 browser version.

Please see the sample config,js and read the comments to get an Idea.

//protractor firefoxconfig.js
exports.config = {
  framework: 'jasmine',
  directConnect: false, //Start protractor without start the selenium server using webdriver-manager start. default value is fales
  //This is  only for chrome and firefox and use drivers instead of selenium server

  capabilities: {
      browserName: 'firefox',
      'moz:firefoxOptions': {
            args: ['--verbose'],
            binary: 'C:/Program Files/Mozilla Firefox/firefox.exe' //Provide binary location to avoid potential binary not found errors 
       //Need to start cmd via admin mode to avoid permission error
        }
},   
    //set to true So each spec will be executed in own browser instance. default value is false
    //restartBrowserBetweenTests: true,
     jasmineNodeOpts: {
    //Jasmine provides only one timeout option  timeout in milliseconds don't add ;
    defaultTimeoutInterval: 180000
     },

  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['src/com/sam/scriptjs/iframes.spec.js']

}

Further readings - https://medium.com/@smeesheady/how-to-setup-protractor-to-run-in-firefox-browser-138046214e1 How can I configure the firefox binary location in Protractor?

Sameera De Silva
  • 1,722
  • 1
  • 22
  • 41
  • 1
    thanks for detailed answer , since i am using Mac os environment also defined a binary path to FF but no luck, then I tried modifying the code with the following and it worked, how ever i was required to run protractor conf.js terminal instead of npm test beacuse it gaves the error: `Using driver provider directConnect, but also found extra driver provider parameter(s): seleniumAddress` – Lakmal Rajith Jan 01 '20 at 06:55