selenium-webdriver 4.1.0 → 4.1.1
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.
- package/CHANGES.md +15 -0
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/chrome.js +13 -10
- package/chromium.js +32 -6
- package/edge.js +8 -6
- package/example/google_search.js +1 -1
- package/firefox.js +32 -17
- package/index.js +4 -4
- package/io/exec.js +2 -1
- package/io/index.js +23 -21
- package/io/zip.js +1 -3
- package/lib/by.js +5 -5
- package/lib/command.js +1 -11
- package/lib/error.js +1 -20
- package/lib/http.js +62 -158
- package/lib/input.js +1 -1
- package/lib/promise.js +12 -17
- package/lib/proxy.js +15 -5
- package/lib/session.js +1 -1
- package/lib/until.js +14 -16
- package/lib/webdriver.js +95 -101
- package/net/index.js +14 -7
- package/net/portprober.js +4 -3
- package/opera.js +19 -22
- package/package.json +1 -1
- package/remote/index.js +12 -9
- package/safari.js +3 -3
- package/testing/index.js +11 -4
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## v4.1.1
|
|
2
|
+
|
|
3
|
+
* Add support for installing unpacked addons at runtime in Firefox webdriver (#10216)
|
|
4
|
+
* Enables firefox debugger for devtools test
|
|
5
|
+
* Sets correct browserName when set via SELENIUM_BROWSER fixes #10218
|
|
6
|
+
* add support for Chrome v97
|
|
7
|
+
* Adds new desktop cast command for Chromium #10190 (#10191)
|
|
8
|
+
* ignore errors arising from trying to use file detector fixes #6343
|
|
9
|
+
* Added RelativeBy class on the main api (#10148)
|
|
10
|
+
* Code cleanup and minor improvements
|
|
11
|
+
* Implements 'getDomAttribute' to get attribute value as defined by w3c spec and removes legacy command usages
|
|
12
|
+
* Remove legacy JWP support and w3c<boolean> switch (#10095)
|
|
13
|
+
* update map/filter clean up to common format (#10094)
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
## v4.1.0
|
|
2
17
|
|
|
3
18
|
* add support for handling Shadow DOM elements
|
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2022 Software Freedom Conservancy (SFC)
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/NOTICE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Copyright 2011-
|
|
1
|
+
Copyright 2011-2022 Software Freedom Conservancy
|
|
2
2
|
Copyright 2004-2011 Selenium committers
|
package/chrome.js
CHANGED
|
@@ -236,10 +236,9 @@ class Driver extends chromium.Driver {
|
|
|
236
236
|
*/
|
|
237
237
|
static createSession(opt_config, opt_serviceExecutor) {
|
|
238
238
|
let caps = opt_config || new Options()
|
|
239
|
-
return /** @type {!Driver} */ (
|
|
240
|
-
caps,
|
|
241
|
-
|
|
242
|
-
))
|
|
239
|
+
return /** @type {!Driver} */ (
|
|
240
|
+
super.createSession(caps, opt_serviceExecutor)
|
|
241
|
+
)
|
|
243
242
|
}
|
|
244
243
|
}
|
|
245
244
|
|
|
@@ -287,9 +286,13 @@ Driver.getDefaultService = getDefaultService
|
|
|
287
286
|
Driver.prototype.VENDOR_COMMAND_PREFIX = 'goog'
|
|
288
287
|
|
|
289
288
|
// PUBLIC API
|
|
290
|
-
|
|
291
|
-
exports
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
289
|
+
|
|
290
|
+
module.exports = {
|
|
291
|
+
Driver: Driver,
|
|
292
|
+
Options,
|
|
293
|
+
ServiceBuilder ,
|
|
294
|
+
getDefaultService,
|
|
295
|
+
setDefaultService,
|
|
296
|
+
locateSynchronously
|
|
297
|
+
}
|
|
298
|
+
|
package/chromium.js
CHANGED
|
@@ -97,6 +97,7 @@ const Command = {
|
|
|
97
97
|
SET_PERMISSION: 'setPermission',
|
|
98
98
|
GET_CAST_SINKS: 'getCastSinks',
|
|
99
99
|
SET_CAST_SINK_TO_USE: 'setCastSinkToUse',
|
|
100
|
+
START_CAST_DESKTOP_MIRRORING: 'startDesktopMirroring',
|
|
100
101
|
START_CAST_TAB_MIRRORING: 'setCastTabMirroring',
|
|
101
102
|
GET_CAST_ISSUE_MESSAGE: 'getCastIssueMessage',
|
|
102
103
|
STOP_CASTING: 'stopCasting',
|
|
@@ -105,6 +106,7 @@ const Command = {
|
|
|
105
106
|
/**
|
|
106
107
|
* Creates a command executor with support for Chromium's custom commands.
|
|
107
108
|
* @param {!Promise<string>} url The server's URL.
|
|
109
|
+
* @param vendorPrefix
|
|
108
110
|
* @return {!command.Executor} The new command executor.
|
|
109
111
|
*/
|
|
110
112
|
function createExecutor(url, vendorPrefix) {
|
|
@@ -160,6 +162,11 @@ function configureExecutor(executor, vendorPrefix) {
|
|
|
160
162
|
'POST',
|
|
161
163
|
`/session/:sessionId/${vendorPrefix}/cast/set_sink_to_use`
|
|
162
164
|
)
|
|
165
|
+
executor.defineCommand(
|
|
166
|
+
Command.START_CAST_DESKTOP_MIRRORING,
|
|
167
|
+
'POST',
|
|
168
|
+
`/session/:sessionId/${vendorPrefix}/cast/start_desktop_mirroring`
|
|
169
|
+
)
|
|
163
170
|
executor.defineCommand(
|
|
164
171
|
Command.START_CAST_TAB_MIRRORING,
|
|
165
172
|
'POST',
|
|
@@ -217,8 +224,8 @@ class ServiceBuilder extends remote.DriverService.Builder {
|
|
|
217
224
|
* Enables Chrome logging.
|
|
218
225
|
* @returns {!ServiceBuilder} A self reference.
|
|
219
226
|
*/
|
|
220
|
-
|
|
221
|
-
return this.addArguments('--enable-chrome-logs')
|
|
227
|
+
enableChromeLogging() {
|
|
228
|
+
return this.addArguments('--enable-chrome-logs')
|
|
222
229
|
}
|
|
223
230
|
|
|
224
231
|
/**
|
|
@@ -292,7 +299,7 @@ class Options extends Capabilities {
|
|
|
292
299
|
* @return {!Options} A self reference.
|
|
293
300
|
*/
|
|
294
301
|
debuggerAddress(address) {
|
|
295
|
-
this.options_.debuggerAddress = address
|
|
302
|
+
this.options_.debuggerAddress = address
|
|
296
303
|
return this
|
|
297
304
|
}
|
|
298
305
|
|
|
@@ -833,6 +840,23 @@ class Driver extends webdriver.WebDriver {
|
|
|
833
840
|
)
|
|
834
841
|
}
|
|
835
842
|
|
|
843
|
+
/**
|
|
844
|
+
* Initiates desktop mirroring for the current browser tab on the specified device.
|
|
845
|
+
*
|
|
846
|
+
* @param {String} deviceName name of the target device.
|
|
847
|
+
* @return {!promise.Thenable<void>} A promise that will be resolved
|
|
848
|
+
* when the mirror command has been issued to the device.
|
|
849
|
+
*/
|
|
850
|
+
startDesktopMirroring(deviceName) {
|
|
851
|
+
return this.schedule(
|
|
852
|
+
new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter(
|
|
853
|
+
'sinkName',
|
|
854
|
+
deviceName
|
|
855
|
+
),
|
|
856
|
+
'Driver.startDesktopMirroring(' + deviceName + ')'
|
|
857
|
+
)
|
|
858
|
+
}
|
|
859
|
+
|
|
836
860
|
/**
|
|
837
861
|
* Initiates tab mirroring for the current browser tab on the specified device.
|
|
838
862
|
*
|
|
@@ -882,6 +906,8 @@ class Driver extends webdriver.WebDriver {
|
|
|
882
906
|
|
|
883
907
|
// PUBLIC API
|
|
884
908
|
|
|
885
|
-
exports
|
|
886
|
-
|
|
887
|
-
|
|
909
|
+
module.exports = {
|
|
910
|
+
Driver,
|
|
911
|
+
Options,
|
|
912
|
+
ServiceBuilder,
|
|
913
|
+
}
|
package/edge.js
CHANGED
|
@@ -210,9 +210,11 @@ Driver.getDefaultService = getDefaultService
|
|
|
210
210
|
|
|
211
211
|
// PUBLIC API
|
|
212
212
|
|
|
213
|
-
exports
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
module.exports = {
|
|
214
|
+
Driver,
|
|
215
|
+
Options,
|
|
216
|
+
ServiceBuilder,
|
|
217
|
+
getDefaultService,
|
|
218
|
+
setDefaultService,
|
|
219
|
+
locateSynchronously,
|
|
220
|
+
}
|
package/example/google_search.js
CHANGED
package/firefox.js
CHANGED
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
|
|
117
117
|
'use strict'
|
|
118
118
|
|
|
119
|
+
const fs = require('fs')
|
|
119
120
|
const path = require('path')
|
|
120
121
|
const Symbols = require('./lib/symbols')
|
|
121
122
|
const command = require('./lib/command')
|
|
@@ -222,7 +223,7 @@ async function buildProfile(template, extensions) {
|
|
|
222
223
|
dir = await io.tmpDir()
|
|
223
224
|
if (template) {
|
|
224
225
|
await io.copyDir(
|
|
225
|
-
/** @type {string} */(template),
|
|
226
|
+
/** @type {string} */ (template),
|
|
226
227
|
dir,
|
|
227
228
|
/(parent\.lock|lock|\.parentlock)/
|
|
228
229
|
)
|
|
@@ -400,7 +401,11 @@ class Options extends Capabilities {
|
|
|
400
401
|
* @param {string} androidPackage The package to use
|
|
401
402
|
* @return {!Options} A self reference
|
|
402
403
|
*/
|
|
403
|
-
enableMobile(
|
|
404
|
+
enableMobile(
|
|
405
|
+
androidPackage = 'org.mozilla.firefox',
|
|
406
|
+
androidActivity = null,
|
|
407
|
+
deviceSerial = null
|
|
408
|
+
) {
|
|
404
409
|
this.firefoxOptions_().androidPackage = androidPackage
|
|
405
410
|
|
|
406
411
|
if (androidActivity) {
|
|
@@ -457,11 +462,11 @@ function findGeckoDriver() {
|
|
|
457
462
|
if (!exe) {
|
|
458
463
|
throw Error(
|
|
459
464
|
'The ' +
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
+
GECKO_DRIVER_EXE +
|
|
466
|
+
' executable could not be found on the current ' +
|
|
467
|
+
'PATH. Please download the latest version from ' +
|
|
468
|
+
'https://github.com/mozilla/geckodriver/releases/ ' +
|
|
469
|
+
'and ensure it can be found on your PATH.'
|
|
465
470
|
)
|
|
466
471
|
}
|
|
467
472
|
return exe
|
|
@@ -482,8 +487,8 @@ function findInProgramFiles(file) {
|
|
|
482
487
|
return exists
|
|
483
488
|
? files[0]
|
|
484
489
|
: io.exists(files[1]).then(function (exists) {
|
|
485
|
-
|
|
486
|
-
|
|
490
|
+
return exists ? files[1] : null
|
|
491
|
+
})
|
|
487
492
|
})
|
|
488
493
|
}
|
|
489
494
|
|
|
@@ -617,7 +622,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
617
622
|
* implementation.
|
|
618
623
|
* @override
|
|
619
624
|
*/
|
|
620
|
-
setFileDetector() {
|
|
625
|
+
setFileDetector() {}
|
|
621
626
|
|
|
622
627
|
/**
|
|
623
628
|
* Get the context that is currently in effect.
|
|
@@ -666,7 +671,15 @@ class Driver extends webdriver.WebDriver {
|
|
|
666
671
|
* @see #uninstallAddon
|
|
667
672
|
*/
|
|
668
673
|
async installAddon(path, temporary = false) {
|
|
669
|
-
let
|
|
674
|
+
let stats = fs.statSync(path)
|
|
675
|
+
let buf;
|
|
676
|
+
if (stats.isDirectory()) {
|
|
677
|
+
let zip = new Zip()
|
|
678
|
+
await zip.addDir(path)
|
|
679
|
+
buf = await zip.toBuffer('DEFLATE')
|
|
680
|
+
} else {
|
|
681
|
+
buf = await io.read(path)
|
|
682
|
+
}
|
|
670
683
|
return this.execute(
|
|
671
684
|
new command.Command(ExtensionCommand.INSTALL_ADDON)
|
|
672
685
|
.setParameter('addon', buf.toString('base64'))
|
|
@@ -805,9 +818,11 @@ Channel.NIGHTLY = new Channel(
|
|
|
805
818
|
|
|
806
819
|
// PUBLIC API
|
|
807
820
|
|
|
808
|
-
exports
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
821
|
+
module.exports = {
|
|
822
|
+
Channel,
|
|
823
|
+
Context,
|
|
824
|
+
Driver,
|
|
825
|
+
Options,
|
|
826
|
+
ServiceBuilder,
|
|
827
|
+
locateSynchronously,
|
|
828
|
+
}
|
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ const Capabilities = capabilities.Capabilities
|
|
|
45
45
|
const Capability = capabilities.Capability
|
|
46
46
|
const WebDriver = webdriver.WebDriver
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
let seleniumServer
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Starts an instance of the Selenium server if not yet running.
|
|
@@ -76,13 +76,12 @@ function startSeleniumServer(jar) {
|
|
|
76
76
|
* @return {function(new: webdriver.WebDriver, ...?)}
|
|
77
77
|
*/
|
|
78
78
|
function ensureFileDetectorsAreEnabled(ctor) {
|
|
79
|
-
|
|
79
|
+
return class extends ctor {
|
|
80
80
|
/** @param {input.FileDetector} detector */
|
|
81
|
-
setFileDetector(detector) {
|
|
81
|
+
setFileDetector (detector) {
|
|
82
82
|
webdriver.WebDriver.prototype.setFileDetector.call(this, detector)
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
return mixin
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
/**
|
|
@@ -821,6 +820,7 @@ exports.Browser = capabilities.Browser
|
|
|
821
820
|
exports.Builder = Builder
|
|
822
821
|
exports.Button = input.Button
|
|
823
822
|
exports.By = by.By
|
|
823
|
+
exports.RelativeBy = by.RelativeBy
|
|
824
824
|
exports.withTagName = by.withTagName
|
|
825
825
|
exports.locateWith = by.locateWith
|
|
826
826
|
exports.Capabilities = capabilities.Capabilities
|
package/io/exec.js
CHANGED
|
@@ -76,7 +76,8 @@ class Result {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const COMMAND_RESULT =
|
|
79
|
+
const COMMAND_RESULT =
|
|
80
|
+
/** !WeakMap<!Command, !Promise<!Result>> */ new WeakMap()
|
|
80
81
|
const KILL_HOOK = /** !WeakMap<!Command, function(string)> */ new WeakMap()
|
|
81
82
|
|
|
82
83
|
/**
|
package/io/index.js
CHANGED
|
@@ -42,8 +42,6 @@ function checkedCall(fn) {
|
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// PUBLIC API
|
|
46
|
-
|
|
47
45
|
/**
|
|
48
46
|
* Recursively removes a directory and all of its contents. This is equivalent
|
|
49
47
|
* to {@code rm -rf} on a POSIX system.
|
|
@@ -114,18 +112,18 @@ function copyDir(src, dst, opt_exclude) {
|
|
|
114
112
|
files = files.filter(/** @type {function(string): boolean} */ (predicate))
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
|
|
115
|
+
const results = []
|
|
118
116
|
files.forEach(function (file) {
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
const stats = fs.statSync(file)
|
|
118
|
+
const target = path.join(dst, path.basename(file))
|
|
121
119
|
|
|
122
120
|
if (stats.isDirectory()) {
|
|
123
121
|
if (!fs.existsSync(target)) {
|
|
124
122
|
fs.mkdirSync(target, stats.mode)
|
|
125
123
|
}
|
|
126
|
-
results.push(
|
|
124
|
+
results.push(copyDir(file, target, predicate))
|
|
127
125
|
} else {
|
|
128
|
-
results.push(
|
|
126
|
+
results.push(copy(file, target))
|
|
129
127
|
}
|
|
130
128
|
})
|
|
131
129
|
|
|
@@ -137,7 +135,7 @@ function copyDir(src, dst, opt_exclude) {
|
|
|
137
135
|
* @param {string} aPath The path to test.
|
|
138
136
|
* @return {!Promise<boolean>} A promise for whether the file exists.
|
|
139
137
|
*/
|
|
140
|
-
|
|
138
|
+
function exists(aPath) {
|
|
141
139
|
return new Promise(function (fulfill, reject) {
|
|
142
140
|
let type = typeof aPath
|
|
143
141
|
if (type !== 'string') {
|
|
@@ -153,7 +151,7 @@ exports.exists = function (aPath) {
|
|
|
153
151
|
* @param {string} aPath The path to stat.
|
|
154
152
|
* @return {!Promise<!fs.Stats>} A promise for the file stats.
|
|
155
153
|
*/
|
|
156
|
-
|
|
154
|
+
function stat(aPath) {
|
|
157
155
|
return checkedCall((callback) => fs.stat(aPath, callback))
|
|
158
156
|
}
|
|
159
157
|
|
|
@@ -335,15 +333,19 @@ function walkDir(rootPath) {
|
|
|
335
333
|
}
|
|
336
334
|
|
|
337
335
|
// PUBLIC API
|
|
338
|
-
module.exports
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
336
|
+
module.exports = {
|
|
337
|
+
walkDir,
|
|
338
|
+
rmDir,
|
|
339
|
+
mkdirp,
|
|
340
|
+
mkdir,
|
|
341
|
+
write,
|
|
342
|
+
read,
|
|
343
|
+
findInPath,
|
|
344
|
+
tmpFile,
|
|
345
|
+
tmpDir,
|
|
346
|
+
unlink,
|
|
347
|
+
copy,
|
|
348
|
+
copyDir,
|
|
349
|
+
exists,
|
|
350
|
+
stat,
|
|
351
|
+
}
|
package/io/zip.js
CHANGED
package/lib/by.js
CHANGED
|
@@ -424,10 +424,10 @@ function check(locator) {
|
|
|
424
424
|
// PUBLIC API
|
|
425
425
|
|
|
426
426
|
module.exports = {
|
|
427
|
-
By
|
|
428
|
-
RelativeBy
|
|
429
|
-
withTagName
|
|
430
|
-
locateWith
|
|
427
|
+
By,
|
|
428
|
+
RelativeBy,
|
|
429
|
+
withTagName,
|
|
430
|
+
locateWith,
|
|
431
|
+
escapeCss,
|
|
431
432
|
checkedLocator: check,
|
|
432
|
-
escapeCss: escapeCss
|
|
433
433
|
}
|
package/lib/command.js
CHANGED
|
@@ -83,7 +83,6 @@ class Command {
|
|
|
83
83
|
* will support.
|
|
84
84
|
* @enum {string}
|
|
85
85
|
*/
|
|
86
|
-
// TODO: Delete obsolete command names.
|
|
87
86
|
const Name = {
|
|
88
87
|
GET_SERVER_STATUS: 'getStatus',
|
|
89
88
|
|
|
@@ -115,14 +114,9 @@ const Name = {
|
|
|
115
114
|
CLEAR_ELEMENT: 'clearElement',
|
|
116
115
|
CLICK_ELEMENT: 'clickElement',
|
|
117
116
|
SEND_KEYS_TO_ELEMENT: 'sendKeysToElement',
|
|
118
|
-
SUBMIT_ELEMENT: 'submitElement',
|
|
119
117
|
|
|
120
118
|
GET_CURRENT_WINDOW_HANDLE: 'getCurrentWindowHandle',
|
|
121
119
|
GET_WINDOW_HANDLES: 'getWindowHandles',
|
|
122
|
-
GET_WINDOW_POSITION: 'getWindowPosition',
|
|
123
|
-
SET_WINDOW_POSITION: 'setWindowPosition',
|
|
124
|
-
GET_WINDOW_SIZE: 'getWindowSize',
|
|
125
|
-
SET_WINDOW_SIZE: 'setWindowSize',
|
|
126
120
|
GET_WINDOW_RECT: 'getWindowRect',
|
|
127
121
|
SET_WINDOW_RECT: 'setWindowRect',
|
|
128
122
|
MAXIMIZE_WINDOW: 'maximizeWindow',
|
|
@@ -146,17 +140,14 @@ const Name = {
|
|
|
146
140
|
IS_ELEMENT_SELECTED: 'isElementSelected',
|
|
147
141
|
IS_ELEMENT_ENABLED: 'isElementEnabled',
|
|
148
142
|
IS_ELEMENT_DISPLAYED: 'isElementDisplayed',
|
|
149
|
-
GET_ELEMENT_LOCATION: 'getElementLocation',
|
|
150
|
-
GET_ELEMENT_LOCATION_IN_VIEW: 'getElementLocationOnceScrolledIntoView',
|
|
151
143
|
GET_ELEMENT_RECT: 'getElementRect',
|
|
152
|
-
GET_ELEMENT_SIZE: 'getElementSize',
|
|
153
144
|
GET_ELEMENT_ATTRIBUTE: 'getElementAttribute',
|
|
145
|
+
GET_DOM_ATTRIBUTE: 'getDomAttribute',
|
|
154
146
|
GET_ELEMENT_VALUE_OF_CSS_PROPERTY: 'getElementValueOfCssProperty',
|
|
155
147
|
GET_ELEMENT_PROPERTY: 'getElementProperty',
|
|
156
148
|
|
|
157
149
|
SCREENSHOT: 'screenshot',
|
|
158
150
|
TAKE_ELEMENT_SCREENSHOT: 'takeElementScreenshot',
|
|
159
|
-
SET_SCRIPT_TIMEOUT: 'setScriptTimeout',
|
|
160
151
|
|
|
161
152
|
PRINT_PAGE: 'printPage',
|
|
162
153
|
|
|
@@ -175,7 +166,6 @@ const Name = {
|
|
|
175
166
|
|
|
176
167
|
GET_AVAILABLE_LOG_TYPES: 'getAvailableLogTypes',
|
|
177
168
|
GET_LOG: 'getLog',
|
|
178
|
-
GET_SESSION_LOGS: 'getSessionLogs',
|
|
179
169
|
|
|
180
170
|
// Non-standard commands used by the standalone Selenium server.
|
|
181
171
|
UPLOAD_FILE: 'uploadFile',
|
package/lib/error.js
CHANGED
|
@@ -217,7 +217,7 @@ class NoSuchElementError extends WebDriverError {
|
|
|
217
217
|
class NoSuchShadowRootError extends WebDriverError {
|
|
218
218
|
/** @param {string=} opt_error the error message, if any. */
|
|
219
219
|
constructor(opt_error) {
|
|
220
|
-
super(opt_error)
|
|
220
|
+
super(opt_error)
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -495,23 +495,6 @@ function encodeError(err) {
|
|
|
495
495
|
return { error: code, message: message }
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
/**
|
|
499
|
-
* Checks a response object from a server that adheres to the W3C WebDriver
|
|
500
|
-
* protocol.
|
|
501
|
-
* @param {*} data The response data to check.
|
|
502
|
-
* @return {*} The response data if it was not an encoded error.
|
|
503
|
-
* @throws {WebDriverError} the decoded error, if present in the data object.
|
|
504
|
-
* @deprecated Use {@link #throwDecodedError(data)} instead.
|
|
505
|
-
* @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol
|
|
506
|
-
*/
|
|
507
|
-
function checkResponse(data) {
|
|
508
|
-
if (data && typeof data.error === 'string') {
|
|
509
|
-
let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError
|
|
510
|
-
throw new ctor(data.message)
|
|
511
|
-
}
|
|
512
|
-
return data
|
|
513
|
-
}
|
|
514
|
-
|
|
515
498
|
/**
|
|
516
499
|
* Tests if the given value is a valid error response object according to the
|
|
517
500
|
* W3C WebDriver spec.
|
|
@@ -620,8 +603,6 @@ module.exports = {
|
|
|
620
603
|
UnknownCommandError,
|
|
621
604
|
UnknownMethodError,
|
|
622
605
|
UnsupportedOperationError,
|
|
623
|
-
|
|
624
|
-
checkResponse,
|
|
625
606
|
checkLegacyResponse,
|
|
626
607
|
encodeError,
|
|
627
608
|
isErrorResponse,
|