question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test cases are not running in all browsers

See original GitHub issue

I have configured gulp-protractor with my e2e test scripts, its running only in chrome browser and all other browsers get failed.

gulp-protractor: v4.1.0

I have installed all latest version browsers in my machine.

FireFox: 55.0,2
IE: 11
Edge: 40.15063.0.0

Error In Terminal:

[BS] Serving files from: ./
(node:17508) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[18:08:55] I/launcher - Running 4 instances of WebDriver
[18:09:00] I/testLogger -
------------------------------------

[18:09:00] I/testLogger - [internet explorer #21] PID: 5172
[internet explorer #21] Specs: D:\gitlab\samples\node_modules\my-custom-build\src\e2e\samples.spec.js
[internet explorer #21]
[internet explorer #21] (node:5172) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[internet explorer #21] [18:08:57] I/local - Starting selenium standalone server...
[internet explorer #21] [18:09:00] I/local - Selenium standalone server started at http://MYIP:53820/wd/hub
[internet explorer #21]
[internet explorer #21] D:\gitlab\samples\node_modules\selenium-webdriver\lib\error.js:505
[internet explorer #21]         throw new ctor(message);
[internet explorer #21]               ^
[internet explorer #21] SessionNotCreatedError: Unable to create new service: InternetExplorerDriverService
[internet explorer #21] Build info: version: '3.5.2', revision: '10229a9020', time: '2017-08-21T17:54:21.164Z'
[internet explorer #21] System info: host: 'MYLAPN10184', ip: 'MYIP', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
[internet explorer #21] Driver info: driver.version: unknown
[internet explorer #21]     at Object.checkLegacyResponse (D:\gitlab\samples\node_modules\selenium-webdriver\lib\error.js:505:15)
[internet explorer #21]     at parseHttpResponse (D:\gitlab\samples\node_modules\selenium-webdriver\lib\http.js:509:13)
[internet explorer #21]     at doSend.then.response (D:\gitlab\samples\node_modules\selenium-webdriver\lib\http.js:440:13)
[internet explorer #21]     at <anonymous>
[internet explorer #21]     at process._tickCallback (internal/process/next_tick.js:188:7)
[internet explorer #21] From: Task: WebDriver.createSession()
[internet explorer #21]     at Function.createSession (D:\gitlab\samples\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
[internet explorer #21]     at createDriver (D:\gitlab\samples\node_modules\selenium-webdriver\index.js:167:33)
[internet explorer #21]     at Builder.build (D:\gitlab\samples\node_modules\selenium-webdriver\index.js:632:14)
[internet explorer #21]     at Local.getNewDriver (D:\gitlab\samples\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
[internet explorer #21]     at Runner.createBrowser (D:\gitlab\samples\node_modules\protractor\built\runner.js:195:43)
[internet explorer #21]     at q.then.then (D:\gitlab\samples\node_modules\protractor\built\runner.js:339:29)
[internet explorer #21]     at _fulfilled (D:\gitlab\samples\node_modules\q\q.js:834:54)
[internet explorer #21]     at self.promiseDispatch.done (D:\gitlab\samples\node_modules\q\q.js:863:30)
[internet explorer #21]     at Promise.promise.promiseDispatch (D:\gitlab\samples\node_modules\q\q.js:796:13)
[internet explorer #21]     at D:\gitlab\samples\node_modules\q\q.js:604:44
[internet explorer #21]     at runSingle (D:\gitlab\samples\node_modules\q\q.js:137:13)
[internet explorer #21]     at flush (D:\gitlab\samples\node_modules\q\q.js:125:13)
[internet explorer #21]     at _combinedTickCallback (internal/process/next_tick.js:131:7)
[internet explorer #21]     at process._tickCallback (internal/process/next_tick.js:180:9)
[internet explorer #21]

[18:09:00] I/testLogger -

[18:09:00] E/launcher - Runner process exited unexpectedly with error code: 1
[18:09:00] I/launcher - 3 instance(s) of WebDriver still running
[18:09:00] I/testLogger -
------------------------------------

[18:09:00] I/testLogger - [firefox #01] PID: 17912
[firefox #01] Specs: D:\gitlab\samples\node_modules\my-custom-build\src\e2e\samples.spec.js
[firefox #01]
[firefox #01] (node:17912) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[firefox #01] [18:08:57] I/local - Starting selenium standalone server...
[firefox #01] [18:08:59] I/local - Selenium standalone server started at http://MYIP:56129/wd/hub
[firefox #01]
[firefox #01] D:\gitlab\samples\node_modules\selenium-webdriver\lib\error.js:505
[firefox #01]         throw new ctor(message);
[firefox #01]               ^
[firefox #01] SessionNotCreatedError: Unable to create new service: GeckoDriverService
[firefox #01] Build info: version: '3.5.2', revision: '10229a9020', time: '2017-08-21T17:54:21.164Z'
[firefox #01] System info: host: 'MYLAPN10184', ip: 'MYIP', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
[firefox #01] Driver info: driver.version: unknown
[firefox #01]     at Object.checkLegacyResponse (D:\gitlab\samples\node_modules\selenium-webdriver\lib\error.js:505:15)
[firefox #01]     at parseHttpResponse (D:\gitlab\samples\node_modules\selenium-webdriver\lib\http.js:509:13)
[firefox #01]     at doSend.then.response (D:\gitlab\samples\node_modules\selenium-webdriver\lib\http.js:440:13)
[firefox #01]     at <anonymous>
[firefox #01]     at process._tickCallback (internal/process/next_tick.js:188:7)
[firefox #01] From: Task: WebDriver.createSession()
[firefox #01]     at Function.createSession (D:\gitlab\samples\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
[firefox #01]     at Function.createSession (D:\gitlab\samples\node_modules\selenium-webdriver\firefox\index.js:640:55)
[firefox #01]     at createDriver (D:\gitlab\samples\node_modules\selenium-webdriver\index.js:167:33)
[firefox #01]     at Builder.build (D:\gitlab\samples\node_modules\selenium-webdriver\index.js:629:16)
[firefox #01]     at Local.getNewDriver (D:\gitlab\samples\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
[firefox #01]     at Runner.createBrowser (D:\gitlab\samples\node_modules\protractor\built\runner.js:195:43)
[firefox #01]     at q.then.then (D:\gitlab\samples\node_modules\protractor\built\runner.js:339:29)
[firefox #01]     at _fulfilled (D:\gitlab\samples\node_modules\q\q.js:834:54)
[firefox #01]     at self.promiseDispatch.done (D:\gitlab\samples\node_modules\q\q.js:863:30)
[firefox #01]     at Promise.promise.promiseDispatch (D:\gitlab\samples\node_modules\q\q.js:796:13)
[firefox #01]     at D:\gitlab\samples\node_modules\q\q.js:604:44
[firefox #01]     at runSingle (D:\gitlab\samples\node_modules\q\q.js:137:13)
[firefox #01]     at flush (D:\gitlab\samples\node_modules\q\q.js:125:13)
[firefox #01]     at _combinedTickCallback (internal/process/next_tick.js:131:7)
[firefox #01]     at process._tickCallback (internal/process/next_tick.js:180:9)
[firefox #01]

[18:09:00] I/testLogger -

[18:09:00] E/launcher - Runner process exited unexpectedly with error code: 1
[18:09:00] I/launcher - 2 instance(s) of WebDriver still running
[18:09:20] I/testLogger -
------------------------------------

[18:09:20] I/testLogger - [MicrosoftEdge #31] PID: 5048
[MicrosoftEdge #31] Specs: D:\gitlab\samples\node_modules\my-custom-build\src\e2e\samples.spec.js
[MicrosoftEdge #31]
[MicrosoftEdge #31] (node:5048) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[MicrosoftEdge #31] [18:08:57] I/local - Starting selenium standalone server...
[MicrosoftEdge #31] [18:09:00] I/local - Selenium standalone server started at http://MYIP:49585/wd/hub
[MicrosoftEdge #31]
[MicrosoftEdge #31] D:\gitlab\samples\node_modules\selenium-webdriver\lib\error.js:505
[MicrosoftEdge #31]         throw new ctor(message);
[MicrosoftEdge #31]               ^
[MicrosoftEdge #31] WebDriverError: Timed out waiting for driver server to start.
[MicrosoftEdge #31] Build info: version: '3.5.2', revision: '10229a9020', time: '2017-08-21T17:54:21.164Z'
[MicrosoftEdge #31] System info: host: 'MYLAPN10184', ip: 'MYIP', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
[MicrosoftEdge #31] Driver info: driver.version: unknown
[MicrosoftEdge #31]     at Object.checkLegacyResponse (D:\gitlab\samples\node_modules\selenium-webdriver\lib\error.js:505:15)
[MicrosoftEdge #31]     at parseHttpResponse (D:\gitlab\samples\node_modules\selenium-webdriver\lib\http.js:509:13)
[MicrosoftEdge #31]     at doSend.then.response (D:\gitlab\samples\node_modules\selenium-webdriver\lib\http.js:440:13)
[MicrosoftEdge #31]     at <anonymous>
[MicrosoftEdge #31]     at process._tickCallback (internal/process/next_tick.js:188:7)
[MicrosoftEdge #31] From: Task: WebDriver.createSession()
[MicrosoftEdge #31]     at Function.createSession (D:\gitlab\samples\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
[MicrosoftEdge #31]     at createDriver (D:\gitlab\samples\node_modules\selenium-webdriver\index.js:167:33)
[MicrosoftEdge #31]     at Builder.build (D:\gitlab\samples\node_modules\selenium-webdriver\index.js:632:14)
[MicrosoftEdge #31]     at Local.getNewDriver (D:\gitlab\samples\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
[MicrosoftEdge #31]     at Runner.createBrowser (D:\gitlab\samples\node_modules\protractor\built\runner.js:195:43)
[MicrosoftEdge #31]     at q.then.then (D:\gitlab\samples\node_modules\protractor\built\runner.js:339:29)
[MicrosoftEdge #31]     at _fulfilled (D:\gitlab\samples\node_modules\q\q.js:834:54)
[MicrosoftEdge #31]     at self.promiseDispatch.done (D:\gitlab\samples\node_modules\q\q.js:863:30)
[MicrosoftEdge #31]     at Promise.promise.promiseDispatch (D:\gitlab\samples\node_modules\q\q.js:796:13)
[MicrosoftEdge #31]     at D:\gitlab\samples\node_modules\q\q.js:604:44
[MicrosoftEdge #31]     at runSingle (D:\gitlab\samples\node_modules\q\q.js:137:13)
[MicrosoftEdge #31]     at flush (D:\gitlab\samples\node_modules\q\q.js:125:13)
[MicrosoftEdge #31]     at _combinedTickCallback (internal/process/next_tick.js:131:7)
[MicrosoftEdge #31]     at process._tickCallback (internal/process/next_tick.js:180:9)
[MicrosoftEdge #31]

gulp task:

gulp.task('e2e-webdriver-update', require('gulp-protractor').webdriver_update_specific({
    webdriverManagerArgs: ['--ie', '--edge']
}));

gulp.task('e2e-test', function(done) {
    var browserSync = require('browser-sync');
    var bs = browserSync.create('My Testing Samples');
    var options = {
        port: 3000,
        server: {
            baseDir: './',
            directory: true
        },
        ui: false,
        open: false,
        notify: false
    };
    bs.init(options, function() {
        gulp.src(['./e2e/**/*.spec.js'])
            .pipe(require('gulp-protractor').protractor({
                configFile: './e2e/protractor.config.js'
            }))
            .on('error', function(e) {
                console.error('Error: ' + e.message);
                done();
                process.exit(1);
            })
            .on('end', function() {
                done();
                process.exit(0);
            });
    });
});

gulp.task('e2e', function(done){
    runSequence('e2e-webdriver-update', 'e2e-test',  done);
});

protractor.config.js

  var browserCapabilities = [{
     'browserName': 'firefox'
  }, {
    'browserName': 'chrome',
    'chromeOptions': {
        'args': ['no-sandbox']
    }
 }, {
    'browserName': 'internet explorer'
 },
 {
    'browserName': 'MicrosoftEdge'
 }];

  exports.config = {
    allScriptsTimeout: 100000,

    multiCapabilities: browserCapabilities,
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 140000,
        print: function(err) {
           console.log(err);
        }
    },
    specs: ['./*.spec.js'],
    onComplete: function() {
        browser.driver.quit();
    }
};

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
rahulmrcommented, Jan 26, 2018

@ajithr Could please provide the OS details? Is it Windows 10? Sometimes the UAC settings create problems. I will check this at my end

0reactions
mcafeeruncommented, May 3, 2018

@nmfernandes Hi - Can you please provide me the details of what you have changed? Here is the content of protractor\build\driverProviders\local.js.

I’m facing the issue in IE11.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
 * This is an implementation of the Local Driver Provider.
 * It is responsible for setting up the account object, tearing
 * it down, and setting up the driver correctly.
 *
 * TODO - it would be nice to do this in the launcher phase,
 * so that we only start the local selenium once per entire launch.
 */
const fs = require("fs");
const path = require("path");
const q = require("q");
const exitCodes_1 = require("../exitCodes");
const logger_1 = require("../logger");
const driverProvider_1 = require("./driverProvider");
const SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
const SeleniumChrome = require('webdriver-manager/built/lib/binaries/chrome_driver').ChromeDriver;
const SeleniumStandAlone = require('webdriver-manager/built/lib/binaries/standalone').StandAlone;
const remote = require('selenium-webdriver/remote');
let logger = new logger_1.Logger('local');
class Local extends driverProvider_1.DriverProvider {
    constructor(config) {
        super(config);
        this.server_ = null;
    }
    /**
     * Helper to locate the default jar path if none is provided by the user.
     * @private
     */
    addDefaultBinaryLocs_() {
        if (!this.config_.seleniumServerJar) {
            logger.debug('Attempting to find the SeleniumServerJar in the default ' +
                'location used by webdriver-manager');
            try {
                let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
                let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
                this.config_.seleniumServerJar = updateConfig.standalone.last;
            }
            catch (err) {
                throw new exitCodes_1.BrowserError(logger, 'No update-config.json found.' +
                    ' Run \'webdriver-manager update\' to download binaries.');
            }
        }
        if (!fs.existsSync(this.config_.seleniumServerJar)) {
            throw new exitCodes_1.BrowserError(logger, 'No selenium server jar found at ' + this.config_.seleniumServerJar +
                '. Run \'webdriver-manager update\' to download binaries.');
        }
        if (this.config_.capabilities.browserName === 'chrome') {
            if (!this.config_.chromeDriver) {
                logger.debug('Attempting to find the chromedriver binary in the default ' +
                    'location used by webdriver-manager');
                try {
                    let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
                    let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
                    this.config_.chromeDriver = updateConfig.chrome.last;
                }
                catch (err) {
                    throw new exitCodes_1.BrowserError(logger, 'No update-config.json found. ' +
                        'Run \'webdriver-manager update\' to download binaries.');
                }
            }
            // Check if file exists, if not try .exe or fail accordingly
            if (!fs.existsSync(this.config_.chromeDriver)) {
                if (fs.existsSync(this.config_.chromeDriver + '.exe')) {
                    this.config_.chromeDriver += '.exe';
                }
                else {
                    throw new exitCodes_1.BrowserError(logger, 'Could not find chromedriver at ' + this.config_.chromeDriver +
                        '. Run \'webdriver-manager update\' to download binaries.');
                }
            }
        }
        if (this.config_.capabilities.browserName === 'firefox') {
            if (!this.config_.geckoDriver) {
                logger.debug('Attempting to find the gecko driver binary in the default ' +
                    'location used by webdriver-manager');
                try {
                    let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
                    let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
                    this.config_.geckoDriver = updateConfig.gecko.last;
                }
                catch (err) {
                    throw new exitCodes_1.BrowserError(logger, 'No update-config.json found. ' +
                        'Run \'webdriver-manager update\' to download binaries.');
                }
            }
            // Check if file exists, if not try .exe or fail accordingly
            if (!fs.existsSync(this.config_.geckoDriver)) {
                if (fs.existsSync(this.config_.geckoDriver + '.exe')) {
                    this.config_.geckoDriver += '.exe';
                }
                else {
                    throw new exitCodes_1.BrowserError(logger, 'Could not find gecko driver at ' + this.config_.geckoDriver +
                        '. Run \'webdriver-manager update\' to download binaries.');
                }
            }
        }
    }
    /**
     * Configure and launch (if applicable) the object's environment.
     * @public
     * @return {q.promise} A promise which will resolve when the environment is
     *     ready to test.
     */
    setupDriverEnv() {
        this.addDefaultBinaryLocs_();
        logger.info('Starting selenium standalone server...');
        let serverConf = this.config_.localSeleniumStandaloneOpts || {};
        // If args or port is not set use seleniumArgs and seleniumPort
        // for backward compatibility
        if (serverConf.args === undefined) {
            serverConf.args = this.config_.seleniumArgs || [];
        }
        if (serverConf.jvmArgs === undefined) {
            serverConf.jvmArgs = this.config_.jvmArgs || [];
        }
        else {
            if (!Array.isArray(serverConf.jvmArgs)) {
                throw new exitCodes_1.ConfigError(logger, 'jvmArgs should be an array.');
            }
        }
        if (serverConf.port === undefined) {
            serverConf.port = this.config_.seleniumPort;
        }
        // configure server
        if (this.config_.chromeDriver) {
            serverConf.jvmArgs.push('-Dwebdriver.chrome.driver=' + this.config_.chromeDriver);
        }
        this.server_ = new remote.SeleniumServer(this.config_.seleniumServerJar, serverConf);
        let deferred = q.defer();
        // start local server, grab hosted address, and resolve promise
        this.server_.start(this.config_.seleniumServerStartTimeout)
            .then((url) => {
            logger.info('Selenium standalone server started at ' + url);
            return this.server_.address();
        })
            .then((address) => {
            this.config_.seleniumAddress = address;
            deferred.resolve();
        })
            .catch((err) => {
            deferred.reject(err);
        });
        return deferred.promise;
    }
    /**
     * Teardown and destroy the environment and do any associated cleanup.
     * Shuts down the drivers and server.
     *
     * @public
     * @override
     * @return {q.promise} A promise which will resolve when the environment
     *     is down.
     */
    teardownEnv() {
        return super.teardownEnv().then(() => {
            logger.info('Shutting down selenium standalone server.');
            return this.server_.stop();
        });
    }
}
exports.Local = Local;
//# sourceMappingURL=local.js.map
Read more comments on GitHub >

github_iconTop Results From Across the Web

Test case does not run on IE browser - Provar
Test case does not run on IE browser ; Step 1: Open the IE browser. ; Step 2: Go to ; Step 1:...
Read more >
Tests not running in Test Explorer - visual studio
The Test Explorer is showing all unit tests, but once clicking on "Run All", all tests are getting greyed out and show no...
Read more >
Katalon test cases not running in all browsers - Archive
Hi Experts,. I have created few test cases. Those run in chrome with no issues but in other browsers test cases are failing...
Read more >
Run test cases in browser or in server - Testfully
Running tests in browser works the same way as running them in Testfully's servers. Same set of features are available and your tests...
Read more >
Running Tests in Multiple Browsers - SmartBear Support
TestComplete stores the collection of the available browsers in the Browsers object and you can use this object to run a web test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found