selenium-webdriver 4.8.1 → 4.9.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.
- package/CHANGES.md +29 -0
- package/bidi/argumentValue.js +34 -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 -23
- package/chromium.js +4 -0
- package/common/driverFinder.js +59 -0
- package/common/seleniumManager.js +51 -16
- package/edge.js +0 -23
- package/firefox.js +8 -24
- package/http/index.js +2 -1
- package/ie.js +4 -22
- package/index.js +2 -0
- package/lib/http.js +17 -3
- package/lib/webdriver.js +15 -8
- package/package.json +9 -8
- package/remote/index.js +8 -4
- package/remote/util.js +3 -1
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,27 +400,6 @@ function createServiceFromCapabilities(capabilities) {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
let exe = locateSynchronously()
|
|
403
|
-
if (!exe) {
|
|
404
|
-
console.log(
|
|
405
|
-
`The ${IEDRIVER_EXE} executable could not be found on the current PATH, trying Selenium Manager`
|
|
406
|
-
)
|
|
407
|
-
|
|
408
|
-
try {
|
|
409
|
-
exe = driverLocation('iexplorer')
|
|
410
|
-
} catch (err) {
|
|
411
|
-
console.log(`Unable to obtain driver using Selenium Manager: ${err}`)
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (!exe || !fs.existsSync(exe)) {
|
|
416
|
-
throw Error(
|
|
417
|
-
`${IEDRIVER_EXE} could not be found on the current PATH. Please ` +
|
|
418
|
-
`download the latest version of ${IEDRIVER_EXE} from ` +
|
|
419
|
-
'https://www.selenium.dev/downloads/ and ' +
|
|
420
|
-
'ensure it can be found on your system PATH.'
|
|
421
|
-
)
|
|
422
|
-
}
|
|
423
|
-
|
|
424
403
|
var args = []
|
|
425
404
|
if (capabilities.has(Key.HOST)) {
|
|
426
405
|
args.push('--host=' + capabilities.get(Key.HOST))
|
|
@@ -487,6 +466,9 @@ class Driver extends webdriver.WebDriver {
|
|
|
487
466
|
} else {
|
|
488
467
|
service = createServiceFromCapabilities(options)
|
|
489
468
|
}
|
|
469
|
+
if (!service.getExecutable()) {
|
|
470
|
+
service.setExecutable(getPath(service, options))
|
|
471
|
+
}
|
|
490
472
|
|
|
491
473
|
let client = service.start().then((url) => new http.HttpClient(url))
|
|
492
474
|
let executor = new http.Executor(client)
|
package/index.js
CHANGED
|
@@ -41,6 +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 ScriptManager = require('./bidi/scriptManager')
|
|
44
45
|
|
|
45
46
|
const Browser = capabilities.Browser
|
|
46
47
|
const Capabilities = capabilities.Capabilities
|
|
@@ -799,3 +800,4 @@ exports.until = until
|
|
|
799
800
|
exports.Select = select.Select
|
|
800
801
|
exports.LogInspector = LogInspector
|
|
801
802
|
exports.BrowsingContext = BrowsingContext
|
|
803
|
+
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
|
@@ -1405,7 +1405,7 @@ class WebDriver {
|
|
|
1405
1405
|
if (requestPausedParams.request.url == httpResponse.urlToIntercept) {
|
|
1406
1406
|
connection.execute('Fetch.fulfillRequest', {
|
|
1407
1407
|
requestId: requestPausedParams['requestId'],
|
|
1408
|
-
responseCode:
|
|
1408
|
+
responseCode: httpResponse.status,
|
|
1409
1409
|
responseHeaders: httpResponse.headers,
|
|
1410
1410
|
body: httpResponse.body,
|
|
1411
1411
|
})
|
|
@@ -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.0",
|
|
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
|
|