selenium-webdriver 4.8.2 → 4.9.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 +25 -1
- package/bidi/argumentValue.js +34 -0
- package/bidi/browsingContext.js +1 -25
- package/bidi/browsingContextInspector.js +95 -0
- package/bidi/browsingContextTypes.js +52 -0
- package/bidi/evaluateResult.js +60 -0
- package/bidi/logEntries.js +16 -13
- package/bidi/protocolType.js +97 -0
- package/bidi/protocolValue.js +204 -0
- package/bidi/realmInfo.js +99 -0
- package/bidi/resultOwnership.js +23 -0
- package/bidi/scriptManager.js +325 -0
- package/bin/linux/selenium-manager +0 -0
- package/bin/macos/selenium-manager +0 -0
- package/bin/windows/selenium-manager.exe +0 -0
- package/chrome.js +0 -18
- package/chromium.js +4 -0
- package/common/driverFinder.js +59 -0
- package/common/seleniumManager.js +47 -20
- package/edge.js +0 -17
- package/firefox.js +8 -20
- package/http/index.js +2 -1
- package/ie.js +4 -17
- package/index.js +4 -0
- package/lib/http.js +17 -3
- package/lib/webdriver.js +14 -7
- package/package.json +9 -8
- package/remote/index.js +8 -4
- package/remote/util.js +3 -1
package/firefox.js
CHANGED
|
@@ -127,7 +127,7 @@ const webdriver = require('./lib/webdriver')
|
|
|
127
127
|
const zip = require('./io/zip')
|
|
128
128
|
const { Browser, Capabilities } = require('./lib/capabilities')
|
|
129
129
|
const { Zip } = require('./io/zip')
|
|
130
|
-
const {
|
|
130
|
+
const { getPath } = require('./common/driverFinder')
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Thrown when there an add-on is malformed.
|
|
@@ -471,25 +471,7 @@ function locateSynchronously() {
|
|
|
471
471
|
* @throws {Error}
|
|
472
472
|
*/
|
|
473
473
|
function findGeckoDriver() {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (!exe) {
|
|
477
|
-
try {
|
|
478
|
-
exe = driverLocation(Browser.FIREFOX)
|
|
479
|
-
} catch (err) {
|
|
480
|
-
console.log(`Unable to obtain driver using Selenium Manager: ${err}`)
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (!exe) {
|
|
485
|
-
throw Error(
|
|
486
|
-
`GeckoDriver could not be found on the PATH.
|
|
487
|
-
For more information on how to install drivers see
|
|
488
|
-
https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/.`
|
|
489
|
-
)
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return exe
|
|
474
|
+
return locateSynchronously()
|
|
493
475
|
}
|
|
494
476
|
|
|
495
477
|
/**
|
|
@@ -626,10 +608,16 @@ class Driver extends webdriver.WebDriver {
|
|
|
626
608
|
executor = opt_executor
|
|
627
609
|
configureExecutor(executor)
|
|
628
610
|
} else if (opt_executor instanceof remote.DriverService) {
|
|
611
|
+
if (!opt_executor.getExecutable()) {
|
|
612
|
+
opt_executor.setExecutable(getPath(opt_executor, opt_config))
|
|
613
|
+
}
|
|
629
614
|
executor = createExecutor(opt_executor.start())
|
|
630
615
|
onQuit = () => opt_executor.kill()
|
|
631
616
|
} else {
|
|
632
617
|
let service = new ServiceBuilder().build()
|
|
618
|
+
if (!service.getExecutable()) {
|
|
619
|
+
service.setExecutable(getPath(service, opt_config))
|
|
620
|
+
}
|
|
633
621
|
executor = createExecutor(service.start())
|
|
634
622
|
onQuit = () => service.kill()
|
|
635
623
|
}
|
package/http/index.js
CHANGED
|
@@ -54,7 +54,8 @@ function getRequestOptions(aUrl) {
|
|
|
54
54
|
options.search = null
|
|
55
55
|
options.hash = null
|
|
56
56
|
options.path = options.pathname
|
|
57
|
-
|
|
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.
|
|
58
59
|
return options
|
|
59
60
|
}
|
|
60
61
|
|
package/ie.js
CHANGED
|
@@ -35,7 +35,7 @@ const remote = require('./remote')
|
|
|
35
35
|
const webdriver = require('./lib/webdriver')
|
|
36
36
|
const { Browser, Capabilities } = require('./lib/capabilities')
|
|
37
37
|
const error = require('./lib/error')
|
|
38
|
-
const {
|
|
38
|
+
const { getPath } = require('./common/driverFinder')
|
|
39
39
|
|
|
40
40
|
const IEDRIVER_EXE = 'IEDriverServer.exe'
|
|
41
41
|
const OPTIONS_CAPABILITY_KEY = 'se:ieOptions'
|
|
@@ -400,22 +400,6 @@ function createServiceFromCapabilities(capabilities) {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
let exe = locateSynchronously()
|
|
403
|
-
if (!exe) {
|
|
404
|
-
try {
|
|
405
|
-
exe = driverLocation('iexplorer')
|
|
406
|
-
} catch (err) {
|
|
407
|
-
console.log(`Unable to obtain driver using Selenium Manager: ${err}`)
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (!exe || !fs.existsSync(exe)) {
|
|
412
|
-
throw Error(
|
|
413
|
-
`IEDriver could not be found on the PATH.
|
|
414
|
-
For more information on how to install drivers see
|
|
415
|
-
https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/.`
|
|
416
|
-
)
|
|
417
|
-
}
|
|
418
|
-
|
|
419
403
|
var args = []
|
|
420
404
|
if (capabilities.has(Key.HOST)) {
|
|
421
405
|
args.push('--host=' + capabilities.get(Key.HOST))
|
|
@@ -482,6 +466,9 @@ class Driver extends webdriver.WebDriver {
|
|
|
482
466
|
} else {
|
|
483
467
|
service = createServiceFromCapabilities(options)
|
|
484
468
|
}
|
|
469
|
+
if (!service.getExecutable()) {
|
|
470
|
+
service.setExecutable(getPath(service, options))
|
|
471
|
+
}
|
|
485
472
|
|
|
486
473
|
let client = service.start().then((url) => new http.HttpClient(url))
|
|
487
474
|
let executor = new http.Executor(client)
|
package/index.js
CHANGED
|
@@ -41,6 +41,8 @@ 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')
|
|
45
|
+
const ScriptManager = require('./bidi/scriptManager')
|
|
44
46
|
|
|
45
47
|
const Browser = capabilities.Browser
|
|
46
48
|
const Capabilities = capabilities.Capabilities
|
|
@@ -799,3 +801,5 @@ exports.until = until
|
|
|
799
801
|
exports.Select = select.Select
|
|
800
802
|
exports.LogInspector = LogInspector
|
|
801
803
|
exports.BrowsingContext = BrowsingContext
|
|
804
|
+
exports.BrowsingConextInspector = BrowsingConextInspector
|
|
805
|
+
exports.ScriptManager = ScriptManager
|
package/lib/http.js
CHANGED
|
@@ -189,7 +189,10 @@ function toExecuteAtomCommand(command, atom, name, ...params) {
|
|
|
189
189
|
|
|
190
190
|
return new cmd.Command(cmd.Name.EXECUTE_SCRIPT)
|
|
191
191
|
.setParameter('sessionId', command.getParameter('sessionId'))
|
|
192
|
-
.setParameter(
|
|
192
|
+
.setParameter(
|
|
193
|
+
'script',
|
|
194
|
+
`/* ${name} */return (${atom}).apply(null, arguments)`
|
|
195
|
+
)
|
|
193
196
|
.setParameter(
|
|
194
197
|
'args',
|
|
195
198
|
params.map((param) => command.getParameter(param))
|
|
@@ -252,7 +255,12 @@ const W3C_COMMAND_MAP = new Map([
|
|
|
252
255
|
[
|
|
253
256
|
cmd.Name.FIND_ELEMENTS_RELATIVE,
|
|
254
257
|
(cmd) => {
|
|
255
|
-
return toExecuteAtomCommand(
|
|
258
|
+
return toExecuteAtomCommand(
|
|
259
|
+
cmd,
|
|
260
|
+
Atom.FIND_ELEMENTS,
|
|
261
|
+
'findElements',
|
|
262
|
+
'args'
|
|
263
|
+
)
|
|
256
264
|
},
|
|
257
265
|
],
|
|
258
266
|
[
|
|
@@ -272,7 +280,13 @@ const W3C_COMMAND_MAP = new Map([
|
|
|
272
280
|
[
|
|
273
281
|
cmd.Name.GET_ELEMENT_ATTRIBUTE,
|
|
274
282
|
(cmd) => {
|
|
275
|
-
return toExecuteAtomCommand(
|
|
283
|
+
return toExecuteAtomCommand(
|
|
284
|
+
cmd,
|
|
285
|
+
Atom.GET_ATTRIBUTE,
|
|
286
|
+
'getAttribute',
|
|
287
|
+
'id',
|
|
288
|
+
'name'
|
|
289
|
+
)
|
|
276
290
|
},
|
|
277
291
|
],
|
|
278
292
|
[
|
package/lib/webdriver.js
CHANGED
|
@@ -2252,11 +2252,13 @@ class Window {
|
|
|
2252
2252
|
*/
|
|
2253
2253
|
async getSize(windowHandle = 'current') {
|
|
2254
2254
|
if (windowHandle !== 'current') {
|
|
2255
|
-
console.warn(
|
|
2255
|
+
console.warn(
|
|
2256
|
+
`Only 'current' window is supported for W3C compatible browsers.`
|
|
2257
|
+
)
|
|
2256
2258
|
}
|
|
2257
2259
|
|
|
2258
|
-
const rect = await this.getRect()
|
|
2259
|
-
return {height: rect.height, width: rect.width}
|
|
2260
|
+
const rect = await this.getRect()
|
|
2261
|
+
return { height: rect.height, width: rect.width }
|
|
2260
2262
|
}
|
|
2261
2263
|
|
|
2262
2264
|
/**
|
|
@@ -2268,12 +2270,17 @@ class Window {
|
|
|
2268
2270
|
* @param windowHandle
|
|
2269
2271
|
* @returns {Promise<void>}
|
|
2270
2272
|
*/
|
|
2271
|
-
async setSize(
|
|
2273
|
+
async setSize(
|
|
2274
|
+
{ x = 0, y = 0, width = 0, height = 0 },
|
|
2275
|
+
windowHandle = 'current'
|
|
2276
|
+
) {
|
|
2272
2277
|
if (windowHandle !== 'current') {
|
|
2273
|
-
console.warn(
|
|
2278
|
+
console.warn(
|
|
2279
|
+
`Only 'current' window is supported for W3C compatible browsers.`
|
|
2280
|
+
)
|
|
2274
2281
|
}
|
|
2275
2282
|
|
|
2276
|
-
await this.setRect({x, y, width, height})
|
|
2283
|
+
await this.setRect({ x, y, width, height })
|
|
2277
2284
|
}
|
|
2278
2285
|
}
|
|
2279
2286
|
|
|
@@ -3006,7 +3013,7 @@ class WebElement {
|
|
|
3006
3013
|
"e.initEvent('submit', true, true);\n" +
|
|
3007
3014
|
'if (form.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }\n'
|
|
3008
3015
|
|
|
3009
|
-
this.driver_.executeScript(script, this)
|
|
3016
|
+
return this.driver_.executeScript(script, this)
|
|
3010
3017
|
}
|
|
3011
3018
|
|
|
3012
3019
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
{
|
|
2
3
|
"name": "selenium-webdriver",
|
|
3
|
-
"version": "4.
|
|
4
|
+
"version": "4.9.1",
|
|
4
5
|
"description": "The official WebDriver JavaScript bindings from the Selenium project",
|
|
5
6
|
"license": "Apache-2.0",
|
|
6
7
|
"keywords": [
|
|
@@ -23,25 +24,25 @@
|
|
|
23
24
|
"node": ">= 14.20.0"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"jszip": "^3.10.
|
|
27
|
+
"jszip": "^3.10.1",
|
|
27
28
|
"tmp": "^0.2.1",
|
|
28
|
-
"ws": ">=8.
|
|
29
|
+
"ws": ">=8.13.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"eslint": "^8.
|
|
32
|
-
"eslint-config-prettier": "^8.
|
|
32
|
+
"eslint": "^8.37.0",
|
|
33
|
+
"eslint-config-prettier": "^8.8.0",
|
|
33
34
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
34
35
|
"eslint-plugin-node": "^11.1.0",
|
|
35
36
|
"eslint-plugin-prettier": "^4.2.1",
|
|
36
37
|
"express": "^4.18.2",
|
|
37
38
|
"mocha": "^10.2.0",
|
|
38
39
|
"multer": "^1.4.5-lts.1",
|
|
39
|
-
"prettier": "^2.7
|
|
40
|
+
"prettier": "^2.8.7",
|
|
40
41
|
"serve-index": "^1.9.1",
|
|
41
|
-
"sinon": "^
|
|
42
|
+
"sinon": "^15.0.3"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
|
-
"lint": "eslint --ignore-pattern node_modules --ignore-pattern generator --
|
|
45
|
+
"lint": "eslint --ignore-pattern node_modules --ignore-pattern generator --ext js lib/http.js \"**/*.js\"",
|
|
45
46
|
"test": "npm run lint && mocha -t 600000 --recursive test",
|
|
46
47
|
"test-jasmine": "bazel test //javascript/node/selenium-webdriver:tests"
|
|
47
48
|
},
|
package/remote/index.js
CHANGED
|
@@ -167,6 +167,14 @@ class DriverService {
|
|
|
167
167
|
this.address_ = null
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
getExecutable() {
|
|
171
|
+
return this.executable_
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
setExecutable(value) {
|
|
175
|
+
this.executable_ = value
|
|
176
|
+
}
|
|
177
|
+
|
|
170
178
|
/**
|
|
171
179
|
* @return {!Promise<string>} A promise that resolves to the server's address.
|
|
172
180
|
* @throws {Error} If the server has not been started.
|
|
@@ -318,10 +326,6 @@ DriverService.Builder = class {
|
|
|
318
326
|
* @throws {Error} If the provided executable path does not exist.
|
|
319
327
|
*/
|
|
320
328
|
constructor(exe) {
|
|
321
|
-
if (!fs.existsSync(exe)) {
|
|
322
|
-
throw Error(`The specified executable path does not exist: ${exe}`)
|
|
323
|
-
}
|
|
324
|
-
|
|
325
329
|
/** @private @const {string} */
|
|
326
330
|
this.exe_ = exe
|
|
327
331
|
|
package/remote/util.js
CHANGED
|
@@ -52,7 +52,9 @@ function isSelenium3x(seleniumStandalonePath) {
|
|
|
52
52
|
*/
|
|
53
53
|
function formatSpawnArgs(seleniumStandalonePath, args) {
|
|
54
54
|
if (isSelenium3x(seleniumStandalonePath)) {
|
|
55
|
-
console.warn(
|
|
55
|
+
console.warn(
|
|
56
|
+
'Deprecation: Support for Standalone Server 3.x will be removed soon. Please update to version 4.x'
|
|
57
|
+
)
|
|
56
58
|
return args
|
|
57
59
|
}
|
|
58
60
|
|