Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

desired-capabilities

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

desired-capabilities

utilities for parsing shorthand Selenium capabilities objects

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-17.85%
Maintainers
1
Weekly downloads
 
Created
Source

desired-capabilities

Tools for generating Selenium browser specs from shorthand strings and objects.

Installation

npm install desired-capabilities

Usage

capabilities(str) or capabilities.parse(str)

Parses the a string in the form:

browser(@versions)?(:platforms)?

where:

  • versions can either be a single version or an inclusive numeric range in the form start..end.
  • platforms can be one or more comma-separated platform names or shorthands, such as xp or win7.
Examples
var caps = require('desired-capabilities');
var assert = require('assert');

assert.deepEqual(caps.parse('ie@8:xp'), {
  browserName: 'internet explorer',
  browserVersion: '8',
  platform: 'Windows XP'
});

Consult the Sauce Labs or BrowserStack docs for a list of available browsers and platforms.

capabilities(obj) or capabilities.expand(object)

Returns an array of variations of the provided capabilities object for each of the browserVersion and platform values, using the same logic as the string parser.

Examples
var caps = require('desired-capabilities');
var assert = require('assert');

assert.deepEqual(caps({
  browserName: 'Chrome',
  browserVersion: '8..9'
}), [
  {
    browserName: 'Chrome',
    browserVersion: 8,
    platform: 'any'
  },
  {
    browserName: 'Chrome',
    browserVersion: 9,
    platform: 'any'
  }
]);

capabilities(array)

Expands or parses all of the values in the array to produce one big list of capabilities. The values in the array may be either strings, objects, or nested arrays.

Examples
var caps = require('desired-capabilities');
var assert = require('assert');

assert.deepEqual(
  caps(['phantomjs', 'ie@8..9', 'chrome@40', {
      browserName: 'ff',
      browserVersion: 36
  }]),
  [
    {
      browserName: 'phantomjs',
      browserVersion: 'any',
      platform: 'any'
    },
    {
      browserName: 'internet explorer',
      browserVersion: 8,
      platform: 'any'
    },
    {
      browserName: 'internet explorer',
      browserVersion: 9,
      platform: 'any'
    },
    {
      browserName: 'chrome',
      browserVersion: '40',
      platform: 'any'
    },
    {
      browserName: 'firefox',
      browserVersion: '36'
      platform: 'any'
    },
  ]
);

Keywords

FAQs

Package last updated on 21 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc