utilities for parsing shorthand Selenium capabilities objects
npm install desired-capabilitiesTools for generating Selenium browser specs from shorthand strings and objects.
```
npm install desired-capabilities
``
browser(@versions)?(:platforms)?
where:
* versions can either be a single version or an inclusive numeric range instart..end
the form .platforms
* can be one or more comma-separated platform names orxp
shorthands, such as or win7.
###### Examples
`js
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.
and platform values, using the
same logic as the string parser.###### Examples
`js
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'
}
]);
`
$3
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
`js
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'
},
]
);
``