Protractor: Protractor 5.2.0:-Unable to create new service: GeckoDriverService when seleniumServerJar is used instead of seleniumAddress

Created on 27 Nov 2017  ·  3Comments  ·  Source: angular/protractor

Hi,
I am getting Unable to create new service: GeckoDriverService when trying to use firefox. What I have noticed is when seleniumServerJar is used to open and close selenium server. If I use seleniumAddress then everything works perfectly well. Is there a way where seleniumServerJar and firefox can be used together.

Node version: 6.9.5
Protractor: 5.2.0
Selenium: 3.6
geckoDriver: 0.19
OS: Mac

Most helpful comment

Hi, this is the same issue as this one #4501.

There is already a simple solution for this in #4502 (as completion of 768fd393d1084a8da0ec6eeaa57) but someone from the core team needs review the PR and merge it. Shortly, the part where args for command for starting selenium, where gecko driver is provided, is missing.

In lib/driverProviders/local.ts, the following is missing:

if (this.config_.geckoDriver) {
  serverConf.jvmArgs.push('-Dwebdriver.gecko.driver=' + this.config_.geckoDriver);
}

after the same is done for chromeDriver:

if (this.config_.chromeDriver) {
  serverConf.jvmArgs.push('-Dwebdriver.chrome.driver=' + this.config_.chromeDriver);
}

Hope that someone will review and merge this PR very soon, and solve this annoying issue :)

All 3 comments

@adityagautam Hi, can you please share your protractor configuration file?

@Xotabu4 Thanks for looking at this issue. Here is my config file

`let HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
require("babel-register");

exports.config = {`

framework: 'jasmine2',
rootElement: 'body',
seleniumServerJar:'./node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.6.0.jar',
geckoDriver: './node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver',
capabilities: {
    browserName: 'firefox',
    acceptSslCerts: true,
    trustAllSSLCertificates: true,
    acceptInsecureCerts:true,
    ACCEPT_SSL_CERTS:true,
},


baseUrl: 'https://shared.qa.com',

suites: {
    create: 'tests/*Create*Spec.js',
    activate: 'tests/*Activate*Spec.js'
},


jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 3600000,
    isVerbose: true
},

getPageTimeout: 120000,
allScriptsTimeout: 3600000,
delayBrowserTimeInSeconds: 0,

beforeLaunch: function() {
    return new Promise(function(resolve){
        reporter.beforeLaunch(resolve);
    });
},
afterLaunch: function(exitCode) {
    return new Promise(function(resolve){
        reporter.afterLaunch(resolve.bind(this, exitCode));
    });
},

onPrepare: function() {

    require("babel-register");

    let origFn = browser.driver.controlFlow().execute;

    browser.driver.controlFlow().execute = function () {
        let args = arguments;

        origFn.call(browser.driver.controlFlow(), function () {
            return protractor.promise.delayed(this.delayBrowserTimeInSeconds * 100);
        });

        return origFn.apply(browser.driver.controlFlow(), args);
    };

    jasmine.getEnv().addReporter(reporter);

    let getScreenSize = function () {
        return browser.driver.executeScript(function () {
            return {
                width: window.screen.availWidth,
                height: window.screen.availHeight
            };
        });
    };

    getScreenSize().then(function (screenSize) {
        browser.driver.manage().window().setSize(screenSize.width, screenSize.height);
    });

    let jasmineReporters = require('jasmine-reporters');
    let junitReporter = new jasmineReporters.JUnitXmlReporter({
            consolidateAll: false,
            savePath: 'xml_Reports',
            filePrefix: '-xmloutput',
        });
        jasmine.getEnv().addReporter(junitReporter);
}};

`

Hi, this is the same issue as this one #4501.

There is already a simple solution for this in #4502 (as completion of 768fd393d1084a8da0ec6eeaa57) but someone from the core team needs review the PR and merge it. Shortly, the part where args for command for starting selenium, where gecko driver is provided, is missing.

In lib/driverProviders/local.ts, the following is missing:

if (this.config_.geckoDriver) {
  serverConf.jvmArgs.push('-Dwebdriver.gecko.driver=' + this.config_.geckoDriver);
}

after the same is done for chromeDriver:

if (this.config_.chromeDriver) {
  serverConf.jvmArgs.push('-Dwebdriver.chrome.driver=' + this.config_.chromeDriver);
}

Hope that someone will review and merge this PR very soon, and solve this annoying issue :)

Was this page helpful?
0 / 5 - 0 ratings