How to use the webdriver-manager.ChromeDriver function in webdriver-manager

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 angular / protractor / lib / driverProviders / local.ts View on Github external
}
    }
    if (!fs.existsSync(this.config_.seleniumServerJar)) {
      throw new 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 {
          this.config_.chromeDriver = new ChromeDriver().getBinaryPath();
        } catch (err) {
          throw new BrowserError(logger, '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 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
async getNewDriver(): Promise {
    let driver: WebDriver;

    switch (this.config_.capabilities.browserName) {
      case 'chrome':
        let chromeDriverFile: string;
        if (this.config_.chromeDriver) {
          chromeDriverFile = this.config_.chromeDriver;
        } else {
          try {
            chromeDriverFile = new ChromeDriver().getBinaryPath();
          } catch (e) {
            throw new BrowserError(
                logger, 'Run \'webdriver-manager update\' to download binaries.');
          }
        }

        if (!fs.existsSync(chromeDriverFile)) {
          throw new BrowserError(
              logger,
              'Could not find chromedriver at ' + chromeDriverFile +
                  '. Run \'webdriver-manager update\' to download binaries.');
        }

        const chromeService =
            (new ServiceBuilderForChrome(chromeDriverFile) as ServiceBuilderForChrome).build();
        driver = await DriverForChrome.createSession(