selenium-webdriver 4.25.0 → 4.26.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## 4.26.0
2
+
3
+ - Add CDP for Chrome 130 and remove 127
4
+ - Fix sendKeys command fail on FileDetector.handleFile error (#14663)
5
+ - Update dependencies to latest versions to resolve security alerts
6
+ - Close BiDi websocket connection (#14507)
7
+
1
8
  ## 4.25.0
2
9
 
3
10
  - Add CDP for Chrome 129 and remove 126
Binary file
Binary file
Binary file
package/lib/network.js CHANGED
@@ -30,7 +30,7 @@ class Network {
30
30
 
31
31
  // This should be done in the constructor.
32
32
  // But since it needs to call async methods we cannot do that in the constructor.
33
- // We can have a separate async method that initialises the Script instance.
33
+ // We can have a separate async method that initialises the Network instance.
34
34
  // However, that pattern does not allow chaining the methods as we would like the user to use it.
35
35
  // Since it involves awaiting to get the instance and then another await to call the method.
36
36
  // Using this allows the user to do this "await driver.network.addAuthenticationHandler(callback)"
package/lib/webdriver.js CHANGED
@@ -789,8 +789,13 @@ class WebDriver {
789
789
  // If the websocket connection is not closed,
790
790
  // and we are running CDP sessions against the Selenium Grid,
791
791
  // the node process never exits since the websocket connection is open until the Grid is shutdown.
792
- if (this._wsConnection !== undefined) {
793
- this._wsConnection.close()
792
+ if (this._cdpWsConnection !== undefined) {
793
+ this._cdpWsConnection.close()
794
+ }
795
+
796
+ // Close the BiDi websocket connection
797
+ if (this._bidiConnection !== undefined) {
798
+ this._bidiConnection.close()
794
799
  }
795
800
  })
796
801
  }
@@ -1241,18 +1246,18 @@ class WebDriver {
1241
1246
  this._wsUrl = await this.getWsUrl(debuggerUrl, target, caps)
1242
1247
  return new Promise((resolve, reject) => {
1243
1248
  try {
1244
- this._wsConnection = new WebSocket(this._wsUrl.replace('localhost', '127.0.0.1'))
1245
- this._cdpConnection = new cdp.CdpConnection(this._wsConnection)
1249
+ this._cdpWsConnection = new WebSocket(this._wsUrl.replace('localhost', '127.0.0.1'))
1250
+ this._cdpConnection = new cdp.CdpConnection(this._cdpWsConnection)
1246
1251
  } catch (err) {
1247
1252
  reject(err)
1248
1253
  return
1249
1254
  }
1250
1255
 
1251
- this._wsConnection.on('open', async () => {
1256
+ this._cdpWsConnection.on('open', async () => {
1252
1257
  await this.getCdpTargets()
1253
1258
  })
1254
1259
 
1255
- this._wsConnection.on('message', async (message) => {
1260
+ this._cdpWsConnection.on('message', async (message) => {
1256
1261
  const params = JSON.parse(message)
1257
1262
  if (params.result) {
1258
1263
  if (params.result.targetInfos) {
@@ -1273,7 +1278,7 @@ class WebDriver {
1273
1278
  }
1274
1279
  })
1275
1280
 
1276
- this._wsConnection.on('error', (error) => {
1281
+ this._cdpWsConnection.on('error', (error) => {
1277
1282
  reject(error)
1278
1283
  })
1279
1284
  })
@@ -1288,9 +1293,12 @@ class WebDriver {
1288
1293
  * @returns {BIDI}
1289
1294
  */
1290
1295
  async getBidi() {
1291
- const caps = await this.getCapabilities()
1292
- let WebSocketUrl = caps['map_'].get('webSocketUrl')
1293
- return new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'))
1296
+ if (this._bidiConnection === undefined) {
1297
+ const caps = await this.getCapabilities()
1298
+ let WebSocketUrl = caps['map_'].get('webSocketUrl')
1299
+ this._bidiConnection = new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'))
1300
+ }
1301
+ return this._bidiConnection
1294
1302
  }
1295
1303
 
1296
1304
  /**
@@ -1338,7 +1346,7 @@ class WebDriver {
1338
1346
  * @param connection CDP Connection
1339
1347
  */
1340
1348
  async register(username, password, connection) {
1341
- this._wsConnection.on('message', (message) => {
1349
+ this._cdpWsConnection.on('message', (message) => {
1342
1350
  const params = JSON.parse(message)
1343
1351
 
1344
1352
  if (params.method === 'Fetch.authRequired') {
@@ -1383,7 +1391,7 @@ class WebDriver {
1383
1391
  * @param callback callback called when we intercept requests.
1384
1392
  */
1385
1393
  async onIntercept(connection, httpResponse, callback) {
1386
- this._wsConnection.on('message', (message) => {
1394
+ this._cdpWsConnection.on('message', (message) => {
1387
1395
  const params = JSON.parse(message)
1388
1396
  if (params.method === 'Fetch.requestPaused') {
1389
1397
  const requestPausedParams = params['params']
@@ -1420,7 +1428,7 @@ class WebDriver {
1420
1428
  * @returns {Promise<void>}
1421
1429
  */
1422
1430
  async onLogEvent(connection, callback) {
1423
- this._wsConnection.on('message', (message) => {
1431
+ this._cdpWsConnection.on('message', (message) => {
1424
1432
  const params = JSON.parse(message)
1425
1433
  if (params.method === 'Runtime.consoleAPICalled') {
1426
1434
  const consoleEventParams = params['params']
@@ -1457,7 +1465,7 @@ class WebDriver {
1457
1465
  async onLogException(connection, callback) {
1458
1466
  await connection.execute('Runtime.enable', {}, null)
1459
1467
 
1460
- this._wsConnection.on('message', (message) => {
1468
+ this._cdpWsConnection.on('message', (message) => {
1461
1469
  const params = JSON.parse(message)
1462
1470
 
1463
1471
  if (params.method === 'Runtime.exceptionThrown') {
@@ -1510,7 +1518,7 @@ class WebDriver {
1510
1518
  null,
1511
1519
  )
1512
1520
 
1513
- this._wsConnection.on('message', async (message) => {
1521
+ this._cdpWsConnection.on('message', async (message) => {
1514
1522
  const params = JSON.parse(message)
1515
1523
  if (params.method === 'Runtime.bindingCalled') {
1516
1524
  let payload = JSON.parse(params['params']['payload'])
@@ -2744,6 +2752,7 @@ class WebElement {
2744
2752
  keys = await this.driver_.fileDetector_.handleFile(this.driver_, keys.join(''))
2745
2753
  } catch (ex) {
2746
2754
  this.log_.severe('Error trying parse string as a file with file detector; sending keys instead' + ex)
2755
+ keys = keys.join('')
2747
2756
  }
2748
2757
 
2749
2758
  return this.execute_(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "selenium-webdriver",
3
- "version": "4.25.0",
3
+ "version": "4.26.0",
4
4
  "description": "The official WebDriver JavaScript bindings from the Selenium project",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -23,30 +23,30 @@
23
23
  "node": ">= 14.21.0"
24
24
  },
25
25
  "dependencies": {
26
- "@bazel/runfiles": "^5.8.1",
26
+ "@bazel/runfiles": "^6.3.1",
27
27
  "jszip": "^3.10.1",
28
28
  "tmp": "^0.2.3",
29
29
  "ws": "^8.18.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@eslint/js": "^9.8.0",
32
+ "@eslint/js": "^9.13.0",
33
33
  "clean-jsdoc-theme": "^4.3.0",
34
- "eslint": "^9.8.0",
34
+ "eslint": "^9.13.0",
35
35
  "eslint-config-prettier": "^9.1.0",
36
36
  "eslint-plugin-mocha": "^10.5.0",
37
- "eslint-plugin-n": "^17.10.1",
38
- "eslint-plugin-no-only-tests": "^3.1.0",
37
+ "eslint-plugin-n": "^17.11.1",
38
+ "eslint-plugin-no-only-tests": "^3.3.0",
39
39
  "eslint-plugin-prettier": "^5.2.1",
40
- "express": "^4.19.2",
41
- "globals": "^15.9.0",
40
+ "express": "^4.21.1",
41
+ "globals": "^15.11.0",
42
42
  "has-flag": "^5.0.1",
43
- "jsdoc": "^4.0.3",
44
- "mocha": "^10.7.0",
43
+ "jsdoc": "^4.0.4",
44
+ "mocha": "^10.7.3",
45
45
  "mocha-junit-reporter": "^2.2.1",
46
46
  "multer": "1.4.5-lts.1",
47
47
  "prettier": "^3.3.3",
48
48
  "serve-index": "^1.9.1",
49
- "sinon": "^18.0.0",
49
+ "sinon": "^19.0.2",
50
50
  "supports-color": "^9.4.0"
51
51
  },
52
52
  "scripts": {