selenium-webdriver 4.40.0 → 4.41.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,13 @@
1
+ ## 4.41.0
2
+
3
+ - Support CDP versions: v143, v144, v145
4
+ - Canonical approach to supporting AI agent directions (#16735)
5
+ - [build] Fix Bazel JSDocs implementation (#16949)
6
+ - create task to update dependencies (#16942)
7
+ - Add eslint binary target for selenium-webdriver (#16992)
8
+ - SE_DEBUG warns only when overriding user settings (#17009)
9
+ - [grid] Add session event API for server-side event bus integration (#17015)
10
+
1
11
  ## 4.40.0
2
12
 
3
13
  - fix JS tests on RBE (#16777)
package/bidi/storage.js CHANGED
@@ -44,7 +44,7 @@ class Storage {
44
44
  *
45
45
  * @param {CookieFilter} [filter] - The filter to apply to the cookies.
46
46
  * @param {(BrowsingContextPartitionDescriptor|StorageKeyPartitionDescriptor)} [partition] - The partition to retrieve cookies from.
47
- * @returns {Promise<{ cookies: Cookie[], partitionKey?: PartitionKey }>} - A promise that resolves to an object containing the retrieved cookies and an optional partition key.
47
+ * @returns {Promise<{ cookies: Cookie[], partitionKey: (PartitionKey|undefined) }>} - A promise that resolves to an object containing the retrieved cookies and an optional partition key.
48
48
  * @throws {Error} If the filter parameter is provided but is not an instance of CookieFilter.
49
49
  * @throws {Error} If the partition parameter is provided but is not an instance of BrowsingContextPartitionDescriptor or StorageKeyPartitionDescriptor.
50
50
  */
Binary file
Binary file
Binary file
package/lib/command.js CHANGED
@@ -186,6 +186,8 @@ const Name = {
186
186
  DOWNLOAD_FILE: 'downloadFile',
187
187
  DELETE_DOWNLOADABLE_FILES: 'deleteDownloadableFiles',
188
188
 
189
+ FIRE_SESSION_EVENT: 'fireSessionEvent',
190
+
189
191
  // Federated Credential Management API
190
192
  // https://www.w3.org/TR/fedcm/#automation
191
193
  CANCEL_DIALOG: 'cancelDialog',
package/lib/http.js CHANGED
@@ -321,6 +321,8 @@ const W3C_COMMAND_MAP = new Map([
321
321
  [cmd.Name.DOWNLOAD_FILE, post(`/session/:sessionId/se/files`)],
322
322
  [cmd.Name.DELETE_DOWNLOADABLE_FILES, del(`/session/:sessionId/se/files`)],
323
323
 
324
+ [cmd.Name.FIRE_SESSION_EVENT, post(`/session/:sessionId/se/event`)],
325
+
324
326
  // Federated Credential Management Command
325
327
  [cmd.Name.CANCEL_DIALOG, post(`/session/:sessionId/fedcm/canceldialog`)],
326
328
  [cmd.Name.SELECT_ACCOUNT, post(`/session/:sessionId/fedcm/selectaccount`)],
package/lib/logging.js CHANGED
@@ -486,6 +486,11 @@ const logManager = new LogManager()
486
486
  if (typeof process !== 'undefined' && process.env && (process.env.SE_DEBUG || process.env.SELENIUM_VERBOSE)) {
487
487
  logManager.root_.setLevel(Level.ALL)
488
488
  logManager.root_.addHandler(consoleHandler)
489
+ if (process.env.SE_DEBUG) {
490
+ logManager.root_.warning(
491
+ 'Environment Variable `SE_DEBUG` is set; Selenium is forcing verbose logging which may override user-specified settings.',
492
+ )
493
+ }
489
494
  }
490
495
 
491
496
  /**
package/lib/webdriver.js CHANGED
@@ -1744,6 +1744,38 @@ class WebDriver {
1744
1744
 
1745
1745
  return await this.execute(new command.Command(command.Name.DELETE_DOWNLOADABLE_FILES))
1746
1746
  }
1747
+
1748
+ /**
1749
+ * Fires a custom session event to the remote server event bus.
1750
+ *
1751
+ * This allows test code to trigger server-side utilities that subscribe to the event bus.
1752
+ *
1753
+ * @param {string} eventType The type of event (e.g., "test:failed", "log:collect").
1754
+ * @param {Object=} payload Optional data to include with the event.
1755
+ * @return {!Promise<Object>} A promise that resolves to the response containing
1756
+ * success status, event type, and timestamp.
1757
+ *
1758
+ * @example
1759
+ * // Fire a simple event
1760
+ * await driver.fireSessionEvent('test:started');
1761
+ *
1762
+ * @example
1763
+ * // Fire an event with payload
1764
+ * await driver.fireSessionEvent('test:failed', {
1765
+ * testName: 'LoginTest',
1766
+ * error: 'Element not found'
1767
+ * });
1768
+ */
1769
+ async fireSessionEvent(eventType, payload = null) {
1770
+ if (!eventType || typeof eventType !== 'string') {
1771
+ throw new error.InvalidArgumentError('eventType must be a non-empty string')
1772
+ }
1773
+ const cmd = new command.Command(command.Name.FIRE_SESSION_EVENT).setParameter('eventType', eventType)
1774
+ if (payload) {
1775
+ cmd.setParameter('payload', payload)
1776
+ }
1777
+ return await this.execute(cmd)
1778
+ }
1747
1779
  }
1748
1780
 
1749
1781
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "selenium-webdriver",
3
- "version": "4.40.0",
3
+ "version": "4.41.0",
4
4
  "description": "The official WebDriver JavaScript bindings from the Selenium project",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -26,26 +26,26 @@
26
26
  "@bazel/runfiles": "^6.5.0",
27
27
  "jszip": "^3.10.1",
28
28
  "tmp": "^0.2.5",
29
- "ws": "^8.18.3"
29
+ "ws": "^8.19.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@eslint/js": "^9.39.1",
32
+ "@eslint/js": "^9.39.2",
33
33
  "clean-jsdoc-theme": "^4.3.0",
34
- "eslint": "^9.39.1",
34
+ "eslint": "^9.39.2",
35
35
  "eslint-config-prettier": "^10.1.8",
36
36
  "eslint-plugin-mocha": "^10.5.0",
37
- "eslint-plugin-n": "^17.23.1",
37
+ "eslint-plugin-n": "^17.24.0",
38
38
  "eslint-plugin-no-only-tests": "^3.3.0",
39
- "eslint-plugin-prettier": "^5.5.4",
40
- "express": "^4.21.2",
39
+ "eslint-plugin-prettier": "^5.5.5",
40
+ "express": "^4.22.1",
41
41
  "globals": "^15.15.0",
42
42
  "has-flag": "^5.0.1",
43
43
  "jsdoc": "^4.0.5",
44
44
  "mocha": "^11.7.5",
45
45
  "mocha-junit-reporter": "^2.2.1",
46
46
  "multer": "2.0.2",
47
- "prettier": "^3.6.2",
48
- "serve-index": "^1.9.1",
47
+ "prettier": "^3.8.1",
48
+ "serve-index": "^1.9.2",
49
49
  "sinon": "^19.0.5",
50
50
  "supports-color": "^10.2.2"
51
51
  },