How to use the chromedriver.start function in chromedriver

To help you get started, we’ve selected a few chromedriver 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 B1naryStudio / CodeDoc / test / e2e.js View on Github external
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
import homeStyles from '../app/components/Home.module.css';
import counterStyles from '../app/components/Counter.module.css';

chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);

const delay = time => new Promise(resolve => setTimeout(resolve, time));

describe('main window', function spec() {
  this.timeout(5000);

  before(async () => {
    await delay(1000); // wait chromedriver start time
    this.driver = new webdriver.Builder()
      .usingServer('http://localhost:9515')
      .withCapabilities({
        chromeOptions: {
          binary: electronPath,
          args: ['app=' + path.resolve()]
        }
github zeit / next.js / test / jest-environment.js View on Github external
async createBrowser() {
    // always create new browser session if not BrowserStack
    if (!browser) {
      if (!isBrowserStack) {
        driverPort = await getPort()
        chromedriver.start([`--port=${driverPort}`])

        // https://github.com/giggio/node-chromedriver/issues/117
        await waitPort({
          port: driverPort,
          timeout: 1000 * 60 * 2, // 2 Minutes
        })
      }

      browser = wd.promiseChainRemote(
        ...(isBrowserStack
          ? [
              'hub-cloud.browserstack.com', // seleniumHost
              80, // seleniumPort
              BROWSERSTACK_USERNAME,
              BROWSERSTACK_ACCESS_KEY,
            ]
github epicallan / tv-chicken / test / e2e.js View on Github external
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
import homeStyles from '../app/components/Home.module.css';
import counterStyles from '../app/components/Counter.module.css';

chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);

const delay = time => new Promise(resolve => setTimeout(resolve, time));

describe.skip('main window', function spec() {
  this.timeout(5000);

  before(async () => {
    await delay(1000); // wait chromedriver start time
    this.driver = new webdriver.Builder()
      .usingServer('http://localhost:9515')
      .withCapabilities({
        chromeOptions: {
          binary: electronPath,
          args: ['app=' + path.resolve()]
        }
github freedomofpress / sunder / test / e2e.js View on Github external
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';

chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);

const delay = time => new Promise(resolve => setTimeout(resolve, time));

describe('main window', function spec() {
  this.timeout(5000);
  let shares; // Store the generated shares for recovery
  const quorum = 2;
  const numShares = 3;
  const secret = 'test secret';

  before(async () => {
    await delay(1000); // wait chromedriver start time
    this.driver = new webdriver.Builder()
      .usingServer('http://localhost:9515')
      .withCapabilities({
github experimentalDataAesthetics / play-splom / test / e2e.js View on Github external
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
import homeStyles from '../app/components/Home.css';
import counterStyles from '../app/components/Counter.css';

chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);

const delay = time => new Promise(resolve => setTimeout(resolve, time));

describe('main window', function spec() {
  this.timeout(5000);

  before(async () => {
    await delay(1000); // wait chromedriver start time
    this.driver = new webdriver.Builder()
      .usingServer('http://localhost:9515')
      .withCapabilities({
        chromeOptions: {
          binary: electronPath,
          args: [`app=${path.resolve()}`]
        }
github brave / brave-browser / test / func.ts View on Github external
export function startChromeDriver () {
  if (chromedriverIsStarted) return Promise.resolve()
  chromedriver.start()
  process.on('exit', () => {
    chromedriver.stop()
  })
  chromedriverIsStarted = true
  return delay(1000)
}
github bertolo1988 / flight-scrappper / src / FlightDataScrapper.js View on Github external
startBrowser(browser) {
        var driver = new Webdriver.Builder()
            .forBrowser(browser)
            .build();
        chromedriver.start();
        return driver;
    }
github bertolo1988 / flight-scrappper / src / momondo-scrappper.js View on Github external
function startBrowser(browserName, cdriverArgs) {
        browser = browserName || browser;
        chromedriverArgs = cdriverArgs || chromedriverArgs;
        chromedriver.start(chromedriverArgs);
        driver = new Webdriver.Builder()
            .forBrowser(browser)
            .build();
    }
github browserless / chrome / src / chrome-helper.ts View on Github external
return new Promise(async (resolve, reject) => {
    const port = await getPort();
    let iBrowser = null;
    const flags = ['--url-base=webdriver', '--verbose', `--port=${port}`, '--whitelisted-ips'];
    debug(`Launching ChromeDriver with args: ${JSON.stringify(flags)}`);

    const chromeProcess: ChildProcess = await chromeDriver.start(flags, true);
    const findPort = new Transform({
      transform: async (chunk, _, done) => {
        const message = chunk.toString();
        const match = message.match(/DevTools listening on (ws:\/\/.*)/);

        if (match) {
          chromeProcess.stderr && chromeProcess.stderr.unpipe(findPort);
          const [, wsEndpoint] = match;
          debug(`Attaching to chromedriver browser on ${wsEndpoint}`);

          const browser: puppeteer.Browser = await puppeteer.connect({ browserWSEndpoint: wsEndpoint });

          iBrowser = await setupBrowser({
            blockAds,
            browser,
            browserlessDataDir: null,