forked from webdriverio/webdriverio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (39 loc) · 1.41 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* webdriverjs
* https://github.com/Camme/webdriverjs
*
* A WebDriver module for nodejs. Either use the super easy help commands or use the base
* Webdriver wire protocol commands. Its totally inspired by jellyfishs webdriver, but the
* goal is to make all the webdriver protocol items available, as near the original as possible.
*
* Copyright (c) 2013 Camilo Tapia <[email protected]>
* Licensed under the MIT license.
*
* Contributors:
* Dan Jenkins <[email protected]>
* Christian Bromann <[email protected]>
* Vincent Voyer <[email protected]>
*/
var createSingleton = require('pragma-singleton'),
WebdriverJS = require('./lib/webdriverjs.js'),
package = require('./package.json');
chainIt = require('chainit'),
// expose version number
module.exports.version = package.version;
// use the chained API reference to add static methods
module.exports.remote = function remote(options, Constructor) {
if (typeof options === 'function') {
Constructor = options;
options = {};
} else {
options = options || {};
// allows easy webdriverjs-$framework creation (like webdriverjs-angular)
Constructor = chainIt(Constructor || WebdriverJS);
}
var singleton = createSingleton(Constructor);
if (options.singleton) {
return new singleton(options);
} else {
return new Constructor(options);
}
};