selenium-webdriver 4.16.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 (65) hide show
  1. package/CHANGES.md +253 -196
  2. package/LICENSE +1 -1
  3. package/NOTICE +1 -1
  4. package/bidi/addInterceptParameters.js +86 -0
  5. package/bidi/browsingContext.js +167 -38
  6. package/bidi/browsingContextInspector.js +13 -40
  7. package/bidi/evaluateResult.js +4 -10
  8. package/bidi/filterBy.js +2 -6
  9. package/bidi/index.js +31 -29
  10. package/bidi/input.js +97 -0
  11. package/bidi/interceptPhase.js +24 -0
  12. package/bidi/logInspector.js +15 -20
  13. package/bidi/network.js +178 -0
  14. package/bidi/networkInspector.js +12 -2
  15. package/bidi/networkTypes.js +22 -49
  16. package/bidi/protocolType.js +4 -9
  17. package/bidi/protocolValue.js +48 -17
  18. package/bidi/realmInfo.js +3 -10
  19. package/bidi/scriptManager.js +60 -48
  20. package/bidi/scriptTypes.js +58 -0
  21. package/bidi/urlPattern.js +58 -0
  22. package/bin/linux/selenium-manager +0 -0
  23. package/bin/macos/selenium-manager +0 -0
  24. package/bin/windows/selenium-manager.exe +0 -0
  25. package/chrome.js +2 -14
  26. package/chromium.js +28 -143
  27. package/common/driverFinder.js +1 -1
  28. package/common/seleniumManager.js +5 -12
  29. package/devtools/CDPConnection.js +1 -3
  30. package/edge.js +1 -3
  31. package/example/chrome_android.js +2 -5
  32. package/example/chrome_mobile_emulation.js +2 -4
  33. package/example/google_search.js +1 -3
  34. package/example/headless.js +4 -10
  35. package/example/logging.js +3 -9
  36. package/firefox.js +37 -111
  37. package/http/index.js +7 -10
  38. package/ie.js +5 -15
  39. package/index.js +10 -32
  40. package/io/exec.js +1 -2
  41. package/io/index.js +3 -3
  42. package/io/zip.js +8 -30
  43. package/lib/atoms/find-elements.js +1 -1
  44. package/lib/atoms/get-attribute.js +6 -100
  45. package/lib/by.js +2 -9
  46. package/lib/capabilities.js +8 -7
  47. package/lib/command.js +4 -0
  48. package/lib/error.js +2 -9
  49. package/lib/http.js +37 -130
  50. package/lib/input.js +22 -34
  51. package/lib/logging.js +3 -11
  52. package/lib/promise.js +2 -7
  53. package/lib/select.js +3 -9
  54. package/lib/until.js +28 -49
  55. package/lib/util.js +1 -4
  56. package/lib/virtual_authenticator.js +4 -22
  57. package/lib/webdriver.js +146 -269
  58. package/lib/webelement.js +1 -5
  59. package/net/index.js +1 -4
  60. package/package.json +2 -1
  61. package/remote/index.js +9 -24
  62. package/remote/util.js +6 -19
  63. package/safari.js +3 -8
  64. package/testing/index.js +6 -11
  65. package/example/firefox_channels.js +0 -84
package/firefox.js CHANGED
@@ -63,28 +63,19 @@
63
63
  *
64
64
  * For Linux, Firefox will always be located on the PATH: `$(where firefox)`.
65
65
  *
66
- * Several methods are provided for starting Firefox with a custom executable.
67
- * First, on Windows and MacOS, you may configure WebDriver to check the default
68
- * install location for a non-release channel. If the requested channel cannot
69
- * be found in its default location, WebDriver will fallback to searching your
70
- * PATH. _Note:_ on Linux, Firefox is _always_ located on your path, regardless
71
- * of the requested channel.
66
+ * You can provide a custom location for Firefox by setting the binary in the
67
+ * {@link Options}:setBinary method.
72
68
  *
73
69
  * const {Builder} = require('selenium-webdriver');
74
70
  * const firefox = require('selenium-webdriver/firefox');
75
71
  *
76
- * let options = new firefox.Options().setBinary(firefox.Channel.NIGHTLY);
72
+ * let options = new firefox.Options()
73
+ * .setBinary('/my/firefox/install/dir/firefox');
77
74
  * let driver = new Builder()
78
75
  * .forBrowser('firefox')
79
76
  * .setFirefoxOptions(options)
80
77
  * .build();
81
78
  *
82
- * On all platforms, you may configure WebDriver to use a Firefox specific
83
- * executable:
84
- *
85
- * let options = new firefox.Options()
86
- * .setBinary('/my/firefox/install/dir/firefox-bin');
87
- *
88
79
  * __Remote Testing__
89
80
  *
90
81
  * You may customize the Firefox binary and profile when running against a
@@ -102,7 +93,7 @@
102
93
  *
103
94
  * let options = new firefox.Options()
104
95
  * .setProfile('/profile/path/on/remote/host')
105
- * .setBinary('/install/dir/on/remote/host/firefox-bin');
96
+ * .setBinary('/install/dir/on/remote/host/firefox');
106
97
  *
107
98
  * let driver = new Builder()
108
99
  * .forBrowser('firefox')
@@ -224,11 +215,7 @@ async function buildProfile(template, extensions) {
224
215
  if (extensions.length) {
225
216
  dir = await io.tmpDir()
226
217
  if (template) {
227
- await io.copyDir(
228
- /** @type {string} */ (template),
229
- dir,
230
- /(parent\.lock|lock|\.parentlock)/
231
- )
218
+ await io.copyDir(/** @type {string} */ (template), dir, /(parent\.lock|lock|\.parentlock)/)
232
219
  }
233
220
 
234
221
  const extensionsDir = path.join(dir, 'extensions')
@@ -300,21 +287,7 @@ class Options extends Capabilities {
300
287
  }
301
288
 
302
289
  /**
303
- * @deprecated Use {@link Options#addArguments} instead.
304
- * @example
305
- * options.addArguments('-headless');
306
- * @example
307
- * Configures the geckodriver to start Firefox in headless mode.
308
- *
309
- * @return {!Options} A self reference.
310
- */
311
- headless() {
312
- return this.addArguments('-headless')
313
- }
314
-
315
- /**
316
- * Sets the initial window size when running in
317
- * {@linkplain #headless headless} mode.
290
+ * Sets the initial window size
318
291
  *
319
292
  * @param {{width: number, height: number}} size The desired window size.
320
293
  * @return {!Options} A self reference.
@@ -327,6 +300,7 @@ class Options extends Capabilities {
327
300
  throw TypeError('Arguments must be {width, height} with numbers > 0')
328
301
  }
329
302
  }
303
+
330
304
  checkArg(width)
331
305
  checkArg(height)
332
306
  return this.addArguments(`--width=${width}`, `--height=${height}`)
@@ -353,14 +327,8 @@ class Options extends Capabilities {
353
327
  if (typeof key !== 'string') {
354
328
  throw TypeError(`key must be a string, but got ${typeof key}`)
355
329
  }
356
- if (
357
- typeof value !== 'string' &&
358
- typeof value !== 'number' &&
359
- typeof value !== 'boolean'
360
- ) {
361
- throw TypeError(
362
- `value must be a string, number, or boolean, but got ${typeof value}`
363
- )
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}`)
364
332
  }
365
333
  let options = this.firefoxOptions_()
366
334
  options.prefs = options.prefs || {}
@@ -387,9 +355,9 @@ class Options extends Capabilities {
387
355
 
388
356
  /**
389
357
  * Sets the binary to use. The binary may be specified as the path to a
390
- * Firefox executable or a desired release {@link Channel}.
358
+ * Firefox executable.
391
359
  *
392
- * @param {(string|!Channel)} binary The binary to use.
360
+ * @param {(string)} binary The binary to use.
393
361
  * @return {!Options} A self reference.
394
362
  * @throws {TypeError} If `binary` is an invalid type.
395
363
  */
@@ -398,7 +366,7 @@ class Options extends Capabilities {
398
366
  this.firefoxOptions_().binary = binary
399
367
  return this
400
368
  }
401
- throw TypeError('binary must be a string path or Channel object')
369
+ throw TypeError('binary must be a string path ')
402
370
  }
403
371
 
404
372
  /**
@@ -407,11 +375,7 @@ class Options extends Capabilities {
407
375
  * @param {string} androidPackage The package to use
408
376
  * @return {!Options} A self reference
409
377
  */
410
- enableMobile(
411
- androidPackage = 'org.mozilla.firefox',
412
- androidActivity = null,
413
- deviceSerial = null
414
- ) {
378
+ enableMobile(androidPackage = 'org.mozilla.firefox', androidActivity = null, deviceSerial = null) {
415
379
  this.firefoxOptions_().androidPackage = androidPackage
416
380
 
417
381
  if (androidActivity) {
@@ -499,29 +463,13 @@ function createExecutor(serverUrl) {
499
463
  * @param {!http.Executor} executor the executor to configure.
500
464
  */
501
465
  function configureExecutor(executor) {
502
- executor.defineCommand(
503
- ExtensionCommand.GET_CONTEXT,
504
- 'GET',
505
- '/session/:sessionId/moz/context'
506
- )
507
-
508
- executor.defineCommand(
509
- ExtensionCommand.SET_CONTEXT,
510
- 'POST',
511
- '/session/:sessionId/moz/context'
512
- )
513
-
514
- executor.defineCommand(
515
- ExtensionCommand.INSTALL_ADDON,
516
- 'POST',
517
- '/session/:sessionId/moz/addon/install'
518
- )
519
-
520
- executor.defineCommand(
521
- ExtensionCommand.UNINSTALL_ADDON,
522
- 'POST',
523
- '/session/:sessionId/moz/addon/uninstall'
524
- )
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')
525
473
  }
526
474
 
527
475
  /**
@@ -578,8 +526,7 @@ class Driver extends webdriver.WebDriver {
578
526
  * @return {!Driver} A new driver instance.
579
527
  */
580
528
  static createSession(opt_config, opt_executor) {
581
- let caps =
582
- opt_config instanceof Capabilities ? opt_config : new Options(opt_config)
529
+ let caps = opt_config instanceof Capabilities ? opt_config : new Options(opt_config)
583
530
 
584
531
  let firefoxBrowserPath = null
585
532
 
@@ -652,12 +599,7 @@ class Driver extends webdriver.WebDriver {
652
599
  * @param {!Promise<void>} ctx The context to switch to.
653
600
  */
654
601
  setContext(ctx) {
655
- return this.execute(
656
- new command.Command(ExtensionCommand.SET_CONTEXT).setParameter(
657
- 'context',
658
- ctx
659
- )
660
- )
602
+ return this.execute(new command.Command(ExtensionCommand.SET_CONTEXT).setParameter('context', ctx))
661
603
  }
662
604
 
663
605
  /**
@@ -687,7 +629,7 @@ class Driver extends webdriver.WebDriver {
687
629
  return this.execute(
688
630
  new command.Command(ExtensionCommand.INSTALL_ADDON)
689
631
  .setParameter('addon', buf.toString('base64'))
690
- .setParameter('temporary', temporary)
632
+ .setParameter('temporary', temporary),
691
633
  )
692
634
  }
693
635
 
@@ -701,12 +643,7 @@ class Driver extends webdriver.WebDriver {
701
643
  */
702
644
  async uninstallAddon(id) {
703
645
  id = await Promise.resolve(id)
704
- return this.execute(
705
- new command.Command(ExtensionCommand.UNINSTALL_ADDON).setParameter(
706
- 'id',
707
- id
708
- )
709
- )
646
+ return this.execute(new command.Command(ExtensionCommand.UNINSTALL_ADDON).setParameter('id', id))
710
647
  }
711
648
  }
712
649
 
@@ -714,7 +651,9 @@ class Driver extends webdriver.WebDriver {
714
651
  * Provides methods for locating the executable for a Firefox release channel
715
652
  * on Windows and MacOS. For other systems (i.e. Linux), Firefox will always
716
653
  * be located on the system PATH.
717
- *
654
+ * @deprecated Instead of using this class, you should configure the
655
+ * {@link Options} with the appropriate binary location or let Selenium
656
+ * Manager handle it for you.
718
657
  * @final
719
658
  */
720
659
  class Channel {
@@ -746,15 +685,11 @@ class Channel {
746
685
  let found
747
686
  switch (process.platform) {
748
687
  case 'darwin':
749
- found = io
750
- .exists(this.darwin_)
751
- .then((exists) => (exists ? this.darwin_ : io.findInPath('firefox')))
688
+ found = io.exists(this.darwin_).then((exists) => (exists ? this.darwin_ : io.findInPath('firefox')))
752
689
  break
753
690
 
754
691
  case 'win32':
755
- found = findInProgramFiles(this.win32_).then(
756
- (found) => found || io.findInPath('firefox.exe')
757
- )
692
+ found = findInProgramFiles(this.win32_).then((found) => found || io.findInPath('firefox.exe'))
758
693
  break
759
694
 
760
695
  default:
@@ -781,11 +716,11 @@ class Channel {
781
716
  /**
782
717
  * Firefox's developer channel.
783
718
  * @const
784
- * @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#aurora>
719
+ * @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#developer>
785
720
  */
786
- Channel.AURORA = new Channel(
787
- '/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin',
788
- 'Firefox Developer Edition\\firefox.exe'
721
+ Channel.DEV = new Channel(
722
+ '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox',
723
+ 'Firefox Developer Edition\\firefox.exe',
789
724
  )
790
725
 
791
726
  /**
@@ -795,30 +730,21 @@ Channel.AURORA = new Channel(
795
730
  * @const
796
731
  * @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#beta>
797
732
  */
798
- Channel.BETA = new Channel(
799
- '/Applications/Firefox.app/Contents/MacOS/firefox-bin',
800
- 'Mozilla Firefox\\firefox.exe'
801
- )
733
+ Channel.BETA = new Channel('/Applications/Firefox.app/Contents/MacOS/firefox', 'Mozilla Firefox\\firefox.exe')
802
734
 
803
735
  /**
804
736
  * Firefox's release channel.
805
737
  * @const
806
738
  * @see <https://www.mozilla.org/en-US/firefox/desktop/>
807
739
  */
808
- Channel.RELEASE = new Channel(
809
- '/Applications/Firefox.app/Contents/MacOS/firefox-bin',
810
- 'Mozilla Firefox\\firefox.exe'
811
- )
740
+ Channel.RELEASE = new Channel('/Applications/Firefox.app/Contents/MacOS/firefox', 'Mozilla Firefox\\firefox.exe')
812
741
 
813
742
  /**
814
743
  * Firefox's nightly release channel.
815
744
  * @const
816
745
  * @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly>
817
746
  */
818
- Channel.NIGHTLY = new Channel(
819
- '/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin',
820
- 'Nightly\\firefox.exe'
821
- )
747
+ Channel.NIGHTLY = new Channel('/Applications/Firefox Nightly.app/Contents/MacOS/firefox', 'Nightly\\firefox.exe')
822
748
 
823
749
  // PUBLIC API
824
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
@@ -41,7 +41,7 @@ const webdriver = require('./lib/webdriver')
41
41
  const select = require('./lib/select')
42
42
  const LogInspector = require('./bidi/logInspector')
43
43
  const BrowsingContext = require('./bidi/browsingContext')
44
- const BrowsingConextInspector = require('./bidi/browsingContextInspector')
44
+ const BrowsingContextInspector = require('./bidi/browsingContextInspector')
45
45
  const ScriptManager = require('./bidi/scriptManager')
46
46
  const NetworkInspector = require('./bidi/networkInspector')
47
47
 
@@ -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
  }
@@ -720,7 +698,7 @@ class Builder {
720
698
  /**
721
699
  * In the 3.x releases, the various browser option classes
722
700
  * (e.g. firefox.Options) had to be manually set as an option using the
723
- * Capabilties class:
701
+ * Capabilities class:
724
702
  *
725
703
  * let ffo = new firefox.Options();
726
704
  * // Configure firefox options...
@@ -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
  }
@@ -802,6 +780,6 @@ exports.until = until
802
780
  exports.Select = select.Select
803
781
  exports.LogInspector = LogInspector
804
782
  exports.BrowsingContext = BrowsingContext
805
- exports.BrowsingConextInspector = BrowsingConextInspector
783
+ exports.BrowsingContextInspector = BrowsingContextInspector
806
784
  exports.ScriptManager = ScriptManager
807
785
  exports.NetworkInspector = NetworkInspector
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
  /**
package/io/index.js CHANGED
@@ -293,7 +293,7 @@ function mkdirp(dir) {
293
293
  .then(() => mkdirp(dir))
294
294
  .then(
295
295
  () => callback(null, dir),
296
- (err) => callback(err)
296
+ (err) => callback(err),
297
297
  )
298
298
  default:
299
299
  callback(err)
@@ -326,8 +326,8 @@ function walkDir(rootPath) {
326
326
  })
327
327
  return stats.isDirectory() && walk(file)
328
328
  })
329
- })
330
- )
329
+ }),
330
+ ),
331
331
  )
332
332
  })(rootPath).then(() => seen)
333
333
  }
package/io/zip.js CHANGED
@@ -46,19 +46,14 @@ class Zip {
46
46
  addFile(filePath, zipPath = path.basename(filePath)) {
47
47
  let add = io
48
48
  .read(filePath)
49
- .then((buffer) =>
50
- this.z_.file(
51
- /** @type {string} */ (zipPath.replace(/\\/g, '/')),
52
- buffer
53
- )
54
- )
49
+ .then((buffer) => this.z_.file(/** @type {string} */ (zipPath.replace(/\\/g, '/')), buffer))
55
50
  this.pendingAdds_.add(add)
56
51
  return add.then(
57
52
  () => this.pendingAdds_.delete(add),
58
53
  (e) => {
59
54
  this.pendingAdds_.delete(add)
60
55
  throw e
61
- }
56
+ },
62
57
  )
63
58
  }
64
59
 
@@ -83,12 +78,7 @@ class Zip {
83
78
  if (spec.dir) {
84
79
  archive.folder(spec.path)
85
80
  } else {
86
- files.push(
87
- this.addFile(
88
- path.join(dirPath, spec.path),
89
- path.join(zipPath, spec.path)
90
- )
91
- )
81
+ files.push(this.addFile(path.join(dirPath, spec.path), path.join(zipPath, spec.path)))
92
82
  }
93
83
  })
94
84
 
@@ -118,15 +108,11 @@ class Zip {
118
108
  getFile(path) {
119
109
  let file = this.z_.file(path)
120
110
  if (!file) {
121
- return Promise.reject(
122
- new InvalidArgumentError(`No such file in zip archive: ${path}`)
123
- )
111
+ return Promise.reject(new InvalidArgumentError(`No such file in zip archive: ${path}`))
124
112
  }
125
113
 
126
114
  if (file.dir) {
127
- return Promise.reject(
128
- new InvalidArgumentError(`The requested file is a directory: ${path}`)
129
- )
115
+ return Promise.reject(new InvalidArgumentError(`The requested file is a directory: ${path}`))
130
116
  }
131
117
 
132
118
  return Promise.resolve(file.async('nodebuffer'))
@@ -144,15 +130,9 @@ class Zip {
144
130
  */
145
131
  toBuffer(compression = 'STORE') {
146
132
  if (compression !== 'STORE' && compression !== 'DEFLATE') {
147
- return Promise.reject(
148
- new InvalidArgumentError(
149
- `compression must be one of {STORE, DEFLATE}, got ${compression}`
150
- )
151
- )
133
+ return Promise.reject(new InvalidArgumentError(`compression must be one of {STORE, DEFLATE}, got ${compression}`))
152
134
  }
153
- return Promise.resolve(
154
- this.z_.generateAsync({ compression, type: 'nodebuffer' })
155
- )
135
+ return Promise.resolve(this.z_.generateAsync({ compression, type: 'nodebuffer' }))
156
136
  }
157
137
  }
158
138
 
@@ -210,9 +190,7 @@ function unzip(src, dst) {
210
190
  }
211
191
 
212
192
  function writeFile(relPath, file) {
213
- return file
214
- .async('nodebuffer')
215
- .then((buffer) => io.write(path.join(dst, relPath), buffer))
193
+ return file.async('nodebuffer').then((buffer) => io.write(path.join(dst, relPath), buffer))
216
194
  }
217
195
  })
218
196
  }
@@ -112,7 +112,7 @@ function ld(a,b,c){if(S(a,"BR"))b.push("");else{var d=S(a,"TD"),e=V(a,"display")
112
112
  za(a)||(b[b.length-1]+=" ");f&&"run-in"!=e&&!/^[\s\xa0]*$/.test(a)&&b.push("")}}function kd(a,b){ld(a,b,function(c,d,e,f,g){3==c.nodeType&&e?nd(c,d,f,g):S(c)&&kd(c,d)})}var md="inline inline-block inline-table none table-cell table-column table-column-group".split(" ");
113
113
  function nd(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.replace(/(\r\n|\r|\n)/g,"\n");if("normal"==c||"nowrap"==c)a=a.replace(/\n/g," ");a="pre"==c||"pre-wrap"==c?a.replace(/[ \f\t\v\u2028\u2029]/g,"\u00a0"):a.replace(/[ \f\t\v\u2028\u2029]+/g," ");"capitalize"==d?a=a.replace(t?/(^|\s|\b)(\S)/g:/(^|[^\d\p{L}\p{S}])([\p{Ll}|\p{S}])/gu,function(e,f,g){return f+g.toUpperCase()}):"uppercase"==d?a=a.toUpperCase():"lowercase"==d&&(a=a.toLowerCase());c=b.pop()||"";za(c)&&0==a.lastIndexOf(" ",
114
114
  0)&&(a=a.substr(1));b.push(c+a)}function dd(a){if(Mc){if("relative"==V(a,"position"))return 1;a=V(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return od(a)}function od(a){var b=1,c=V(a,"opacity");c&&(b=Number(c));(a=Zc(a))&&(b*=od(a));return b}
115
- function pd(a,b,c,d,e){if(3==a.nodeType&&c)nd(a,b,d,e);else if(S(a))if(S(a,"CONTENT")||S(a,"SLOT")){for(var f=a;f.parentNode;)f=f.parentNode;f instanceof ShadowRoot?(a=S(a,"CONTENT")?a.getDistributedNodes():a.assignedNodes(),l(a,function(g){pd(g,b,c,d,e)})):jd(a,b)}else if(S(a,"SHADOW")){for(f=a;f.parentNode;)f=f.parentNode;if(f instanceof ShadowRoot&&(a=f))for(a=a.olderShadowRoot;a;)l(a.childNodes,function(g){pd(g,b,c,d,e)}),a=a.olderShadowRoot}else jd(a,b)}
115
+ function pd(a,b,c,d,e){if(3==a.nodeType&&c)nd(a,b,d,e);else if(S(a))if(S(a,"CONTENT")||S(a,"SLOT")){for(var f=a;f.parentNode;)f=f.parentNode;f instanceof ShadowRoot?(f=S(a,"CONTENT")?a.getDistributedNodes():a.assignedNodes(),l(0<f.length?f:a.childNodes,function(g){pd(g,b,c,d,e)})):jd(a,b)}else if(S(a,"SHADOW")){for(f=a;f.parentNode;)f=f.parentNode;if(f instanceof ShadowRoot&&(a=f))for(a=a.olderShadowRoot;a;)l(a.childNodes,function(g){pd(g,b,c,d,e)}),a=a.olderShadowRoot}else jd(a,b)}
116
116
  function jd(a,b){a.shadowRoot&&l(a.shadowRoot.childNodes,function(c){pd(c,b,!0,null,null)});ld(a,b,function(c,d,e,f,g){var h=null;1==c.nodeType?h=c:3==c.nodeType&&(h=c);null!=h&&(null!=h.assignedSlot||h.getDestinationInsertionPoints&&0<h.getDestinationInsertionPoints().length)||pd(c,d,e,f,g)})};var qd={C:function(a,b){return!(!a.querySelectorAll||!a.querySelector)&&!/^\d.*/.test(b)},o:function(a,b){var c=eb(b),d="string"===typeof a?c.a.getElementById(a):a;return d?Uc(d,"id")==a&&b!=d&&hb(b,d)?d:ua(mb(c,"*"),function(e){return Uc(e,"id")==a&&b!=e&&hb(b,e)}):null},j:function(a,b){if(!a)return[];if(qd.C(b,a))try{return b.querySelectorAll("#"+qd.T(a))}catch(c){return[]}b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"id")==a})},T:function(a){return a.replace(/([\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-\/\[\]\(\)])/g,
117
117
  "\\$1")}};var Y={},rd={};Y.N=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return ua(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.K=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return pa(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.o=function(a,b){return Y.N(a,b,!1)};Y.j=function(a,b){return Y.K(a,b,!1)};rd.o=function(a,b){return Y.N(a,b,!0)};
118
118
  rd.j=function(a,b){return Y.K(a,b,!0)};var Z={F:function(a,b){return function(c){var d=Z.u(a);d=W(d);c=W(c);return b.call(null,d,c)}},R:function(a){return Z.F(a,function(b,c){return c.b+c.height<b.b})},S:function(a){return Z.F(a,function(b,c){return b.b+b.height<c.b})},V:function(a){return Z.F(a,function(b,c){return c.a+c.width<b.a})},aa:function(a){return Z.F(a,function(b,c){return b.a+b.width<c.a})},W:function(a,b){var c;b?c=b:"number"==typeof a.distance&&(c=a.distance);c||(c=50);return function(d){var e=Z.u(a);if(e===d)return!1;e=W(e);