selenium-webdriver 4.0.0-alpha.7 → 4.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Licensed to the Software Freedom Conservancy (SFC) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The SFC licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ class CDPConnection {
21
+ constructor(wsConnection) {
22
+ this._wsConnection = wsConnection
23
+ }
24
+
25
+ execute(method, id, params, callback) {
26
+ const message = {
27
+ method,
28
+ id: id,
29
+ }
30
+
31
+ const mergedMessage = Object.assign({ params: params }, message)
32
+
33
+ this._wsConnection.send(JSON.stringify(mergedMessage), callback)
34
+ }
35
+ }
36
+
37
+ exports.CdpConnection = CDPConnection
@@ -0,0 +1,429 @@
1
+ 'use strict'
2
+ var __spreadArrays =
3
+ (this && this.__spreadArrays) ||
4
+ function () {
5
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
6
+ s += arguments[i].length
7
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
8
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
9
+ r[k] = a[j]
10
+ return r
11
+ }
12
+ exports.__esModule = true
13
+ var fs = require('fs')
14
+ var path = require('path')
15
+ console.log(process.argv)
16
+ // TODO: @noj validate this via https://github.com/andischerer/typescript-json-typesafe against protocol-schema.d.ts
17
+ var jsProtocol = JSON.parse(fs.readFileSync(process.argv[3]))
18
+ var browserProtocol = JSON.parse(fs.readFileSync(process.argv[2]))
19
+ var protocolDomains = jsProtocol.domains.concat(browserProtocol.domains)
20
+ var numIndents = 0
21
+ var emitStr = ''
22
+ var emit = function (str) {
23
+ emitStr += str
24
+ }
25
+ var getIndent = function () {
26
+ return ' '.repeat(numIndents)
27
+ } // 4 spaced indents
28
+ var emitIndent = function () {
29
+ emitStr += getIndent()
30
+ }
31
+ var emitLine = function (str) {
32
+ if (str) {
33
+ emitIndent()
34
+ emit(str + '\n')
35
+ } else {
36
+ emit('\n')
37
+ }
38
+ }
39
+ var emitOpenBlock = function (str, openChar) {
40
+ if (openChar === void 0) {
41
+ openChar = ' {'
42
+ }
43
+ emitLine('' + str + openChar)
44
+ numIndents++
45
+ }
46
+ var emitCloseBlock = function (closeChar) {
47
+ if (closeChar === void 0) {
48
+ closeChar = '}'
49
+ }
50
+ numIndents--
51
+ emitLine(closeChar)
52
+ }
53
+ var emitHeaderComments = function () {
54
+ emitLine(
55
+ '/**********************************************************************'
56
+ )
57
+ emitLine(
58
+ ' * Auto-generated by protocol-dts-generator.ts, do not edit manually. *'
59
+ )
60
+ emitLine(
61
+ ' **********************************************************************/'
62
+ )
63
+ emitLine()
64
+ }
65
+ var fixCamelCase = function (name) {
66
+ var prefix = ''
67
+ var result = name
68
+ if (name[0] === '-') {
69
+ prefix = 'Negative'
70
+ result = name.substring(1)
71
+ }
72
+ var refined = result.split('-').map(toTitleCase).join('')
73
+ return (
74
+ prefix +
75
+ refined.replace(/HTML|XML|WML|API/i, function (match) {
76
+ return match.toUpperCase()
77
+ })
78
+ )
79
+ }
80
+ var emitEnum = function (enumName, enumValues) {
81
+ emitOpenBlock('export const enum ' + enumName)
82
+ enumValues.forEach(function (value) {
83
+ emitLine(fixCamelCase(value) + " = '" + value + "',")
84
+ })
85
+ emitCloseBlock()
86
+ }
87
+ var emitModule = function (moduleName, domains) {
88
+ moduleName = toTitleCase(moduleName)
89
+ emitHeaderComments()
90
+ emitOpenBlock('export namespace ' + moduleName)
91
+ emitGlobalTypeDefs()
92
+ domains.forEach(emitDomain)
93
+ emitCloseBlock()
94
+ emitLine()
95
+ emitLine('export default ' + moduleName + ';')
96
+ }
97
+ var emitGlobalTypeDefs = function () {
98
+ emitLine()
99
+ emitLine('export type integer = number')
100
+ }
101
+ var emitDomain = function (domain) {
102
+ var domainName = toTitleCase(domain.domain)
103
+ emitLine()
104
+ emitDescription(domain.description)
105
+ emitOpenBlock('export namespace ' + domainName)
106
+ if (domain.types) domain.types.forEach(emitDomainType)
107
+ if (domain.commands) domain.commands.forEach(emitCommand)
108
+ if (domain.events) domain.events.forEach(emitEvent)
109
+ emitCloseBlock()
110
+ }
111
+ var getCommentLines = function (description) {
112
+ var lines = description.split(/\r?\n/g).map(function (line) {
113
+ return ' * ' + line
114
+ })
115
+ return __spreadArrays(['/**'], lines, [' */'])
116
+ }
117
+ var emitDescription = function (description) {
118
+ if (description)
119
+ getCommentLines(description).map(function (l) {
120
+ return emitLine(l)
121
+ })
122
+ }
123
+ var isPropertyInlineEnum = function (prop) {
124
+ if ('$ref' in prop) {
125
+ return false
126
+ }
127
+ return (
128
+ prop.type === 'string' &&
129
+ prop['enum'] !== null &&
130
+ prop['enum'] !== undefined
131
+ )
132
+ }
133
+ var getPropertyDef = function (interfaceName, prop) {
134
+ // Quote key if it has a . in it.
135
+ var propName = prop.name.includes('.') ? "'" + prop.name + "'" : prop.name
136
+ var type = getPropertyType(interfaceName, prop)
137
+ return '' + propName + (prop.optional ? '?' : '') + ': ' + type
138
+ }
139
+ var getPropertyType = function (interfaceName, prop) {
140
+ if ('$ref' in prop) return prop.$ref
141
+ else if (prop.type === 'array')
142
+ return getPropertyType(interfaceName, prop.items) + '[]'
143
+ else if (prop.type === 'object')
144
+ if (!prop.properties) {
145
+ // TODO: actually 'any'? or can use generic '[key: string]: string'?
146
+ return 'any'
147
+ } else {
148
+ // hack: access indent, \n directly
149
+ var objStr = '{\n'
150
+ numIndents++
151
+ objStr += prop.properties
152
+ .map(function (p) {
153
+ return '' + getIndent() + getPropertyDef(interfaceName, p) + ';\n'
154
+ })
155
+ .join('')
156
+ numIndents--
157
+ objStr += getIndent() + '}'
158
+ return objStr
159
+ }
160
+ else if (prop.type === 'string' && prop['enum'])
161
+ return (
162
+ '(' +
163
+ prop['enum']
164
+ .map(function (v) {
165
+ return "'" + v + "'"
166
+ })
167
+ .join(' | ') +
168
+ ')'
169
+ )
170
+ return prop.type
171
+ }
172
+ var emitProperty = function (interfaceName, prop) {
173
+ var description = prop.description
174
+ if (isPropertyInlineEnum(prop)) {
175
+ var enumName = interfaceName + toTitleCase(prop.name)
176
+ description = (description || '') + ' (' + enumName + ' enum)'
177
+ }
178
+ emitDescription(description)
179
+ emitLine(getPropertyDef(interfaceName, prop) + ';')
180
+ }
181
+ var emitInlineEnumForDomainType = function (type) {
182
+ if (type.type === 'object') {
183
+ emitInlineEnums(type.id, type.properties)
184
+ }
185
+ }
186
+ var emitInlineEnumsForCommands = function (command) {
187
+ emitInlineEnums(toCmdRequestName(command.name), command.parameters)
188
+ emitInlineEnums(toCmdResponseName(command.name), command.returns)
189
+ }
190
+ var emitInlineEnumsForEvents = function (event) {
191
+ emitInlineEnums(toEventPayloadName(event.name), event.parameters)
192
+ }
193
+ var emitInlineEnums = function (prefix, propertyTypes) {
194
+ if (!propertyTypes) {
195
+ return
196
+ }
197
+ for (
198
+ var _i = 0, propertyTypes_1 = propertyTypes;
199
+ _i < propertyTypes_1.length;
200
+ _i++
201
+ ) {
202
+ var type = propertyTypes_1[_i]
203
+ if (isPropertyInlineEnum(type)) {
204
+ emitLine()
205
+ var enumName = prefix + toTitleCase(type.name)
206
+ emitEnum(enumName, type['enum'] || [])
207
+ }
208
+ }
209
+ }
210
+ var emitInterface = function (interfaceName, props) {
211
+ emitOpenBlock('export interface ' + interfaceName)
212
+ props
213
+ ? props.forEach(function (prop) {
214
+ return emitProperty(interfaceName, prop)
215
+ })
216
+ : emitLine('[key: string]: string;')
217
+ emitCloseBlock()
218
+ }
219
+ var emitDomainType = function (type) {
220
+ emitInlineEnumForDomainType(type)
221
+ emitLine()
222
+ emitDescription(type.description)
223
+ if (type.type === 'object') {
224
+ emitInterface(type.id, type.properties)
225
+ } else {
226
+ emitLine(
227
+ 'export type ' + type.id + ' = ' + getPropertyType(type.id, type) + ';'
228
+ )
229
+ }
230
+ }
231
+ var toTitleCase = function (str) {
232
+ return str[0].toUpperCase() + str.substr(1)
233
+ }
234
+ var toCmdRequestName = function (commandName) {
235
+ return toTitleCase(commandName) + 'Request'
236
+ }
237
+ var toCmdResponseName = function (commandName) {
238
+ return toTitleCase(commandName) + 'Response'
239
+ }
240
+ var emitCommand = function (command) {
241
+ emitInlineEnumsForCommands(command)
242
+ // TODO(bckenny): should description be emitted for params and return types?
243
+ if (command.parameters) {
244
+ emitLine()
245
+ emitInterface(toCmdRequestName(command.name), command.parameters)
246
+ }
247
+ if (command.returns) {
248
+ emitLine()
249
+ emitInterface(toCmdResponseName(command.name), command.returns)
250
+ }
251
+ }
252
+ var toEventPayloadName = function (eventName) {
253
+ return toTitleCase(eventName) + 'Event'
254
+ }
255
+ var emitEvent = function (event) {
256
+ if (!event.parameters) {
257
+ return
258
+ }
259
+ emitInlineEnumsForEvents(event)
260
+ emitLine()
261
+ emitDescription(event.description)
262
+ emitInterface(toEventPayloadName(event.name), event.parameters)
263
+ }
264
+ var getEventMapping = function (event, domainName, modulePrefix) {
265
+ // Use TS3.0+ tuples
266
+ var payloadType = event.parameters
267
+ ? '[' +
268
+ modulePrefix +
269
+ '.' +
270
+ domainName +
271
+ '.' +
272
+ toEventPayloadName(event.name) +
273
+ ']'
274
+ : '[]'
275
+ return {
276
+ // domain-prefixed name since it will be used outside of the module.
277
+ name: domainName + '.' + event.name,
278
+ description: event.description,
279
+ $ref: payloadType,
280
+ }
281
+ }
282
+ var isWeakInterface = function (params) {
283
+ return params.every(function (p) {
284
+ return !!p.optional
285
+ })
286
+ }
287
+ var getCommandMapping = function (command, domainName, modulePrefix) {
288
+ var prefix = modulePrefix + '.' + domainName + '.'
289
+ // Use TS3.0+ tuples for paramsType
290
+ var requestType = '[]'
291
+ if (command.parameters) {
292
+ var optional = isWeakInterface(command.parameters) ? '?' : ''
293
+ requestType = '[' + prefix + toCmdRequestName(command.name) + optional + ']'
294
+ }
295
+ var responseType = command.returns
296
+ ? prefix + toCmdResponseName(command.name)
297
+ : 'void'
298
+ return {
299
+ type: 'object',
300
+ name: domainName + '.' + command.name,
301
+ description: command.description,
302
+ properties: [
303
+ {
304
+ name: 'paramsType',
305
+ $ref: requestType,
306
+ },
307
+ {
308
+ name: 'returnType',
309
+ $ref: responseType,
310
+ },
311
+ ],
312
+ }
313
+ }
314
+ var flatten = function (arr) {
315
+ var _a
316
+ return (_a = []).concat.apply(_a, arr)
317
+ }
318
+ var emitMapping = function (moduleName, protocolModuleName, domains) {
319
+ moduleName = toTitleCase(moduleName)
320
+ emitHeaderComments()
321
+ emitLine("import Protocol from './" + protocolModuleName + "'")
322
+ emitLine()
323
+ emitDescription(
324
+ 'Mappings from protocol event and command names to the types required for them.'
325
+ )
326
+ emitOpenBlock('export namespace ' + moduleName)
327
+ var protocolModulePrefix = toTitleCase(protocolModuleName)
328
+ var eventDefs = flatten(
329
+ domains.map(function (d) {
330
+ var domainName = toTitleCase(d.domain)
331
+ return (d.events || []).map(function (e) {
332
+ return getEventMapping(e, domainName, protocolModulePrefix)
333
+ })
334
+ })
335
+ )
336
+ emitInterface('Events', eventDefs)
337
+ emitLine()
338
+ var commandDefs = flatten(
339
+ domains.map(function (d) {
340
+ var domainName = toTitleCase(d.domain)
341
+ return (d.commands || []).map(function (c) {
342
+ return getCommandMapping(c, domainName, protocolModulePrefix)
343
+ })
344
+ })
345
+ )
346
+ emitInterface('Commands', commandDefs)
347
+ emitCloseBlock()
348
+ emitLine()
349
+ emitLine('export default ' + moduleName + ';')
350
+ }
351
+ var emitApiCommand = function (command, domainName, modulePrefix) {
352
+ var prefix = modulePrefix + '.' + domainName + '.'
353
+ emitDescription(command.description)
354
+ var params = command.parameters
355
+ ? 'params: ' + prefix + toCmdRequestName(command.name)
356
+ : ''
357
+ var response = command.returns
358
+ ? '' + prefix + toCmdResponseName(command.name)
359
+ : 'void'
360
+ emitLine(command.name + '(' + params + '): Promise<' + response + '>;')
361
+ emitLine()
362
+ }
363
+ var emitApiEvent = function (event, domainName, modulePrefix) {
364
+ var prefix = modulePrefix + '.' + domainName + '.'
365
+ emitDescription(event.description)
366
+ var params = event.parameters
367
+ ? 'params: ' + prefix + toEventPayloadName(event.name)
368
+ : ''
369
+ emitLine(
370
+ "on(event: '" + event.name + "', listener: (" + params + ') => void): void;'
371
+ )
372
+ emitLine()
373
+ }
374
+ var emitDomainApi = function (domain, modulePrefix) {
375
+ emitLine()
376
+ var domainName = toTitleCase(domain.domain)
377
+ emitOpenBlock('export interface ' + domainName + 'Api')
378
+ if (domain.commands)
379
+ domain.commands.forEach(function (c) {
380
+ return emitApiCommand(c, domainName, modulePrefix)
381
+ })
382
+ if (domain.events)
383
+ domain.events.forEach(function (e) {
384
+ return emitApiEvent(e, domainName, modulePrefix)
385
+ })
386
+ emitCloseBlock()
387
+ }
388
+ var emitApi = function (moduleName, protocolModuleName, domains) {
389
+ moduleName = toTitleCase(moduleName)
390
+ emitHeaderComments()
391
+ emitLine("import Protocol from './" + protocolModuleName + "'")
392
+ emitLine()
393
+ emitDescription('API generated from Protocol commands and events.')
394
+ emitOpenBlock('export namespace ' + moduleName)
395
+ emitLine()
396
+ emitOpenBlock('export interface ProtocolApi')
397
+ domains.forEach(function (d) {
398
+ emitLine(d.domain + ': ' + d.domain + 'Api;')
399
+ emitLine()
400
+ })
401
+ emitCloseBlock()
402
+ emitLine()
403
+ var protocolModulePrefix = toTitleCase(protocolModuleName)
404
+ domains.forEach(function (d) {
405
+ return emitDomainApi(d, protocolModulePrefix)
406
+ })
407
+ emitCloseBlock()
408
+ emitLine()
409
+ emitLine('export default ' + moduleName + ';')
410
+ }
411
+ var flushEmitToFile = function (path) {
412
+ console.log('Writing to ' + path)
413
+ fs.writeFileSync(path, emitStr, { encoding: 'utf-8' })
414
+ numIndents = 0
415
+ emitStr = ''
416
+ }
417
+ // Main
418
+ var destProtocolFilePath = process.argv[4]
419
+ var protocolModuleName = path.basename(destProtocolFilePath, '.d.js')
420
+ emitModule(protocolModuleName, protocolDomains)
421
+ flushEmitToFile(destProtocolFilePath)
422
+ var destMappingFilePath = process.argv[5]
423
+ var mappingModuleName = 'ProtocolMapping'
424
+ emitMapping(mappingModuleName, protocolModuleName, protocolDomains)
425
+ flushEmitToFile(destMappingFilePath)
426
+ var destApiFilePath = process.argv[6]
427
+ var apiModuleName = 'ProtocolProxyApi'
428
+ emitApi(apiModuleName, protocolModuleName, protocolDomains)
429
+ flushEmitToFile(destApiFilePath)
package/edge.js CHANGED
@@ -80,19 +80,18 @@
80
80
  * [WebDriver (Chromium)]: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium
81
81
  */
82
82
 
83
- 'use strict';
83
+ 'use strict'
84
84
 
85
- const http = require('./http');
86
- const io = require('./io');
87
- const remote = require('./remote');
88
- const webdriver = require('./lib/webdriver');
89
- const {Browser, Capabilities} = require('./lib/capabilities');
90
- const chromium = require('./chromium');
85
+ const http = require('./http')
86
+ const io = require('./io')
87
+ const webdriver = require('./lib/webdriver')
88
+ const { Browser, Capabilities } = require('./lib/capabilities')
89
+ const chromium = require('./chromium')
91
90
 
92
- const EDGE_CHROMIUM_BROWSER_NAME = "msedge";
93
- const EDGEDRIVER_LEGACY_EXE = 'MicrosoftWebDriver.exe';
91
+ const EDGE_CHROMIUM_BROWSER_NAME = 'msedge'
92
+ const EDGEDRIVER_LEGACY_EXE = 'MicrosoftWebDriver.exe'
94
93
  const EDGEDRIVER_CHROMIUM_EXE =
95
- process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver';
94
+ process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver'
96
95
 
97
96
  /**
98
97
  * _Synchronously_ attempts to locate the Edge driver executable
@@ -104,17 +103,17 @@ const EDGEDRIVER_CHROMIUM_EXE =
104
103
  * @return {?string} the located executable, or `null`.
105
104
  */
106
105
  function locateSynchronously(browserName) {
107
- browserName = browserName || Browser.EDGE;
106
+ browserName = browserName || Browser.EDGE
108
107
 
109
108
  if (browserName === EDGE_CHROMIUM_BROWSER_NAME) {
110
- return io.findInPath(EDGEDRIVER_CHROMIUM_EXE, true);
109
+ return io.findInPath(EDGEDRIVER_CHROMIUM_EXE, true)
111
110
  }
112
111
 
113
112
  return process.platform === 'win32'
114
- ? io.findInPath(EDGEDRIVER_LEGACY_EXE, true) : null;
113
+ ? io.findInPath(EDGEDRIVER_LEGACY_EXE, true)
114
+ : null
115
115
  }
116
116
 
117
-
118
117
  /**
119
118
  * Class for managing Edge specific options.
120
119
  */
@@ -127,15 +126,15 @@ class Options extends chromium.Options {
127
126
  * @return {!Options} A self reference.
128
127
  */
129
128
  setEdgeChromium(useEdgeChromium) {
130
- this.set(Options.USE_EDGE_CHROMIUM, !!useEdgeChromium);
131
- return this;
129
+ this.set(Options.USE_EDGE_CHROMIUM, !!useEdgeChromium)
130
+ return this
132
131
  }
133
132
  }
134
133
 
135
- Options.USE_EDGE_CHROMIUM = 'ms:edgeChromium';
136
- Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE;
137
- Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions';
138
- Options.prototype.VENDOR_CAPABILITY_PREFIX = 'ms';
134
+ Options.USE_EDGE_CHROMIUM = 'ms:edgeChromium'
135
+ Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
136
+ Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
137
+ Options.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
139
138
 
140
139
  /**
141
140
  * @param {(Capabilities|Object<string, *>)=} o The options object
@@ -143,17 +142,16 @@ Options.prototype.VENDOR_CAPABILITY_PREFIX = 'ms';
143
142
  */
144
143
  function useEdgeChromium(o) {
145
144
  if (o instanceof Capabilities) {
146
- return !!o.get(Options.USE_EDGE_CHROMIUM);
145
+ return !!o.get(Options.USE_EDGE_CHROMIUM)
147
146
  }
148
147
 
149
148
  if (o && typeof o === 'object') {
150
- return !!o[Options.USE_EDGE_CHROMIUM];
149
+ return !!o[Options.USE_EDGE_CHROMIUM]
151
150
  }
152
151
 
153
- return false;
152
+ return false
154
153
  }
155
154
 
156
-
157
155
  /**
158
156
  * Creates {@link remote.DriverService} instances that manage a
159
157
  * WebDriver server in a child process. Used for driving both
@@ -171,22 +169,24 @@ class ServiceBuilder extends chromium.ServiceBuilder {
171
169
  * MicrosoftWebDriver cannot be found on the PATH.
172
170
  */
173
171
  constructor(opt_exe) {
174
- let exe = opt_exe || locateSynchronously();
172
+ let exe = opt_exe || locateSynchronously()
175
173
  if (!exe) {
176
- throw Error('The WebDriver for Edge could not be found on the current PATH. Please ' +
177
- 'download the latest version of ' + EDGEDRIVER_LEGACY_EXE + ' from ' +
178
- 'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ and ' +
179
- 'ensure it can be found on your PATH.');
174
+ throw Error(
175
+ 'The WebDriver for Edge could not be found on the current PATH. Please ' +
176
+ 'download the latest version of ' +
177
+ EDGEDRIVER_LEGACY_EXE +
178
+ ' from ' +
179
+ 'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ and ' +
180
+ 'ensure it can be found on your PATH.'
181
+ )
180
182
  }
181
183
 
182
- super(exe);
184
+ super(exe)
183
185
  }
184
186
  }
185
187
 
186
-
187
188
  /** @type {remote.DriverService} */
188
- var defaultService = null;
189
-
189
+ var defaultService = null
190
190
 
191
191
  /**
192
192
  * Sets the default service to use for new Edge instances.
@@ -197,31 +197,31 @@ function setDefaultService(service) {
197
197
  if (defaultService && defaultService.isRunning()) {
198
198
  throw Error(
199
199
  'The previously configured EdgeDriver service is still running. ' +
200
- 'You must shut it down before you may adjust its configuration.');
200
+ 'You must shut it down before you may adjust its configuration.'
201
+ )
201
202
  }
202
- defaultService = service;
203
+ defaultService = service
203
204
  }
204
205
 
205
-
206
206
  /**
207
- * Returns the default Microsoft Edge driver service. If such a service has
207
+ * Returns the default Microsoft Edge driver service. If such a service has
208
208
  * not been configured, one will be constructed using the default configuration
209
209
  * for a MicrosoftWebDriver executable found on the system PATH.
210
210
  * @return {!remote.DriverService} The default Microsoft Edge driver service.
211
211
  */
212
212
  function getDefaultService() {
213
213
  if (!defaultService) {
214
- defaultService = new ServiceBuilder().build();
214
+ defaultService = new ServiceBuilder().build()
215
215
  }
216
- return defaultService;
216
+ return defaultService
217
217
  }
218
218
 
219
219
  function createServiceFromCapabilities(options) {
220
- let exe;
220
+ let exe
221
221
  if (useEdgeChromium(options)) {
222
- exe = locateSynchronously(EDGE_CHROMIUM_BROWSER_NAME);
222
+ exe = locateSynchronously(EDGE_CHROMIUM_BROWSER_NAME)
223
223
  }
224
- return new ServiceBuilder(exe).build();
224
+ return new ServiceBuilder(exe).build()
225
225
  }
226
226
 
227
227
  /**
@@ -232,18 +232,19 @@ class Driver extends webdriver.WebDriver {
232
232
  * Creates a new browser session for Microsoft's Edge browser.
233
233
  *
234
234
  * @param {(Capabilities|Options)=} options The configuration options.
235
- * @param {remote.DriverService=} service The service to use; will create
235
+ * @param {remote.DriverService=} opt_service The service to use; will create
236
236
  * a new Legacy or Chromium service based on {@linkplain Options} by default.
237
237
  * @return {!Driver} A new driver instance.
238
238
  */
239
239
  static createSession(options, opt_service) {
240
- options = options || new Options();
241
- let service = opt_service || createServiceFromCapabilities(options);
242
- let client = service.start().then(url => new http.HttpClient(url));
243
- let executor = new http.Executor(client);
244
-
245
- return /** @type {!Driver} */(super.createSession(
246
- executor, options, () => service.kill()));
240
+ options = options || new Options()
241
+ let service = opt_service || createServiceFromCapabilities(options)
242
+ let client = service.start().then((url) => new http.HttpClient(url))
243
+ let executor = new http.Executor(client)
244
+
245
+ return /** @type {!Driver} */ (super.createSession(executor, options, () =>
246
+ service.kill()
247
+ ))
247
248
  }
248
249
 
249
250
  /**
@@ -254,13 +255,11 @@ class Driver extends webdriver.WebDriver {
254
255
  setFileDetector() {}
255
256
  }
256
257
 
257
-
258
258
  // PUBLIC API
259
259
 
260
-
261
- exports.Driver = Driver;
262
- exports.Options = Options;
263
- exports.ServiceBuilder = ServiceBuilder;
264
- exports.getDefaultService = getDefaultService;
265
- exports.setDefaultService = setDefaultService;
266
- exports.locateSynchronously = locateSynchronously;
260
+ exports.Driver = Driver
261
+ exports.Options = Options
262
+ exports.ServiceBuilder = ServiceBuilder
263
+ exports.getDefaultService = getDefaultService
264
+ exports.setDefaultService = setDefaultService
265
+ exports.locateSynchronously = locateSynchronously