selenium-webdriver 4.17.0 → 4.18.0

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.
Files changed (59) hide show
  1. package/CHANGES.md +236 -196
  2. package/bidi/addInterceptParameters.js +86 -0
  3. package/bidi/browsingContext.js +144 -37
  4. package/bidi/browsingContextInspector.js +13 -40
  5. package/bidi/evaluateResult.js +4 -10
  6. package/bidi/filterBy.js +2 -6
  7. package/bidi/index.js +31 -29
  8. package/bidi/input.js +1 -4
  9. package/bidi/interceptPhase.js +24 -0
  10. package/bidi/logInspector.js +15 -20
  11. package/bidi/network.js +178 -0
  12. package/bidi/networkInspector.js +8 -2
  13. package/bidi/networkTypes.js +22 -49
  14. package/bidi/protocolType.js +3 -9
  15. package/bidi/protocolValue.js +6 -25
  16. package/bidi/realmInfo.js +2 -10
  17. package/bidi/scriptManager.js +20 -59
  18. package/bidi/urlPattern.js +58 -0
  19. package/bin/linux/selenium-manager +0 -0
  20. package/bin/macos/selenium-manager +0 -0
  21. package/bin/windows/selenium-manager.exe +0 -0
  22. package/chrome.js +1 -8
  23. package/chromium.js +27 -109
  24. package/common/driverFinder.js +1 -1
  25. package/common/seleniumManager.js +9 -18
  26. package/devtools/CDPConnection.js +1 -3
  27. package/edge.js +1 -3
  28. package/example/chrome_android.js +2 -5
  29. package/example/chrome_mobile_emulation.js +2 -4
  30. package/example/google_search.js +1 -3
  31. package/example/headless.js +4 -10
  32. package/example/logging.js +3 -9
  33. package/firefox.js +55 -109
  34. package/http/index.js +7 -10
  35. package/ie.js +5 -15
  36. package/index.js +7 -29
  37. package/io/exec.js +1 -2
  38. package/io/index.js +3 -3
  39. package/io/zip.js +8 -30
  40. package/lib/by.js +2 -9
  41. package/lib/capabilities.js +3 -9
  42. package/lib/command.js +3 -3
  43. package/lib/error.js +2 -9
  44. package/lib/http.js +34 -131
  45. package/lib/input.js +10 -34
  46. package/lib/logging.js +3 -11
  47. package/lib/promise.js +2 -7
  48. package/lib/select.js +3 -9
  49. package/lib/until.js +28 -49
  50. package/lib/util.js +1 -4
  51. package/lib/virtual_authenticator.js +4 -22
  52. package/lib/webdriver.js +118 -297
  53. package/lib/webelement.js +1 -5
  54. package/net/index.js +1 -4
  55. package/package.json +2 -1
  56. package/remote/index.js +9 -24
  57. package/remote/util.js +6 -19
  58. package/safari.js +3 -8
  59. package/testing/index.js +6 -11
@@ -40,24 +40,18 @@ const height = 480
40
40
 
41
41
  let driver = new Builder()
42
42
  .forBrowser('chrome')
43
- .setChromeOptions(
44
- new chrome.Options().addArguments('-headless').windowSize({ width, height })
45
- )
46
- .setFirefoxOptions(
47
- new firefox.Options().addArguments('-headless').windowSize({ width, height })
48
- )
43
+ .setChromeOptions(new chrome.Options().addArguments('-headless').windowSize({ width, height }))
44
+ .setFirefoxOptions(new firefox.Options().addArguments('-headless').windowSize({ width, height }))
49
45
  .build()
50
46
 
51
47
  driver
52
48
  .get('http://www.google.com/ncr')
53
- .then((_) =>
54
- driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
55
- )
49
+ .then((_) => driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
56
50
  .then((_) => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
57
51
  .then(
58
52
  (_) => driver.quit(),
59
53
  (e) =>
60
54
  driver.quit().then(() => {
61
55
  throw e
62
- })
56
+ }),
63
57
  )
@@ -40,17 +40,11 @@ logging.getLogger(`${logging.Type.DRIVER}.http`).setLevel(logging.Level.ALL)
40
40
  // Configure the service for each browser to enable verbose logging and
41
41
  // to inherit the stdio settings from the current process. The builder
42
42
  // will only start the service if needed for the selected browser.
43
- .setChromeService(
44
- new chrome.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
45
- )
43
+ .setChromeService(new chrome.ServiceBuilder().enableVerboseLogging().setStdio('inherit'))
46
44
  .setEdgeService(
47
- process.platform === 'win32'
48
- ? new edge.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
49
- : null
50
- )
51
- .setFirefoxService(
52
- new firefox.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
45
+ process.platform === 'win32' ? new edge.ServiceBuilder().enableVerboseLogging().setStdio('inherit') : null,
53
46
  )
47
+ .setFirefoxService(new firefox.ServiceBuilder().enableVerboseLogging().setStdio('inherit'))
54
48
  .build()
55
49
 
56
50
  await driver.get('http://www.google.com/ncr')
package/firefox.js CHANGED
@@ -127,7 +127,7 @@ const FIREFOX_CAPABILITY_KEY = 'moz:firefoxOptions'
127
127
  */
128
128
  class AddonFormatError extends Error {
129
129
  /** @param {string} msg The error message. */
130
- constructor (msg) {
130
+ constructor(msg) {
131
131
  super(msg)
132
132
  /** @override */
133
133
  this.name = this.constructor.name
@@ -141,7 +141,7 @@ class AddonFormatError extends Error {
141
141
  * @return {!Promise<string>} A promise for the add-on ID once
142
142
  * installed.
143
143
  */
144
- async function installExtension (extension, dir) {
144
+ async function installExtension(extension, dir) {
145
145
  const ext = extension.slice(-4)
146
146
  if (ext !== '.xpi' && ext !== '.zip') {
147
147
  throw Error('File name does not end in ".zip" or ".xpi": ' + ext)
@@ -179,7 +179,7 @@ async function installExtension (extension, dir) {
179
179
  }
180
180
 
181
181
  class Profile {
182
- constructor () {
182
+ constructor() {
183
183
  /** @private {?string} */
184
184
  this.template_ = null
185
185
 
@@ -187,7 +187,7 @@ class Profile {
187
187
  this.extensions_ = []
188
188
  }
189
189
 
190
- addExtensions (/** !Array<string> */ paths) {
190
+ addExtensions(/** !Array<string> */ paths) {
191
191
  this.extensions_ = this.extensions_.concat(...paths)
192
192
  }
193
193
 
@@ -195,7 +195,7 @@ class Profile {
195
195
  * @return {(!Promise<string>|undefined)} a promise for a base64 encoded
196
196
  * profile, or undefined if there's no data to include.
197
197
  */
198
- [Symbols.serialize] () {
198
+ [Symbols.serialize]() {
199
199
  if (this.template_ || this.extensions_.length) {
200
200
  return buildProfile(this.template_, this.extensions_)
201
201
  }
@@ -209,17 +209,13 @@ class Profile {
209
209
  * profile.
210
210
  * @return {!Promise<string>} a promise for the base64 encoded profile.
211
211
  */
212
- async function buildProfile (template, extensions) {
212
+ async function buildProfile(template, extensions) {
213
213
  let dir = template
214
214
 
215
215
  if (extensions.length) {
216
216
  dir = await io.tmpDir()
217
217
  if (template) {
218
- await io.copyDir(
219
- /** @type {string} */ (template),
220
- dir,
221
- /(parent\.lock|lock|\.parentlock)/
222
- )
218
+ await io.copyDir(/** @type {string} */ (template), dir, /(parent\.lock|lock|\.parentlock)/)
223
219
  }
224
220
 
225
221
  const extensionsDir = path.join(dir, 'extensions')
@@ -245,7 +241,7 @@ class Options extends Capabilities {
245
241
  * @param {(Capabilities|Map<string, ?>|Object)=} other Another set of
246
242
  * capabilities to initialize this instance from.
247
243
  */
248
- constructor (other) {
244
+ constructor(other) {
249
245
  super(other)
250
246
  this.setBrowserName(Browser.FIREFOX)
251
247
  }
@@ -254,7 +250,7 @@ class Options extends Capabilities {
254
250
  * @return {!Object}
255
251
  * @private
256
252
  */
257
- firefoxOptions_ () {
253
+ firefoxOptions_() {
258
254
  let options = this.get(FIREFOX_CAPABILITY_KEY)
259
255
  if (!options) {
260
256
  options = {}
@@ -267,7 +263,7 @@ class Options extends Capabilities {
267
263
  * @return {!Profile}
268
264
  * @private
269
265
  */
270
- profile_ () {
266
+ profile_() {
271
267
  let options = this.firefoxOptions_()
272
268
  if (!options.profile) {
273
269
  options.profile = new Profile()
@@ -282,7 +278,7 @@ class Options extends Capabilities {
282
278
  * @param {...(string|!Array<string>)} args The arguments to include.
283
279
  * @return {!Options} A self reference.
284
280
  */
285
- addArguments (...args) {
281
+ addArguments(...args) {
286
282
  if (args.length) {
287
283
  let options = this.firefoxOptions_()
288
284
  options.args = options.args ? options.args.concat(...args) : args
@@ -298,8 +294,8 @@ class Options extends Capabilities {
298
294
  * @throws {TypeError} if width or height is unspecified, not a number, or
299
295
  * less than or equal to 0.
300
296
  */
301
- windowSize ({ width, height }) {
302
- function checkArg (arg) {
297
+ windowSize({ width, height }) {
298
+ function checkArg(arg) {
303
299
  if (typeof arg !== 'number' || arg <= 0) {
304
300
  throw TypeError('Arguments must be {width, height} with numbers > 0')
305
301
  }
@@ -316,7 +312,7 @@ class Options extends Capabilities {
316
312
  * @param {...string} paths The paths to the extension XPI files to install.
317
313
  * @return {!Options} A self reference.
318
314
  */
319
- addExtensions (...paths) {
315
+ addExtensions(...paths) {
320
316
  this.profile_().addExtensions(paths)
321
317
  return this
322
318
  }
@@ -327,18 +323,12 @@ class Options extends Capabilities {
327
323
  * @return {!Options} A self reference.
328
324
  * @throws {TypeError} if either the key or value has an invalid type.
329
325
  */
330
- setPreference (key, value) {
326
+ setPreference(key, value) {
331
327
  if (typeof key !== 'string') {
332
328
  throw TypeError(`key must be a string, but got ${typeof key}`)
333
329
  }
334
- if (
335
- typeof value !== 'string' &&
336
- typeof value !== 'number' &&
337
- typeof value !== 'boolean'
338
- ) {
339
- throw TypeError(
340
- `value must be a string, number, or boolean, but got ${typeof value}`
341
- )
330
+ if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {
331
+ throw TypeError(`value must be a string, number, or boolean, but got ${typeof value}`)
342
332
  }
343
333
  let options = this.firefoxOptions_()
344
334
  options.prefs = options.prefs || {}
@@ -355,7 +345,7 @@ class Options extends Capabilities {
355
345
  * @return {!Options} A self reference.
356
346
  * @throws {TypeError} if profile is not a string.
357
347
  */
358
- setProfile (profile) {
348
+ setProfile(profile) {
359
349
  if (typeof profile !== 'string') {
360
350
  throw TypeError(`profile must be a string, but got ${typeof profile}`)
361
351
  }
@@ -371,7 +361,7 @@ class Options extends Capabilities {
371
361
  * @return {!Options} A self reference.
372
362
  * @throws {TypeError} If `binary` is an invalid type.
373
363
  */
374
- setBinary (binary) {
364
+ setBinary(binary) {
375
365
  if (binary instanceof Channel || typeof binary === 'string') {
376
366
  this.firefoxOptions_().binary = binary
377
367
  return this
@@ -385,11 +375,7 @@ class Options extends Capabilities {
385
375
  * @param {string} androidPackage The package to use
386
376
  * @return {!Options} A self reference
387
377
  */
388
- enableMobile (
389
- androidPackage = 'org.mozilla.firefox',
390
- androidActivity = null,
391
- deviceSerial = null
392
- ) {
378
+ enableMobile(androidPackage = 'org.mozilla.firefox', androidActivity = null, deviceSerial = null) {
393
379
  this.firefoxOptions_().androidPackage = androidPackage
394
380
 
395
381
  if (androidActivity) {
@@ -404,7 +390,7 @@ class Options extends Capabilities {
404
390
  /**
405
391
  * Enables moz:debuggerAddress for firefox cdp
406
392
  */
407
- enableDebugger () {
393
+ enableDebugger() {
408
394
  return this.set('moz:debuggerAddress', true)
409
395
  }
410
396
 
@@ -412,7 +398,7 @@ class Options extends Capabilities {
412
398
  * Enable bidi connection
413
399
  * @returns {!Capabilities}
414
400
  */
415
- enableBidi () {
401
+ enableBidi() {
416
402
  return this.set('webSocketUrl', true)
417
403
  }
418
404
  }
@@ -438,7 +424,7 @@ const Context = {
438
424
  * @return {!Promise<?string>} A promise for the located executable.
439
425
  * The promise will resolve to {@code null} if Firefox was not found.
440
426
  */
441
- function findInProgramFiles (file) {
427
+ function findInProgramFiles(file) {
442
428
  let files = [
443
429
  process.env['PROGRAMFILES'] || 'C:\\Program Files',
444
430
  process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)',
@@ -447,8 +433,8 @@ function findInProgramFiles (file) {
447
433
  return exists
448
434
  ? files[0]
449
435
  : io.exists(files[1]).then(function (exists) {
450
- return exists ? files[1] : null
451
- })
436
+ return exists ? files[1] : null
437
+ })
452
438
  })
453
439
  }
454
440
 
@@ -465,7 +451,7 @@ const ExtensionCommand = {
465
451
  * @param {!Promise<string>} serverUrl The server's URL.
466
452
  * @return {!command.Executor} The new command executor.
467
453
  */
468
- function createExecutor (serverUrl) {
454
+ function createExecutor(serverUrl) {
469
455
  let client = serverUrl.then((url) => new http.HttpClient(url))
470
456
  let executor = new http.Executor(client)
471
457
  configureExecutor(executor)
@@ -476,30 +462,14 @@ function createExecutor (serverUrl) {
476
462
  * Configures the given executor with Firefox-specific commands.
477
463
  * @param {!http.Executor} executor the executor to configure.
478
464
  */
479
- function configureExecutor (executor) {
480
- executor.defineCommand(
481
- ExtensionCommand.GET_CONTEXT,
482
- 'GET',
483
- '/session/:sessionId/moz/context'
484
- )
485
-
486
- executor.defineCommand(
487
- ExtensionCommand.SET_CONTEXT,
488
- 'POST',
489
- '/session/:sessionId/moz/context'
490
- )
491
-
492
- executor.defineCommand(
493
- ExtensionCommand.INSTALL_ADDON,
494
- 'POST',
495
- '/session/:sessionId/moz/addon/install'
496
- )
497
-
498
- executor.defineCommand(
499
- ExtensionCommand.UNINSTALL_ADDON,
500
- 'POST',
501
- '/session/:sessionId/moz/addon/uninstall'
502
- )
465
+ function configureExecutor(executor) {
466
+ executor.defineCommand(ExtensionCommand.GET_CONTEXT, 'GET', '/session/:sessionId/moz/context')
467
+
468
+ executor.defineCommand(ExtensionCommand.SET_CONTEXT, 'POST', '/session/:sessionId/moz/context')
469
+
470
+ executor.defineCommand(ExtensionCommand.INSTALL_ADDON, 'POST', '/session/:sessionId/moz/addon/install')
471
+
472
+ executor.defineCommand(ExtensionCommand.UNINSTALL_ADDON, 'POST', '/session/:sessionId/moz/addon/uninstall')
503
473
  }
504
474
 
505
475
  /**
@@ -512,7 +482,7 @@ class ServiceBuilder extends remote.DriverService.Builder {
512
482
  * @param {string=} opt_exe Path to the server executable to use. If omitted,
513
483
  * the builder will attempt to locate the geckodriver on the system PATH.
514
484
  */
515
- constructor (opt_exe) {
485
+ constructor(opt_exe) {
516
486
  super(opt_exe)
517
487
  this.setLoopback(true) // Required.
518
488
  }
@@ -524,7 +494,7 @@ class ServiceBuilder extends remote.DriverService.Builder {
524
494
  * default, only debug logging is enabled.
525
495
  * @return {!ServiceBuilder} A self reference.
526
496
  */
527
- enableVerboseLogging (opt_trace) {
497
+ enableVerboseLogging(opt_trace) {
528
498
  return this.addArguments(opt_trace ? '-vv' : '-v')
529
499
  }
530
500
  }
@@ -555,9 +525,8 @@ class Driver extends webdriver.WebDriver {
555
525
  * configured to use the legacy FirefoxDriver from the Selenium project.
556
526
  * @return {!Driver} A new driver instance.
557
527
  */
558
- static createSession (opt_config, opt_executor) {
559
- let caps =
560
- opt_config instanceof Capabilities ? opt_config : new Options(opt_config)
528
+ static createSession(opt_config, opt_executor) {
529
+ let caps = opt_config instanceof Capabilities ? opt_config : new Options(opt_config)
561
530
 
562
531
  let firefoxBrowserPath = null
563
532
 
@@ -604,14 +573,14 @@ class Driver extends webdriver.WebDriver {
604
573
  * implementation.
605
574
  * @override
606
575
  */
607
- setFileDetector () {}
576
+ setFileDetector() {}
608
577
 
609
578
  /**
610
579
  * Get the context that is currently in effect.
611
580
  *
612
581
  * @return {!Promise<Context>} Current context.
613
582
  */
614
- getContext () {
583
+ getContext() {
615
584
  return this.execute(new command.Command(ExtensionCommand.GET_CONTEXT))
616
585
  }
617
586
 
@@ -629,13 +598,8 @@ class Driver extends webdriver.WebDriver {
629
598
  *
630
599
  * @param {!Promise<void>} ctx The context to switch to.
631
600
  */
632
- setContext (ctx) {
633
- return this.execute(
634
- new command.Command(ExtensionCommand.SET_CONTEXT).setParameter(
635
- 'context',
636
- ctx
637
- )
638
- )
601
+ setContext(ctx) {
602
+ return this.execute(new command.Command(ExtensionCommand.SET_CONTEXT).setParameter('context', ctx))
639
603
  }
640
604
 
641
605
  /**
@@ -652,7 +616,7 @@ class Driver extends webdriver.WebDriver {
652
616
  * newly installed addon.
653
617
  * @see #uninstallAddon
654
618
  */
655
- async installAddon (path, temporary = false) {
619
+ async installAddon(path, temporary = false) {
656
620
  let stats = fs.statSync(path)
657
621
  let buf
658
622
  if (stats.isDirectory()) {
@@ -665,7 +629,7 @@ class Driver extends webdriver.WebDriver {
665
629
  return this.execute(
666
630
  new command.Command(ExtensionCommand.INSTALL_ADDON)
667
631
  .setParameter('addon', buf.toString('base64'))
668
- .setParameter('temporary', temporary)
632
+ .setParameter('temporary', temporary),
669
633
  )
670
634
  }
671
635
 
@@ -677,14 +641,9 @@ class Driver extends webdriver.WebDriver {
677
641
  * completed.
678
642
  * @see #installAddon
679
643
  */
680
- async uninstallAddon (id) {
644
+ async uninstallAddon(id) {
681
645
  id = await Promise.resolve(id)
682
- return this.execute(
683
- new command.Command(ExtensionCommand.UNINSTALL_ADDON).setParameter(
684
- 'id',
685
- id
686
- )
687
- )
646
+ return this.execute(new command.Command(ExtensionCommand.UNINSTALL_ADDON).setParameter('id', id))
688
647
  }
689
648
  }
690
649
 
@@ -702,7 +661,7 @@ class Channel {
702
661
  * @param {string} darwin The path to check when running on MacOS.
703
662
  * @param {string} win32 The path to check when running on Windows.
704
663
  */
705
- constructor (darwin, win32) {
664
+ constructor(darwin, win32) {
706
665
  /** @private @const */ this.darwin_ = darwin
707
666
  /** @private @const */ this.win32_ = win32
708
667
  /** @private {Promise<string>} */
@@ -718,7 +677,7 @@ class Channel {
718
677
  * @return {!Promise<string>} A promise for the location of the located
719
678
  * Firefox executable.
720
679
  */
721
- locate () {
680
+ locate() {
722
681
  if (this.found_) {
723
682
  return this.found_
724
683
  }
@@ -726,15 +685,11 @@ class Channel {
726
685
  let found
727
686
  switch (process.platform) {
728
687
  case 'darwin':
729
- found = io
730
- .exists(this.darwin_)
731
- .then((exists) => (exists ? this.darwin_ : io.findInPath('firefox')))
688
+ found = io.exists(this.darwin_).then((exists) => (exists ? this.darwin_ : io.findInPath('firefox')))
732
689
  break
733
690
 
734
691
  case 'win32':
735
- found = findInProgramFiles(this.win32_).then(
736
- (found) => found || io.findInPath('firefox.exe')
737
- )
692
+ found = findInProgramFiles(this.win32_).then((found) => found || io.findInPath('firefox.exe'))
738
693
  break
739
694
 
740
695
  default:
@@ -753,7 +708,7 @@ class Channel {
753
708
  }
754
709
 
755
710
  /** @return {!Promise<string>} */
756
- [Symbols.serialize] () {
711
+ [Symbols.serialize]() {
757
712
  return this.locate()
758
713
  }
759
714
  }
@@ -765,7 +720,7 @@ class Channel {
765
720
  */
766
721
  Channel.DEV = new Channel(
767
722
  '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox',
768
- 'Firefox Developer Edition\\firefox.exe'
723
+ 'Firefox Developer Edition\\firefox.exe',
769
724
  )
770
725
 
771
726
  /**
@@ -775,30 +730,21 @@ Channel.DEV = new Channel(
775
730
  * @const
776
731
  * @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#beta>
777
732
  */
778
- Channel.BETA = new Channel(
779
- '/Applications/Firefox.app/Contents/MacOS/firefox',
780
- 'Mozilla Firefox\\firefox.exe'
781
- )
733
+ Channel.BETA = new Channel('/Applications/Firefox.app/Contents/MacOS/firefox', 'Mozilla Firefox\\firefox.exe')
782
734
 
783
735
  /**
784
736
  * Firefox's release channel.
785
737
  * @const
786
738
  * @see <https://www.mozilla.org/en-US/firefox/desktop/>
787
739
  */
788
- Channel.RELEASE = new Channel(
789
- '/Applications/Firefox.app/Contents/MacOS/firefox',
790
- 'Mozilla Firefox\\firefox.exe'
791
- )
740
+ Channel.RELEASE = new Channel('/Applications/Firefox.app/Contents/MacOS/firefox', 'Mozilla Firefox\\firefox.exe')
792
741
 
793
742
  /**
794
743
  * Firefox's nightly release channel.
795
744
  * @const
796
745
  * @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly>
797
746
  */
798
- Channel.NIGHTLY = new Channel(
799
- '/Applications/Firefox Nightly.app/Contents/MacOS/firefox',
800
- 'Nightly\\firefox.exe'
801
- )
747
+ Channel.NIGHTLY = new Channel('/Applications/Firefox Nightly.app/Contents/MacOS/firefox', 'Nightly\\firefox.exe')
802
748
 
803
749
  // PUBLIC API
804
750
 
package/http/index.js CHANGED
@@ -54,16 +54,14 @@ function getRequestOptions(aUrl) {
54
54
  options.search = null
55
55
  options.hash = null
56
56
  options.path = options.pathname
57
- options.hostname =
58
- options.hostname === 'localhost' ? '127.0.0.1' : options.hostname // To support Node 17 and above. Refer https://github.com/nodejs/node/issues/40702 for details.
57
+ options.hostname = options.hostname === 'localhost' ? '127.0.0.1' : options.hostname // To support Node 17 and above. Refer https://github.com/nodejs/node/issues/40702 for details.
59
58
  return options
60
59
  }
61
60
 
62
61
  /** @const {string} */
63
62
  const USER_AGENT = (function () {
64
63
  const version = require('../package.json').version
65
- const platform =
66
- { darwin: 'mac', win32: 'windows' }[process.platform] || 'linux'
64
+ const platform = { darwin: 'mac', win32: 'windows' }[process.platform] || 'linux'
67
65
  return `selenium/${version} (js ${platform})`
68
66
  })()
69
67
 
@@ -211,8 +209,7 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) {
211
209
  options.protocol = opt_proxy.protocol
212
210
 
213
211
  if (proxy.auth) {
214
- options.headers['Proxy-Authorization'] =
215
- 'Basic ' + Buffer.from(proxy.auth).toString('base64')
212
+ options.headers['Proxy-Authorization'] = 'Basic ' + Buffer.from(proxy.auth).toString('base64')
216
213
  }
217
214
  }
218
215
 
@@ -229,8 +226,8 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) {
229
226
  'Failed to parse "Location" header for server redirect: ' +
230
227
  ex.message +
231
228
  '\nResponse was: \n' +
232
- new httpLib.Response(response.statusCode, response.headers, '')
233
- )
229
+ new httpLib.Response(response.statusCode, response.headers, ''),
230
+ ),
234
231
  )
235
232
  return
236
233
  }
@@ -261,7 +258,7 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) {
261
258
  onOk,
262
259
  onError,
263
260
  undefined,
264
- opt_proxy
261
+ opt_proxy,
265
262
  )
266
263
  return
267
264
  }
@@ -272,7 +269,7 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) {
272
269
  const resp = new httpLib.Response(
273
270
  /** @type {number} */ (response.statusCode),
274
271
  /** @type {!Object<string>} */ (response.headers),
275
- Buffer.concat(body).toString('utf8').replace(/\0/g, '')
272
+ Buffer.concat(body).toString('utf8').replace(/\0/g, ''),
276
273
  )
277
274
  onOk(resp)
278
275
  })
package/ie.js CHANGED
@@ -224,9 +224,7 @@ class Options extends Capabilities {
224
224
  addBrowserCommandSwitches(...args) {
225
225
  let current = this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] || []
226
226
  if (typeof current == 'string') current = current.split(' ')
227
- this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] = current
228
- .concat(args)
229
- .join(' ')
227
+ this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] = current.concat(args).join(' ')
230
228
  return this
231
229
  }
232
230
 
@@ -242,9 +240,7 @@ class Options extends Capabilities {
242
240
  addArguments(...args) {
243
241
  let current = this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] || []
244
242
  if (typeof current == 'string') current = current.split(' ')
245
- this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] = current
246
- .concat(args)
247
- .join(' ')
243
+ this.options_[Key.BROWSER_COMMAND_LINE_SWITCHES] = current.concat(args).join(' ')
248
244
  return this
249
245
  }
250
246
 
@@ -364,11 +360,7 @@ class Options extends Capabilities {
364
360
  * @return {!Options} A self reference.
365
361
  */
366
362
  setScrollBehavior(behavior) {
367
- if (
368
- behavior &&
369
- behavior !== SCROLL_BEHAVIOUR.TOP &&
370
- behavior !== SCROLL_BEHAVIOUR.BOTTOM
371
- ) {
363
+ if (behavior && behavior !== SCROLL_BEHAVIOUR.TOP && behavior !== SCROLL_BEHAVIOUR.BOTTOM) {
372
364
  throw new error.InvalidArgumentError(`Element Scroll Behavior out of range.
373
365
  It should be either ${SCROLL_BEHAVIOUR.TOP} or ${SCROLL_BEHAVIOUR.BOTTOM}`)
374
366
  }
@@ -383,7 +375,7 @@ function createServiceFromCapabilities(capabilities) {
383
375
  'The IEDriver may only be used on Windows, but you appear to be on ' +
384
376
  process.platform +
385
377
  '. Did you mean to run against a remote ' +
386
- 'WebDriver server?'
378
+ 'WebDriver server?',
387
379
  )
388
380
  }
389
381
 
@@ -461,9 +453,7 @@ class Driver extends webdriver.WebDriver {
461
453
  let client = service.start().then((url) => new http.HttpClient(url))
462
454
  let executor = new http.Executor(client)
463
455
 
464
- return /** @type {!Driver} */ (
465
- super.createSession(executor, options, () => service.kill())
466
- )
456
+ return /** @type {!Driver} */ (super.createSession(executor, options, () => service.kill()))
467
457
  }
468
458
 
469
459
  /**
package/index.js CHANGED
@@ -598,8 +598,7 @@ class Builder {
598
598
 
599
599
  if (typeof browser !== 'string') {
600
600
  throw TypeError(
601
- `Target browser must be a string, but is <${typeof browser}>;` +
602
- ' did you forget to call forBrowser()?'
601
+ `Target browser must be a string, but is <${typeof browser}>;` + ' did you forget to call forBrowser()?',
603
602
  )
604
603
  }
605
604
 
@@ -620,24 +619,9 @@ class Builder {
620
619
  capabilities.merge(this.edgeOptions_)
621
620
  }
622
621
 
623
- checkOptions(
624
- capabilities,
625
- 'chromeOptions',
626
- chrome.Options,
627
- 'setChromeOptions'
628
- )
629
- checkOptions(
630
- capabilities,
631
- 'moz:firefoxOptions',
632
- firefox.Options,
633
- 'setFirefoxOptions'
634
- )
635
- checkOptions(
636
- capabilities,
637
- 'safari.options',
638
- safari.Options,
639
- 'setSafariOptions'
640
- )
622
+ checkOptions(capabilities, 'chromeOptions', chrome.Options, 'setChromeOptions')
623
+ checkOptions(capabilities, 'moz:firefoxOptions', firefox.Options, 'setFirefoxOptions')
624
+ checkOptions(capabilities, 'safari.options', safari.Options, 'setSafariOptions')
641
625
 
642
626
  // Check for a remote browser.
643
627
  let url = this.url_
@@ -653,9 +637,7 @@ class Builder {
653
637
 
654
638
  if (url) {
655
639
  this.log_.fine('Creating session on remote server')
656
- let client = Promise.resolve(url).then(
657
- (url) => new _http.HttpClient(url, this.agent_, this.proxy_)
658
- )
640
+ let client = Promise.resolve(url).then((url) => new _http.HttpClient(url, this.agent_, this.proxy_))
659
641
  let executor = new _http.Executor(client)
660
642
 
661
643
  if (browser === Browser.CHROME) {
@@ -708,11 +690,7 @@ class Builder {
708
690
  return createDriver(safari.Driver, capabilities)
709
691
 
710
692
  default:
711
- throw new Error(
712
- 'Do not know how to build driver: ' +
713
- browser +
714
- '; did you forget to call usingServer(url)?'
715
- )
693
+ throw new Error('Do not know how to build driver: ' + browser + '; did you forget to call usingServer(url)?')
716
694
  }
717
695
  }
718
696
  }
@@ -769,7 +747,7 @@ function checkOptions(caps, key, optionType, setMethod) {
769
747
  'Options class extends Capabilities and should not be set as key ' +
770
748
  `"${key}"; set browser-specific options with ` +
771
749
  `Builder.${setMethod}(). For more information, see the ` +
772
- 'documentation attached to the function that threw this error'
750
+ 'documentation attached to the function that threw this error',
773
751
  )
774
752
  }
775
753
  }
package/io/exec.js CHANGED
@@ -76,8 +76,7 @@ class Result {
76
76
  }
77
77
  }
78
78
 
79
- const COMMAND_RESULT =
80
- /** !WeakMap<!Command, !Promise<!Result>> */ new WeakMap()
79
+ const COMMAND_RESULT = /** !WeakMap<!Command, !Promise<!Result>> */ new WeakMap()
81
80
  const KILL_HOOK = /** !WeakMap<!Command, function(string)> */ new WeakMap()
82
81
 
83
82
  /**