How to use webdriver-manager - 10 common examples

To help you get started, we’ve selected a few webdriver-manager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github M6Web / GithubTeamReviewer / gulp / e2e-tests.js View on Github external
gulp.task('protractor-only', ['webdriver-update'], function (done) {
  var testFiles = [
    'test/e2e/**/*.js'
  ];

  var seleniumStandAlone = new SeleniumStandAlone();
  seleniumStandAlone.versionCustom = '3.4.0';
  var seleniumServerJar = path.resolve(SeleniumConfig.getSeleniumDir(), seleniumStandAlone.executableFilename());

  gulp.src(testFiles)
    .pipe($.protractor.protractor({
      args: ['--seleniumServerJar='+seleniumServerJar],
      configFile: 'test/protractor.conf.js'
    }))
    .on('error', function (err) {
      // Make sure failed tests cause gulp to exit non-zero
      throw err;
    })
    .on('end', function () {
      // Close browser sync server
      $.browserSync.exit();
      done();
    });
});
github M6Web / GithubTeamReviewer / gulp / e2e-tests.js View on Github external
gulp.task('protractor-only', ['webdriver-update'], function (done) {
  var testFiles = [
    'test/e2e/**/*.js'
  ];

  var seleniumStandAlone = new SeleniumStandAlone();
  seleniumStandAlone.versionCustom = '3.4.0';
  var seleniumServerJar = path.resolve(SeleniumConfig.getSeleniumDir(), seleniumStandAlone.executableFilename());

  gulp.src(testFiles)
    .pipe($.protractor.protractor({
      args: ['--seleniumServerJar='+seleniumServerJar],
      configFile: 'test/protractor.conf.js'
    }))
    .on('error', function (err) {
      // Make sure failed tests cause gulp to exit non-zero
      throw err;
    })
    .on('end', function () {
      // Close browser sync server
      $.browserSync.exit();
      done();
github M6Web / GithubTeamReviewer / test / protractor.conf.js View on Github external
'use strict';

var path = require('path');
var SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
var SeleniumChrome = require('webdriver-manager/built/lib/binaries/chrome_driver').ChromeDriver;
var seleniumChrome = new SeleniumChrome();
seleniumChrome.versionCustom = '2.30';

// An example configuration file.
exports.config = {
  baseUrl: 'http://localhost:9000/',
  chromeDriver: path.resolve(SeleniumConfig.getSeleniumDir(), seleniumChrome.executableFilename()),

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--headless', '--disable-gpu', '--window-size=1280,800']
    }
  },

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['test/e2e/**/*.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
github M6Web / GithubTeamReviewer / gulp / e2e-tests.js View on Github external
'use strict';

var gulp = require('gulp');
var path = require('path');
var SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
var SeleniumStandAlone = require('webdriver-manager/built/lib/binaries/stand_alone').StandAlone;

var $ = require('gulp-load-plugins')({
   pattern: ['gulp-*', 'browser-sync', 'run-sequence']
});

gulp.task('scripts-tests', function () {
  return gulp.src(['test/**/*.js'])
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.jshint.reporter('fail'))
    .pipe($.size());
});

// Downloads the selenium webdriver
gulp.task('webdriver-update', function (done) {
github M6Web / GithubTeamReviewer / test / protractor.conf.js View on Github external
'use strict';

var path = require('path');
var SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
var SeleniumChrome = require('webdriver-manager/built/lib/binaries/chrome_driver').ChromeDriver;
var seleniumChrome = new SeleniumChrome();
seleniumChrome.versionCustom = '2.30';

// An example configuration file.
exports.config = {
  baseUrl: 'http://localhost:9000/',
  chromeDriver: path.resolve(SeleniumConfig.getSeleniumDir(), seleniumChrome.executableFilename()),

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--headless', '--disable-gpu', '--window-size=1280,800']
    }
  },
github okta / okta-signin-widget / test / e2e / conf.js View on Github external
}

  else if (process.env.SAUCE_PLATFORM_NAME === 'android') {
    var appiumAndroid = require('./appium/android-conf.js');
    config.multiCapabilities = appiumAndroid.androidCapabilities;
  }
}
// Local tests, required:
// WIDGET_TEST_SERVER
// WIDGET_BASIC_USER
// WIDGET_BASIC_PASSWORD
else {
  const webdriverManagerConfig = require('webdriver-manager/selenium/update-config.json');

  config.directConnect = true;
  config.chromeDriver = webdriverManagerConfig.chrome.last;
  config.capabilities = {
    browserName: 'chrome',
  };
}

module.exports.config = config;
github M6Web / GithubTeamReviewer / test / protractor.conf.js View on Github external
'use strict';

var path = require('path');
var SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
var SeleniumChrome = require('webdriver-manager/built/lib/binaries/chrome_driver').ChromeDriver;
var seleniumChrome = new SeleniumChrome();
seleniumChrome.versionCustom = '2.30';

// An example configuration file.
exports.config = {
  baseUrl: 'http://localhost:9000/',
  chromeDriver: path.resolve(SeleniumConfig.getSeleniumDir(), seleniumChrome.executableFilename()),

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--headless', '--disable-gpu', '--window-size=1280,800']
    }
  },

  // Spec patterns are relative to the current working directly when
github fossasia / susper.com / node_modules / protractor / built / driverProviders / local.js View on Github external
}
            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.');
github angular / protractor / lib / driverProviders / direct.ts View on Github external
'Could not find chromedriver at ' + chromeDriverFile +
                  '. Run \'webdriver-manager update\' to download binaries.');
        }

        let chromeService = new ChromeServiceBuilder(chromeDriverFile).build();
        // driver = ChromeDriver.createSession(new Capabilities(this.config_.capabilities),
        // chromeService);
        // TODO(ralphj): fix typings
        driver =
            require('selenium-webdriver/chrome')
                .Driver.createSession(new Capabilities(this.config_.capabilities), chromeService);
        break;
      case 'firefox':
        let geckoDriverFile: string;
        try {
          let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
          let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
          geckoDriverFile = updateConfig.gecko.last;
        } catch (e) {
          throw new BrowserError(
              logger,
              'Could not find update-config.json. ' +
                  'Run \'webdriver-manager update\' to download binaries.');
        }

        // TODO (mgiambalvo): Turn this into an import when the selenium typings are updated.
        const FirefoxServiceBuilder = require('selenium-webdriver/firefox').ServiceBuilder;

        let firefoxService = new FirefoxServiceBuilder(geckoDriverFile).build();
        // TODO(mgiambalvo): Fix typings.
        driver =
            require('selenium-webdriver/firefox')
github fossasia / susper.com / node_modules / protractor / built / driverProviders / direct.js View on Github external
getNewDriver() {
        let driver;
        switch (this.config_.capabilities.browserName) {
            case 'chrome':
                let chromeDriverFile;
                if (this.config_.chromeDriver) {
                    chromeDriverFile = this.config_.chromeDriver;
                }
                else {
                    try {
                        let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
                        let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
                        chromeDriverFile = updateConfig.chrome.last;
                    }
                    catch (e) {
                        throw new exitCodes_1.BrowserError(logger, 'Could not find update-config.json. ' +
                            'Run \'webdriver-manager update\' to download binaries.');
                    }
                }
                if (!fs.existsSync(chromeDriverFile)) {
                    throw new exitCodes_1.BrowserError(logger, 'Could not find chromedriver at ' + chromeDriverFile +
                        '. Run \'webdriver-manager update\' to download binaries.');
                }
                let chromeService = new chrome_1.ServiceBuilder(chromeDriverFile).build();
                // driver = ChromeDriver.createSession(new Capabilities(this.config_.capabilities),
                // chromeService);
                // TODO(ralphj): fix typings