webdriver-ts
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.0 • Public • Published

    webdriver-ts

    GitHub license Travis David David npm Commitizen friendly

    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.

    Keywords

    none

    Install

    npm i webdriver-ts

    DownloadsWeekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • knisterpeter