Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
/ webdriver-ts Public archive

A lowlevel webdriver implementation in typescript

License

Notifications You must be signed in to change notification settings

KnisterPeter/webdriver-ts

Repository files navigation

webdriver-ts

GitHub license Travis npm Commitizen friendly Greenkeeper badge

A lowlevel selenium implementation in typescript.

Features

Usage

Installation

Install as npm package:

npm install webdriver-ts --save

Install latest development version:

npm install webdriver-ts@next --save

API

import { Pretend } from 'pretend';
import { SeleniumApi } from 'webdriver-ts';

async function local() {
  const browser = Pretend.builder().target(SeleniumApi, 'http://localhost:4444/wd/hub');
  const session = await api.newSession({
    desiredCapabilities: {
      browserName: 'firefox'
    }
  });
  const response = await api.get(session.sessionId, {url: 'https://www.google.com'});
  await api.deleteSession(session.sessionId);
}

async function sauceLabs() {
  const browser = Pretend.builder()
    .basicAuthentication('username', 'access-key')
    .target(SeleniumApi, 'http://ondemand.saucelabs.com/wd/hub');
  const session = await api.newSession({
    desiredCapabilities: {
      'browserName': 'firefox'
    }
  });
  const response = await api.get(session.sessionId, {url: 'https://www.google.com'});
  await api.deleteSession(session.sessionId);
}

async function browserStack() {
  const browser = Pretend.builder().target(SeleniumApi, 'https://hub.browserstack.com/wd/hub');
  const session = await api.newSession({
    desiredCapabilities: {
      'browserName': 'firefox',
      'browserstack.user': 'xxx',
      'browserstack.key' : 'yyy'
    }
  });
  const response = await api.get(session.sessionId, {url: 'https://www.google.com'});
  await api.deleteSession(session.sessionId);
}

Thanks to SauceLabs and BrowserStack for a free test account.

About

A lowlevel webdriver implementation in typescript

Resources

License

Stars

Watchers

Forks

Packages

No packages published