-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
30 lines (25 loc) · 804 Bytes
/
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
'use strict'
const Driver = require('./lib/core').Driver
const ExpectedConditions = require('./lib/core').ExpectedConditions
const Wait = require('./lib/wait')
const ChromeService = require('./lib/chrome_service').ChromeService
const debug = require('debug')('chrominator')
module.exports = function (options, callback) {
if (typeof options === 'function') {
callback = options
options = undefined
}
var service = new ChromeService(options)
service.start().then((driver) => {
return callback(driver)
}).then(() => {
service.stop()
}).catch((err) => {
console.error(err.stack || err)
service.stop()
})
}
module.exports.Driver = Driver
module.exports.ChromeService = ChromeService
module.exports.ExpectedConditions = ExpectedConditions
module.exports.Wait = Wait