How to use the webdriver.chrome.driver function in webdriver

To help you get started, we’ve selected a few webdriver 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 keystonejs / keystone-nightwatch-e2e / nightwatch.conf.js View on Github external
module.exports = (function (settings) {
	var isWindows = /^win/.test(process.platform);
	var chromedriverPath = require.resolve('chromedriver');
	var geckoDriverPath = require.resolve('geckodriver');
	var chromeDriver = isWindows ? path.join(chromedriverPath, '../chromedriver', 'chromedriver.exe') : path.join(chromedriverPath, '../chromedriver', 'chromedriver');
	var geckoDriver = isWindows ? path.join(geckoDriverPath, '../..', 'geckodriver.exe') : path.join(geckoDriverPath, '../..', 'geckodriver');

	// The following environment variables are set to comma separated strings in index.js
	// Here we will convert them to an array, as required by nightwatch.
	settings.src_folders = process.env.KNE_TEST_PATHS.split(',');
	settings.page_objects_path = process.env.KNE_PAGE_OBJECT_PATHS.split(',');
	settings.test_settings.default.exclude = process.env.KNE_EXCLUDE_TEST_PATHS.split(',');

	settings.globals_path = path.resolve(__dirname, 'globals.js');
	settings.selenium.cli_args['webdriver.chrome.driver'] = chromeDriver;
	settings.selenium.cli_args['webdriver.gecko.driver'] = geckoDriver;

	if (process.env.KNE_BROWSER_NAME) {
		settings.test_settings[process.env.KNE_TEST_ENV].desiredCapabilities.browserName = process.env.KNE_BROWSER_NAME;
	}

	if (process.env.KNE_BROWSER_VERSION) {
		settings.test_settings[process.env.KNE_TEST_ENV].desiredCapabilities.version = process.env.KNE_BROWSER_VERSION;
	}

	console.log('nightwatch settings:'
		+ '\n\tNightwatch Environment: ' + process.env.KNE_TEST_ENV
		+ '\n\tNightwatch Start Selenium: ' + process.env.KNE_SELENIUM_START_PROCESS
		+ '\n\tBrowser Name: ' + settings.test_settings[process.env.KNE_TEST_ENV].desiredCapabilities.browserName
		+ '\n\tBrowser Version: ' + settings.test_settings[process.env.KNE_TEST_ENV].desiredCapabilities.version
		+ '\n\tSauceLabs Tunnel Id: ' + process.env.TRAVIS_JOB_NUMBER
github LancerComet / Aniber / nightwatch.conf.js View on Github external
module.exports = (function (settings) {
  // Setup the browser we use.
  // We will use phantomjs by default.
  var browser = process.argv[2] ? process.argv[2].replace(/-/g, '') : 'phantomjs'
  if (browser === 'ie') browser = 'internet explorer'

  // Tell Nightwatch where is the Selenium. | 设置 Selenium 所在位置。
  settings.selenium.server_path = `${path.resolve()}/node_modules/selenium-standalone/.selenium/selenium-server/${seleniumConfig.selenium.version}-server.jar`

  // Attach Chrome web driver. | 加载 Chrome Driver.
  settings.selenium.cli_args['webdriver.chrome.driver'] = `${path.resolve()}/node_modules/selenium-standalone/.selenium/chromedriver/${seleniumConfig.driver.chrome.version}-${seleniumConfig.driver.chrome.arch}-chromedriver`

  // Attach IE web driver. | 加载 IE Driver.
  settings.selenium.cli_args['webdriver.ie.driver'] = `${path.resolve()}/node_modules/selenium-standalone/.selenium/iedriver/${seleniumConfig.driver.ie.version}-${seleniumConfig.driver.ie.arch}-IEDriverServer.exe`

  // Attach Phantom.JS. | 设置 Phantom.JS.
  settings.test_settings.default.desiredCapabilities['phantomjs.binary.path'] = phantomjs.path

  // Setup browser that runs testing. | 设置使用的浏览器.
  settings.test_settings.default.desiredCapabilities.browserName = browser

  return settings
})(require('./nightwatch.json'))
github rkavalap / NightWatchTest / nightwatch.conf.js View on Github external
fs.readdirSync(dirname)
        .filter(isJson)
        .forEach(saveSetting);
}


//  main  //

configs = checkConfigPath("./configs/defaults");

deployments = checkConfigPath("./configs/deployments");

capabilities = checkConfigPath("./configs/capabilities");

capabilities["localchrome"].selenium.cli_args["webdriver.chrome.driver"] += SUFFIX;

mergeDeploymentAndCapabilitiesJson();

doEnvironments(resolve(__dirname, "configs/TestConfigData"));

module.exports = configs;
github nightwatchjs / nightwatch / lib / runner / cli / clirunner.js View on Github external
var demoObj = '{\n' +
        '  "cli_args": {\n' +
        '    "'+ Logger.colors.yellow(newSettingName) +'": ""\n' +
        '  }\n' +
        '}';

      console.log(demoObj, '\n');
    };

    if (this.test_settings.firefox_profile) {
      deprecationNotice('firefox_profile', 'webdriver.firefox.profile');
      this.settings.selenium.cli_args['webdriver.firefox.profile'] = this.test_settings.firefox_profile;
    }
    if (this.test_settings.chrome_driver) {
      deprecationNotice('chrome_driver', 'webdriver.chrome.driver');
      this.settings.selenium.cli_args['webdriver.chrome.driver'] = this.test_settings.chrome_driver;
    }
    if (this.test_settings.ie_driver) {
      deprecationNotice('ie_driver', 'webdriver.ie.driver');
      this.settings.selenium.cli_args['webdriver.ie.driver'] = this.test_settings.ie_driver;
    }

    return this;
  },
github cyclejs-community / xstream-boilerplate / nightwatch.conf.js View on Github external
module.exports = (function (settings) {
  if (process.platform === 'win32') {
    settings.selenium.cli_args['webdriver.chrome.driver'] =
      './node_modules/.bin/chromedriver.cmd'
  }
  return settings
})(require('./nightwatch.js'))

webdriver

A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol

MIT
Latest version published 4 days ago

Package Health Score

100 / 100
Full package analysis