How to use the webdriver-manager.GeckoDriver 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
throw new 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 {
          this.config_.geckoDriver = new GeckoDriver().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_.geckoDriver)) {
        if (fs.existsSync(this.config_.geckoDriver + '.exe')) {
          this.config_.geckoDriver += '.exe';
        } else {
          throw new BrowserError(
              logger,
              'Could not find gecko driver at ' + this.config_.geckoDriver +
                  '. 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.');
        }

        const chromeService =
            (new ServiceBuilderForChrome(chromeDriverFile) as ServiceBuilderForChrome).build();
        driver = await DriverForChrome.createSession(
            new Capabilities(this.config_.capabilities), chromeService);
        break;
      case 'firefox':
        let geckoDriverFile: string;
        if (this.config_.geckoDriver) {
          geckoDriverFile = this.config_.geckoDriver;
        } else {
          try {
            geckoDriverFile = new GeckoDriver().getBinaryPath();
          } catch (e) {
            throw new BrowserError(
                logger, 'Run \'webdriver-manager update\' to download binaries.');
          }
        }

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

        let firefoxService = new SerivceBuilderForFirefox(geckoDriverFile).build();
        driver = await DriverForFirefox.createSession(
            new Capabilities(this.config_.capabilities), firefoxService);