selenium-webdriver 4.48.0 → 4.50.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.
Files changed (52) hide show
  1. package/CHANGES.md +26 -0
  2. package/bidi/generated/bluetooth.d.ts +199 -37
  3. package/bidi/generated/bluetooth.js +212 -106
  4. package/bidi/generated/browser.d.ts +81 -28
  5. package/bidi/generated/browser.js +97 -69
  6. package/bidi/generated/browsing_context.d.ts +274 -87
  7. package/bidi/generated/browsing_context.js +328 -241
  8. package/bidi/generated/common.d.ts +105 -21
  9. package/bidi/generated/common.js +64 -15
  10. package/bidi/generated/digital_credentials.d.ts +41 -0
  11. package/bidi/generated/digital_credentials.js +54 -0
  12. package/bidi/generated/emulation.d.ts +354 -58
  13. package/bidi/generated/emulation.js +262 -101
  14. package/bidi/generated/input.d.ts +63 -35
  15. package/bidi/generated/input.js +77 -51
  16. package/bidi/generated/log.d.ts +39 -18
  17. package/bidi/generated/log.js +23 -43
  18. package/bidi/generated/network.d.ts +248 -76
  19. package/bidi/generated/network.js +247 -181
  20. package/bidi/generated/permissions.d.ts +22 -4
  21. package/bidi/generated/permissions.js +31 -17
  22. package/bidi/generated/script.d.ts +166 -70
  23. package/bidi/generated/script.js +203 -116
  24. package/bidi/generated/session.d.ts +76 -36
  25. package/bidi/generated/session.js +81 -48
  26. package/bidi/generated/speculation.d.ts +15 -5
  27. package/bidi/generated/speculation.js +20 -16
  28. package/bidi/generated/storage.d.ts +41 -17
  29. package/bidi/generated/storage.js +58 -40
  30. package/bidi/generated/user_agent_client_hints.d.ts +25 -13
  31. package/bidi/generated/user_agent_client_hints.js +29 -18
  32. package/bidi/generated/webextension.d.ts +24 -10
  33. package/bidi/generated/webextension.js +39 -25
  34. package/bidi/serialization/enum.js +6 -3
  35. package/bidi/serialization/record.js +34 -29
  36. package/bin/linux-arm64/selenium-manager +0 -0
  37. package/bin/{linux → linux-x86_64}/selenium-manager +0 -0
  38. package/bin/macos/selenium-manager +0 -0
  39. package/bin/selenium-manager-THIRD-PARTY-NOTICES.txt +327 -51
  40. package/bin/selenium-manager.cdx.json +491 -491
  41. package/bin/windows/selenium-manager.exe +0 -0
  42. package/chromium.js +1 -1
  43. package/common/seleniumManager.js +2 -2
  44. package/eslint.config.js +2 -1
  45. package/example/chrome_mobile_emulation.js +1 -1
  46. package/firefox.js +7 -104
  47. package/index.js +8 -0
  48. package/lib/atoms/find-elements.js +14 -2
  49. package/package.json +10 -10
  50. package/remote/index.js +12 -3
  51. package/remote/util.js +5 -5
  52. package/testing/index.js +84 -1
@@ -17,214 +17,280 @@
17
17
  // under the License.
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.Network = void 0;
20
- exports.getNetworkInstance = getNetworkInstance;
21
- // --- Additional Types ---
22
- /** @deprecated Use {@link Network.create} instead — will be removed in a future major version. */
23
- async function getNetworkInstance(driver) {
24
- return Network.create(driver);
25
- }
20
+ require("./browser.js");
21
+ require("./browsing_context.js");
22
+ require("./common.js");
23
+ require("./script.js");
24
+ const record_js_1 = require("../serialization/record.js");
25
+ const enum_js_1 = require("../serialization/enum.js");
26
+ const union_js_1 = require("../serialization/union.js");
27
+ const domain_js_1 = require("../domain.js");
28
+ const NetworkAuthChallenge = (0, record_js_1.defineRecord)('network.AuthChallenge', [{ "name": "scheme", "wire": "scheme", "required": true, "type": { "primitive": "string" } }, { "name": "realm", "wire": "realm", "required": true, "type": { "primitive": "string" } }]);
29
+ const NetworkAuthCredentials = (0, record_js_1.defineRecord)('network.AuthCredentials', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "password" } }, { "name": "username", "wire": "username", "required": true, "type": { "primitive": "string" } }, { "name": "password", "wire": "password", "required": true, "type": { "primitive": "string" } }]);
30
+ const NetworkBaseParameters = (0, record_js_1.defineRecord)('network.BaseParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "isBlocked", "wire": "isBlocked", "required": true, "type": { "primitive": "boolean" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "redirectCount", "wire": "redirectCount", "required": true, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.RequestData" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext", "nullable": true } }, { "name": "intercepts", "wire": "intercepts", "required": false, "type": { "list": { "ref": "network.Intercept" } } }]);
31
+ const NetworkBytesValueUnion = (0, union_js_1.defineUnion)('network.BytesValue', { "by": "type", "variants": [{ "value": "string", "ref": "network.StringValue" }, { "value": "base64", "ref": "network.Base64Value" }] }, { "objectOnly": true });
32
+ const NetworkStringValue = (0, record_js_1.defineRecord)('network.StringValue', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "string" } }, { "name": "value", "wire": "value", "required": true, "type": { "primitive": "string" } }]);
33
+ const NetworkBase64Value = (0, record_js_1.defineRecord)('network.Base64Value', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "base64" } }, { "name": "value", "wire": "value", "required": true, "type": { "primitive": "string" } }]);
34
+ (0, record_js_1.defineAlias)('network.Collector', { "primitive": "string" });
35
+ const NetworkCollectorTypeEnum = (0, enum_js_1.defineEnum)('network.CollectorType', ["blob"]);
36
+ const NetworkSameSiteEnum = (0, enum_js_1.defineEnum)('network.SameSite', ["strict", "lax", "none", "default"]);
37
+ const NetworkCookie = (0, record_js_1.defineRecord)('network.Cookie', [{ "name": "name", "wire": "name", "required": true, "type": { "primitive": "string" } }, { "name": "value", "wire": "value", "required": true, "type": { "ref": "network.BytesValue" } }, { "name": "domain", "wire": "domain", "required": true, "type": { "primitive": "string" } }, { "name": "path", "wire": "path", "required": true, "type": { "primitive": "string" } }, { "name": "size", "wire": "size", "required": true, "type": { "ref": "js-uint" } }, { "name": "httpOnly", "wire": "httpOnly", "required": true, "type": { "primitive": "boolean" } }, { "name": "secure", "wire": "secure", "required": true, "type": { "primitive": "boolean" } }, { "name": "sameSite", "wire": "sameSite", "required": true, "type": { "ref": "network.SameSite" } }, { "name": "expiry", "wire": "expiry", "required": false, "type": { "ref": "js-uint" } }], { "extensible": true });
38
+ const NetworkCookieHeader = (0, record_js_1.defineRecord)('network.CookieHeader', [{ "name": "name", "wire": "name", "required": true, "type": { "primitive": "string" } }, { "name": "value", "wire": "value", "required": true, "type": { "ref": "network.BytesValue" } }]);
39
+ const NetworkDataTypeEnum = (0, enum_js_1.defineEnum)('network.DataType', ["request", "response"]);
40
+ const NetworkFetchTimingInfo = (0, record_js_1.defineRecord)('network.FetchTimingInfo', [{ "name": "timeOrigin", "wire": "timeOrigin", "required": true, "type": { "primitive": "number" } }, { "name": "requestTime", "wire": "requestTime", "required": true, "type": { "primitive": "number" } }, { "name": "redirectStart", "wire": "redirectStart", "required": true, "type": { "primitive": "number" } }, { "name": "redirectEnd", "wire": "redirectEnd", "required": true, "type": { "primitive": "number" } }, { "name": "fetchStart", "wire": "fetchStart", "required": true, "type": { "primitive": "number" } }, { "name": "dnsStart", "wire": "dnsStart", "required": true, "type": { "primitive": "number" } }, { "name": "dnsEnd", "wire": "dnsEnd", "required": true, "type": { "primitive": "number" } }, { "name": "connectStart", "wire": "connectStart", "required": true, "type": { "primitive": "number" } }, { "name": "connectEnd", "wire": "connectEnd", "required": true, "type": { "primitive": "number" } }, { "name": "tlsStart", "wire": "tlsStart", "required": true, "type": { "primitive": "number" } }, { "name": "requestStart", "wire": "requestStart", "required": true, "type": { "primitive": "number" } }, { "name": "responseStart", "wire": "responseStart", "required": true, "type": { "primitive": "number" } }, { "name": "responseEnd", "wire": "responseEnd", "required": true, "type": { "primitive": "number" } }]);
41
+ const NetworkHeader = (0, record_js_1.defineRecord)('network.Header', [{ "name": "name", "wire": "name", "required": true, "type": { "primitive": "string" } }, { "name": "value", "wire": "value", "required": true, "type": { "ref": "network.BytesValue" } }]);
42
+ const NetworkInitiator = (0, record_js_1.defineRecord)('network.Initiator', [{ "name": "columnNumber", "wire": "columnNumber", "required": false, "type": { "ref": "js-uint" } }, { "name": "lineNumber", "wire": "lineNumber", "required": false, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": false, "type": { "ref": "network.Request" } }, { "name": "stackTrace", "wire": "stackTrace", "required": false, "type": { "ref": "script.StackTrace" } }, { "name": "type", "wire": "type", "required": false, "type": { "ref": "network.InitiatorType" } }]);
43
+ (0, record_js_1.defineAlias)('network.Intercept', { "primitive": "string" });
44
+ (0, record_js_1.defineAlias)('network.Request', { "primitive": "string" });
45
+ const NetworkRequestData = (0, record_js_1.defineRecord)('network.RequestData', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "method", "wire": "method", "required": true, "type": { "primitive": "string" } }, { "name": "headers", "wire": "headers", "required": true, "type": { "list": { "ref": "network.Header" } } }, { "name": "cookies", "wire": "cookies", "required": true, "type": { "list": { "ref": "network.Cookie" } } }, { "name": "headersSize", "wire": "headersSize", "required": true, "type": { "ref": "js-uint" } }, { "name": "bodySize", "wire": "bodySize", "required": true, "type": { "ref": "js-uint", "nullable": true } }, { "name": "destination", "wire": "destination", "required": true, "type": { "primitive": "string" } }, { "name": "initiatorType", "wire": "initiatorType", "required": true, "type": { "primitive": "string", "nullable": true } }, { "name": "timings", "wire": "timings", "required": true, "type": { "ref": "network.FetchTimingInfo" } }]);
46
+ const NetworkResponseContent = (0, record_js_1.defineRecord)('network.ResponseContent', [{ "name": "size", "wire": "size", "required": true, "type": { "ref": "js-uint" } }]);
47
+ const NetworkResponseData = (0, record_js_1.defineRecord)('network.ResponseData', [{ "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "protocol", "wire": "protocol", "required": true, "type": { "primitive": "string" } }, { "name": "status", "wire": "status", "required": true, "type": { "ref": "js-uint" } }, { "name": "statusText", "wire": "statusText", "required": true, "type": { "primitive": "string" } }, { "name": "fromCache", "wire": "fromCache", "required": true, "type": { "primitive": "boolean" } }, { "name": "headers", "wire": "headers", "required": true, "type": { "list": { "ref": "network.Header" } } }, { "name": "mimeType", "wire": "mimeType", "required": true, "type": { "primitive": "string" } }, { "name": "bytesReceived", "wire": "bytesReceived", "required": true, "type": { "ref": "js-uint" } }, { "name": "headersSize", "wire": "headersSize", "required": true, "type": { "ref": "js-uint", "nullable": true } }, { "name": "bodySize", "wire": "bodySize", "required": true, "type": { "ref": "js-uint", "nullable": true } }, { "name": "content", "wire": "content", "required": true, "type": { "ref": "network.ResponseContent" } }, { "name": "authChallenges", "wire": "authChallenges", "required": false, "type": { "list": { "ref": "network.AuthChallenge" } } }]);
48
+ const NetworkSetCookieHeader = (0, record_js_1.defineRecord)('network.SetCookieHeader', [{ "name": "name", "wire": "name", "required": true, "type": { "primitive": "string" } }, { "name": "value", "wire": "value", "required": true, "type": { "ref": "network.BytesValue" } }, { "name": "domain", "wire": "domain", "required": false, "type": { "primitive": "string" } }, { "name": "httpOnly", "wire": "httpOnly", "required": false, "type": { "primitive": "boolean" } }, { "name": "expiry", "wire": "expiry", "required": false, "type": { "primitive": "string" } }, { "name": "maxAge", "wire": "maxAge", "required": false, "type": { "ref": "js-int" } }, { "name": "path", "wire": "path", "required": false, "type": { "primitive": "string" } }, { "name": "sameSite", "wire": "sameSite", "required": false, "type": { "ref": "network.SameSite" } }, { "name": "secure", "wire": "secure", "required": false, "type": { "primitive": "boolean" } }]);
49
+ const NetworkUrlPatternUnion = (0, union_js_1.defineUnion)('network.UrlPattern', { "by": "type", "variants": [{ "value": "pattern", "ref": "network.UrlPatternPattern" }, { "value": "string", "ref": "network.UrlPatternString" }] }, { "objectOnly": true });
50
+ const NetworkUrlPatternPattern = (0, record_js_1.defineRecord)('network.UrlPatternPattern', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "pattern" } }, { "name": "protocol", "wire": "protocol", "required": false, "type": { "primitive": "string" } }, { "name": "hostname", "wire": "hostname", "required": false, "type": { "primitive": "string" } }, { "name": "port", "wire": "port", "required": false, "type": { "primitive": "string" } }, { "name": "pathname", "wire": "pathname", "required": false, "type": { "primitive": "string" } }, { "name": "search", "wire": "search", "required": false, "type": { "primitive": "string" } }]);
51
+ const NetworkUrlPatternString = (0, record_js_1.defineRecord)('network.UrlPatternString', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "string" } }, { "name": "pattern", "wire": "pattern", "required": true, "type": { "primitive": "string" } }]);
52
+ const NetworkAddDataCollector = (0, record_js_1.defineRecord)('network.AddDataCollector', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.addDataCollector" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.AddDataCollectorParameters" } }]);
53
+ const NetworkAddDataCollectorParameters = (0, record_js_1.defineRecord)('network.AddDataCollectorParameters', [{ "name": "dataTypes", "wire": "dataTypes", "required": true, "type": { "list": { "ref": "network.DataType" } } }, { "name": "maxEncodedDataSize", "wire": "maxEncodedDataSize", "required": true, "type": { "ref": "js-uint" } }, { "name": "collectorType", "wire": "collectorType", "required": false, "type": { "ref": "network.CollectorType" } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
54
+ const NetworkAddDataCollectorResult = (0, record_js_1.defineRecord)('network.AddDataCollectorResult', [{ "name": "collector", "wire": "collector", "required": true, "type": { "ref": "network.Collector" } }]);
55
+ const NetworkAddIntercept = (0, record_js_1.defineRecord)('network.AddIntercept', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.addIntercept" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.AddInterceptParameters" } }]);
56
+ const NetworkAddInterceptParameters = (0, record_js_1.defineRecord)('network.AddInterceptParameters', [{ "name": "phases", "wire": "phases", "required": true, "type": { "list": { "ref": "network.InterceptPhase" } } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "urlPatterns", "wire": "urlPatterns", "required": false, "type": { "list": { "ref": "network.UrlPattern" } } }]);
57
+ const NetworkInterceptPhaseEnum = (0, enum_js_1.defineEnum)('network.InterceptPhase', ["beforeRequestSent", "responseStarted", "authRequired"]);
58
+ const NetworkAddInterceptResult = (0, record_js_1.defineRecord)('network.AddInterceptResult', [{ "name": "intercept", "wire": "intercept", "required": true, "type": { "ref": "network.Intercept" } }]);
59
+ const NetworkContinueRequest = (0, record_js_1.defineRecord)('network.ContinueRequest', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.continueRequest" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.ContinueRequestParameters" } }]);
60
+ const NetworkContinueRequestParameters = (0, record_js_1.defineRecord)('network.ContinueRequestParameters', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }, { "name": "body", "wire": "body", "required": false, "type": { "ref": "network.BytesValue" } }, { "name": "cookies", "wire": "cookies", "required": false, "type": { "list": { "ref": "network.CookieHeader" } } }, { "name": "headers", "wire": "headers", "required": false, "type": { "list": { "ref": "network.Header" } } }, { "name": "method", "wire": "method", "required": false, "type": { "primitive": "string" } }, { "name": "url", "wire": "url", "required": false, "type": { "primitive": "string" } }]);
61
+ (0, record_js_1.defineAlias)('network.ContinueRequestResult', { "ref": "EmptyResult" });
62
+ const NetworkContinueResponse = (0, record_js_1.defineRecord)('network.ContinueResponse', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.continueResponse" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.ContinueResponseParameters" } }]);
63
+ const NetworkContinueResponseParameters = (0, record_js_1.defineRecord)('network.ContinueResponseParameters', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }, { "name": "cookies", "wire": "cookies", "required": false, "type": { "list": { "ref": "network.SetCookieHeader" } } }, { "name": "credentials", "wire": "credentials", "required": false, "type": { "ref": "network.AuthCredentials" } }, { "name": "headers", "wire": "headers", "required": false, "type": { "list": { "ref": "network.Header" } } }, { "name": "reasonPhrase", "wire": "reasonPhrase", "required": false, "type": { "primitive": "string" } }, { "name": "statusCode", "wire": "statusCode", "required": false, "type": { "ref": "js-uint" } }]);
64
+ (0, record_js_1.defineAlias)('network.ContinueResponseResult', { "ref": "EmptyResult" });
65
+ const NetworkContinueWithAuth = (0, record_js_1.defineRecord)('network.ContinueWithAuth', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.continueWithAuth" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.ContinueWithAuthParameters" } }]);
66
+ const NetworkContinueWithAuthParametersUnion = (0, union_js_1.defineUnion)('network.ContinueWithAuthParameters', { "by": "action", "variants": [{ "value": "provideCredentials", "ref": "network.ContinueWithAuthParameters_Credentials" }], "default": "network.ContinueWithAuthParameters_NoCredentials" }, { "objectOnly": true });
67
+ (0, record_js_1.defineAlias)('network.ContinueWithAuthResult', { "ref": "EmptyResult" });
68
+ const NetworkDisownData = (0, record_js_1.defineRecord)('network.DisownData', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.disownData" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.DisownDataParameters" } }]);
69
+ const NetworkDisownDataParameters = (0, record_js_1.defineRecord)('network.DisownDataParameters', [{ "name": "dataType", "wire": "dataType", "required": true, "type": { "ref": "network.DataType" } }, { "name": "collector", "wire": "collector", "required": true, "type": { "ref": "network.Collector" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }]);
70
+ (0, record_js_1.defineAlias)('network.DisownDataResult', { "ref": "EmptyResult" });
71
+ const NetworkFailRequest = (0, record_js_1.defineRecord)('network.FailRequest', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.failRequest" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.FailRequestParameters" } }]);
72
+ const NetworkFailRequestParameters = (0, record_js_1.defineRecord)('network.FailRequestParameters', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }]);
73
+ (0, record_js_1.defineAlias)('network.FailRequestResult', { "ref": "EmptyResult" });
74
+ const NetworkGetData = (0, record_js_1.defineRecord)('network.GetData', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.getData" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.GetDataParameters" } }]);
75
+ const NetworkGetDataParameters = (0, record_js_1.defineRecord)('network.GetDataParameters', [{ "name": "dataType", "wire": "dataType", "required": true, "type": { "ref": "network.DataType" } }, { "name": "collector", "wire": "collector", "required": false, "type": { "ref": "network.Collector" } }, { "name": "disown", "wire": "disown", "required": false, "type": { "primitive": "boolean" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }]);
76
+ const NetworkGetDataResult = (0, record_js_1.defineRecord)('network.GetDataResult', [{ "name": "bytes", "wire": "bytes", "required": true, "type": { "ref": "network.BytesValue" } }]);
77
+ const NetworkProvideResponse = (0, record_js_1.defineRecord)('network.ProvideResponse', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.provideResponse" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.ProvideResponseParameters" } }]);
78
+ const NetworkProvideResponseParameters = (0, record_js_1.defineRecord)('network.ProvideResponseParameters', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }, { "name": "body", "wire": "body", "required": false, "type": { "ref": "network.BytesValue" } }, { "name": "cookies", "wire": "cookies", "required": false, "type": { "list": { "ref": "network.SetCookieHeader" } } }, { "name": "headers", "wire": "headers", "required": false, "type": { "list": { "ref": "network.Header" } } }, { "name": "reasonPhrase", "wire": "reasonPhrase", "required": false, "type": { "primitive": "string" } }, { "name": "statusCode", "wire": "statusCode", "required": false, "type": { "ref": "js-uint" } }]);
79
+ (0, record_js_1.defineAlias)('network.ProvideResponseResult', { "ref": "EmptyResult" });
80
+ const NetworkRemoveDataCollector = (0, record_js_1.defineRecord)('network.RemoveDataCollector', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.removeDataCollector" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.RemoveDataCollectorParameters" } }]);
81
+ const NetworkRemoveDataCollectorParameters = (0, record_js_1.defineRecord)('network.RemoveDataCollectorParameters', [{ "name": "collector", "wire": "collector", "required": true, "type": { "ref": "network.Collector" } }]);
82
+ (0, record_js_1.defineAlias)('network.RemoveDataCollectorResult', { "ref": "EmptyResult" });
83
+ const NetworkRemoveIntercept = (0, record_js_1.defineRecord)('network.RemoveIntercept', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.removeIntercept" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.RemoveInterceptParameters" } }]);
84
+ const NetworkRemoveInterceptParameters = (0, record_js_1.defineRecord)('network.RemoveInterceptParameters', [{ "name": "intercept", "wire": "intercept", "required": true, "type": { "ref": "network.Intercept" } }]);
85
+ (0, record_js_1.defineAlias)('network.RemoveInterceptResult', { "ref": "EmptyResult" });
86
+ const NetworkSetCacheBehavior = (0, record_js_1.defineRecord)('network.SetCacheBehavior', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.setCacheBehavior" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.SetCacheBehaviorParameters" } }]);
87
+ const NetworkSetCacheBehaviorParameters = (0, record_js_1.defineRecord)('network.SetCacheBehaviorParameters', [{ "name": "cacheBehavior", "wire": "cacheBehavior", "required": true, "type": { "ref": "network.SetCacheBehaviorParametersCacheBehavior" } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }]);
88
+ (0, record_js_1.defineAlias)('network.SetCacheBehaviorResult', { "ref": "EmptyResult" });
89
+ const NetworkSetExtraHeaders = (0, record_js_1.defineRecord)('network.SetExtraHeaders', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.setExtraHeaders" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.SetExtraHeadersParameters" } }]);
90
+ const NetworkSetExtraHeadersParameters = (0, record_js_1.defineRecord)('network.SetExtraHeadersParameters', [{ "name": "headers", "wire": "headers", "required": true, "type": { "list": { "ref": "network.Header" } } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
91
+ (0, record_js_1.defineAlias)('network.SetExtraHeadersResult', { "ref": "EmptyResult" });
92
+ const NetworkAuthRequired = (0, record_js_1.defineRecord)('network.AuthRequired', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.authRequired" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.AuthRequiredParameters" } }]);
93
+ const NetworkAuthRequiredParameters = (0, record_js_1.defineRecord)('network.AuthRequiredParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "isBlocked", "wire": "isBlocked", "required": true, "type": { "primitive": "boolean" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "redirectCount", "wire": "redirectCount", "required": true, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.RequestData" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext", "nullable": true } }, { "name": "intercepts", "wire": "intercepts", "required": false, "type": { "list": { "ref": "network.Intercept" } } }, { "name": "response", "wire": "response", "required": true, "type": { "ref": "network.ResponseData" } }]);
94
+ const NetworkBeforeRequestSent = (0, record_js_1.defineRecord)('network.BeforeRequestSent', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.beforeRequestSent" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.BeforeRequestSentParameters" } }]);
95
+ const NetworkBeforeRequestSentParameters = (0, record_js_1.defineRecord)('network.BeforeRequestSentParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "isBlocked", "wire": "isBlocked", "required": true, "type": { "primitive": "boolean" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "redirectCount", "wire": "redirectCount", "required": true, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.RequestData" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext", "nullable": true } }, { "name": "intercepts", "wire": "intercepts", "required": false, "type": { "list": { "ref": "network.Intercept" } } }, { "name": "initiator", "wire": "initiator", "required": false, "type": { "ref": "network.Initiator" } }]);
96
+ const NetworkFetchError = (0, record_js_1.defineRecord)('network.FetchError', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.fetchError" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.FetchErrorParameters" } }]);
97
+ const NetworkFetchErrorParameters = (0, record_js_1.defineRecord)('network.FetchErrorParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "isBlocked", "wire": "isBlocked", "required": true, "type": { "primitive": "boolean" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "redirectCount", "wire": "redirectCount", "required": true, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.RequestData" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext", "nullable": true } }, { "name": "intercepts", "wire": "intercepts", "required": false, "type": { "list": { "ref": "network.Intercept" } } }, { "name": "errorText", "wire": "errorText", "required": true, "type": { "primitive": "string" } }]);
98
+ const NetworkResponseCompleted = (0, record_js_1.defineRecord)('network.ResponseCompleted', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.responseCompleted" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.ResponseCompletedParameters" } }]);
99
+ const NetworkResponseCompletedParameters = (0, record_js_1.defineRecord)('network.ResponseCompletedParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "isBlocked", "wire": "isBlocked", "required": true, "type": { "primitive": "boolean" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "redirectCount", "wire": "redirectCount", "required": true, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.RequestData" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext", "nullable": true } }, { "name": "intercepts", "wire": "intercepts", "required": false, "type": { "list": { "ref": "network.Intercept" } } }, { "name": "response", "wire": "response", "required": true, "type": { "ref": "network.ResponseData" } }]);
100
+ const NetworkResponseStarted = (0, record_js_1.defineRecord)('network.ResponseStarted', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "network.responseStarted" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "network.ResponseStartedParameters" } }]);
101
+ const NetworkResponseStartedParameters = (0, record_js_1.defineRecord)('network.ResponseStartedParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "isBlocked", "wire": "isBlocked", "required": true, "type": { "primitive": "boolean" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "redirectCount", "wire": "redirectCount", "required": true, "type": { "ref": "js-uint" } }, { "name": "request", "wire": "request", "required": true, "type": { "ref": "network.RequestData" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext", "nullable": true } }, { "name": "intercepts", "wire": "intercepts", "required": false, "type": { "list": { "ref": "network.Intercept" } } }, { "name": "response", "wire": "response", "required": true, "type": { "ref": "network.ResponseData" } }]);
102
+ const NetworkInitiatorTypeEnum = (0, enum_js_1.defineEnum)('network.InitiatorType', ["parser", "script", "preflight", "other"]);
103
+ const NetworkContinueWithAuthNoCredentialsActionEnum = (0, enum_js_1.defineEnum)('network.ContinueWithAuthNoCredentialsAction', ["default", "cancel"]);
104
+ const NetworkSetCacheBehaviorParametersCacheBehaviorEnum = (0, enum_js_1.defineEnum)('network.SetCacheBehaviorParametersCacheBehavior', ["default", "bypass"]);
105
+ const NetworkContinueWithAuthParameters_Credentials = (0, record_js_1.defineRecord)('network.ContinueWithAuthParameters_Credentials', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }, { "name": "action", "wire": "action", "required": true, "type": { "const": "provideCredentials" } }, { "name": "credentials", "wire": "credentials", "required": true, "type": { "ref": "network.AuthCredentials" } }]);
106
+ const NetworkContinueWithAuthParameters_NoCredentials = (0, record_js_1.defineRecord)('network.ContinueWithAuthParameters_NoCredentials', [{ "name": "request", "wire": "request", "required": true, "type": { "ref": "network.Request" } }, { "name": "action", "wire": "action", "required": true, "type": { "ref": "network.ContinueWithAuthNoCredentialsAction" } }]);
26
107
  // --- Implementation ---
27
- class Network {
28
- constructor(bidi) {
29
- this.bidi = bidi;
30
- }
108
+ /**
109
+ * This is an unsupported API. No compatibility guarantees are provided.
110
+ * It tracks the W3C WebDriver BiDi specification directly. As the specification
111
+ * evolves, this API will change or be removed without prior notice.
112
+ */
113
+ class Network extends domain_js_1.Domain {
31
114
  static async create(driver) {
32
- const caps = await driver.getCapabilities();
33
- if (!caps.get('webSocketUrl')) {
34
- throw new Error('WebDriver instance must support BiDi protocol');
35
- }
36
- const bidi = await driver.getBidi();
37
- return new Network(bidi);
115
+ return new Network(await domain_js_1.Domain.connect(driver), domain_js_1.DOMAIN_TOKEN);
38
116
  }
117
+ /**
118
+ * @param {NetworkAddDataCollectorParameters} params
119
+ * @param {Array<NetworkDataType>} params.dataTypes
120
+ * @param {JsUint} params.maxEncodedDataSize
121
+ * @param {NetworkCollectorType} [params.collectorType]
122
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
123
+ * @param {Array<BrowserUserContext>} [params.userContexts]
124
+ * @returns {Promise<NetworkAddDataCollectorResult>}
125
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-addDataCollector
126
+ */
39
127
  async addDataCollector(params) {
40
- const response = await this.bidi.send({
41
- method: 'network.addDataCollector',
42
- params: params,
43
- });
44
- if (response['type'] === 'error') {
45
- throw new Error(`${response['error']}: ${response['message']}`);
46
- }
47
- return response.result;
128
+ const validatedParams = new NetworkAddDataCollectorParameters(params);
129
+ const result = await this.send('network.addDataCollector', validatedParams);
130
+ return NetworkAddDataCollectorResult.fromWire(result);
48
131
  }
132
+ /**
133
+ * @param {NetworkAddInterceptParameters} params
134
+ * @param {Array<NetworkInterceptPhase>} params.phases
135
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
136
+ * @param {Array<NetworkUrlPattern>} [params.urlPatterns]
137
+ * @returns {Promise<NetworkAddInterceptResult>}
138
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-addIntercept
139
+ */
49
140
  async addIntercept(params) {
50
- const response = await this.bidi.send({
51
- method: 'network.addIntercept',
52
- params: params,
53
- });
54
- if (response['type'] === 'error') {
55
- throw new Error(`${response['error']}: ${response['message']}`);
56
- }
57
- return response.result;
141
+ const validatedParams = new NetworkAddInterceptParameters(params);
142
+ const result = await this.send('network.addIntercept', validatedParams);
143
+ return NetworkAddInterceptResult.fromWire(result);
58
144
  }
145
+ /**
146
+ * @param {NetworkContinueRequestParameters} params
147
+ * @param {NetworkRequest} params.request
148
+ * @param {NetworkBytesValue} [params.body]
149
+ * @param {Array<NetworkCookieHeader>} [params.cookies]
150
+ * @param {Array<NetworkHeader>} [params.headers]
151
+ * @param {string} [params.method]
152
+ * @param {string} [params.url]
153
+ * @returns {Promise<void>}
154
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-continueRequest
155
+ */
59
156
  async continueRequest(params) {
60
- const response = await this.bidi.send({
61
- method: 'network.continueRequest',
62
- params: params,
63
- });
64
- if (response['type'] === 'error') {
65
- throw new Error(`${response['error']}: ${response['message']}`);
66
- }
157
+ const validatedParams = new NetworkContinueRequestParameters(params);
158
+ await this.send('network.continueRequest', validatedParams);
67
159
  }
160
+ /**
161
+ * @param {NetworkContinueResponseParameters} params
162
+ * @param {NetworkRequest} params.request
163
+ * @param {Array<NetworkSetCookieHeader>} [params.cookies]
164
+ * @param {NetworkAuthCredentials} [params.credentials]
165
+ * @param {Array<NetworkHeader>} [params.headers]
166
+ * @param {string} [params.reasonPhrase]
167
+ * @param {JsUint} [params.statusCode]
168
+ * @returns {Promise<void>}
169
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-continueResponse
170
+ */
68
171
  async continueResponse(params) {
69
- const response = await this.bidi.send({
70
- method: 'network.continueResponse',
71
- params: params,
72
- });
73
- if (response['type'] === 'error') {
74
- throw new Error(`${response['error']}: ${response['message']}`);
75
- }
172
+ const validatedParams = new NetworkContinueResponseParameters(params);
173
+ await this.send('network.continueResponse', validatedParams);
76
174
  }
77
- async continueWithAuth(paramsOrRequestId, username, password) {
78
- let params;
79
- if (typeof paramsOrRequestId === 'string') {
80
- if (username === undefined || password === undefined) {
81
- throw new Error('username and password are required when calling continueWithAuth with a request id');
82
- }
83
- params = {
84
- request: paramsOrRequestId,
85
- action: 'provideCredentials',
86
- credentials: { type: 'password', username, password },
87
- };
88
- }
89
- else {
90
- params = paramsOrRequestId;
91
- }
92
- const response = await this.bidi.send({
93
- method: 'network.continueWithAuth',
94
- params: params,
95
- });
96
- if (response['type'] === 'error') {
97
- throw new Error(`${response['error']}: ${response['message']}`);
98
- }
175
+ /**
176
+ * @param {NetworkContinueWithAuthParameters} params
177
+ * @returns {Promise<void>}
178
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-continueWithAuth
179
+ */
180
+ async continueWithAuth(params) {
181
+ const validatedParams = NetworkContinueWithAuthParametersUnion.build(params);
182
+ await this.send('network.continueWithAuth', validatedParams);
99
183
  }
184
+ /**
185
+ * @param {NetworkDisownDataParameters} params
186
+ * @param {NetworkDataType} params.dataType
187
+ * @param {NetworkCollector} params.collector
188
+ * @param {NetworkRequest} params.request
189
+ * @returns {Promise<void>}
190
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-disownData
191
+ */
100
192
  async disownData(params) {
101
- const response = await this.bidi.send({
102
- method: 'network.disownData',
103
- params: params,
104
- });
105
- if (response['type'] === 'error') {
106
- throw new Error(`${response['error']}: ${response['message']}`);
107
- }
193
+ const validatedParams = new NetworkDisownDataParameters(params);
194
+ await this.send('network.disownData', validatedParams);
108
195
  }
196
+ /**
197
+ * @param {NetworkFailRequestParameters} params
198
+ * @param {NetworkRequest} params.request
199
+ * @returns {Promise<void>}
200
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-failRequest
201
+ */
109
202
  async failRequest(params) {
110
- const response = await this.bidi.send({
111
- method: 'network.failRequest',
112
- params: params,
113
- });
114
- if (response['type'] === 'error') {
115
- throw new Error(`${response['error']}: ${response['message']}`);
116
- }
203
+ const validatedParams = new NetworkFailRequestParameters(params);
204
+ await this.send('network.failRequest', validatedParams);
117
205
  }
206
+ /**
207
+ * @param {NetworkGetDataParameters} params
208
+ * @param {NetworkDataType} params.dataType
209
+ * @param {NetworkCollector} [params.collector]
210
+ * @param {boolean} [params.disown]
211
+ * @param {NetworkRequest} params.request
212
+ * @returns {Promise<NetworkGetDataResult>}
213
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-getData
214
+ */
118
215
  async getData(params) {
119
- const response = await this.bidi.send({
120
- method: 'network.getData',
121
- params: params,
122
- });
123
- if (response['type'] === 'error') {
124
- throw new Error(`${response['error']}: ${response['message']}`);
125
- }
126
- return response.result;
216
+ const validatedParams = new NetworkGetDataParameters(params);
217
+ const result = await this.send('network.getData', validatedParams);
218
+ return NetworkGetDataResult.fromWire(result);
127
219
  }
220
+ /**
221
+ * @param {NetworkProvideResponseParameters} params
222
+ * @param {NetworkRequest} params.request
223
+ * @param {NetworkBytesValue} [params.body]
224
+ * @param {Array<NetworkSetCookieHeader>} [params.cookies]
225
+ * @param {Array<NetworkHeader>} [params.headers]
226
+ * @param {string} [params.reasonPhrase]
227
+ * @param {JsUint} [params.statusCode]
228
+ * @returns {Promise<void>}
229
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-provideResponse
230
+ */
128
231
  async provideResponse(params) {
129
- const response = await this.bidi.send({
130
- method: 'network.provideResponse',
131
- params: params,
132
- });
133
- if (response['type'] === 'error') {
134
- throw new Error(`${response['error']}: ${response['message']}`);
135
- }
232
+ const validatedParams = new NetworkProvideResponseParameters(params);
233
+ await this.send('network.provideResponse', validatedParams);
136
234
  }
235
+ /**
236
+ * @param {NetworkRemoveDataCollectorParameters} params
237
+ * @param {NetworkCollector} params.collector
238
+ * @returns {Promise<void>}
239
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-removeDataCollector
240
+ */
137
241
  async removeDataCollector(params) {
138
- const response = await this.bidi.send({
139
- method: 'network.removeDataCollector',
140
- params: params,
141
- });
142
- if (response['type'] === 'error') {
143
- throw new Error(`${response['error']}: ${response['message']}`);
144
- }
242
+ const validatedParams = new NetworkRemoveDataCollectorParameters(params);
243
+ await this.send('network.removeDataCollector', validatedParams);
145
244
  }
245
+ /**
246
+ * @param {NetworkRemoveInterceptParameters} params
247
+ * @param {NetworkIntercept} params.intercept
248
+ * @returns {Promise<void>}
249
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-removeIntercept
250
+ */
146
251
  async removeIntercept(params) {
147
- const response = await this.bidi.send({
148
- method: 'network.removeIntercept',
149
- params: params,
150
- });
151
- if (response['type'] === 'error') {
152
- throw new Error(`${response['error']}: ${response['message']}`);
153
- }
252
+ const validatedParams = new NetworkRemoveInterceptParameters(params);
253
+ await this.send('network.removeIntercept', validatedParams);
154
254
  }
255
+ /**
256
+ * @param {NetworkSetCacheBehaviorParameters} params
257
+ * @param {NetworkSetCacheBehaviorParametersCacheBehavior} params.cacheBehavior
258
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
259
+ * @returns {Promise<void>}
260
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-setCacheBehavior
261
+ */
155
262
  async setCacheBehavior(params) {
156
- const response = await this.bidi.send({
157
- method: 'network.setCacheBehavior',
158
- params: params,
159
- });
160
- if (response['type'] === 'error') {
161
- throw new Error(`${response['error']}: ${response['message']}`);
162
- }
263
+ const validatedParams = new NetworkSetCacheBehaviorParameters(params);
264
+ await this.send('network.setCacheBehavior', validatedParams);
163
265
  }
266
+ /**
267
+ * @param {NetworkSetExtraHeadersParameters} params
268
+ * @param {Array<NetworkHeader>} params.headers
269
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
270
+ * @param {Array<BrowserUserContext>} [params.userContexts]
271
+ * @returns {Promise<void>}
272
+ * @see https://w3c.github.io/webdriver-bidi/#command-network-setExtraHeaders
273
+ */
164
274
  async setExtraHeaders(params) {
165
- const response = await this.bidi.send({
166
- method: 'network.setExtraHeaders',
167
- params: params,
168
- });
169
- if (response['type'] === 'error') {
170
- throw new Error(`${response['error']}: ${response['message']}`);
171
- }
172
- }
173
- async onAuthRequired(callback) {
174
- await this.bidi.subscribe('network.authRequired');
175
- this.bidi.on('network.authRequired', (params) => {
176
- callback(params);
177
- });
178
- }
179
- async onBeforeRequestSent(callback) {
180
- await this.bidi.subscribe('network.beforeRequestSent');
181
- this.bidi.on('network.beforeRequestSent', (params) => {
182
- callback(params);
183
- });
184
- }
185
- async onFetchError(callback) {
186
- await this.bidi.subscribe('network.fetchError');
187
- this.bidi.on('network.fetchError', (params) => {
188
- callback(params);
189
- });
190
- }
191
- async onResponseCompleted(callback) {
192
- await this.bidi.subscribe('network.responseCompleted');
193
- this.bidi.on('network.responseCompleted', (params) => {
194
- callback(params);
195
- });
196
- }
197
- async onResponseStarted(callback) {
198
- await this.bidi.subscribe('network.responseStarted');
199
- this.bidi.on('network.responseStarted', (params) => {
200
- callback(params);
201
- });
202
- }
203
- async cancelAuth(requestId) {
204
- await this.continueWithAuth({ request: requestId, action: 'cancel' });
205
- }
206
- async continueWithAuthNoCredentials(requestId) {
207
- await this.continueWithAuth({ request: requestId, action: 'default' });
208
- }
209
- /** @deprecated Use {@link onBeforeRequestSent} instead — will be removed in a future major version. */
210
- async beforeRequestSent(callback) {
211
- await this.onBeforeRequestSent(callback);
212
- }
213
- /** @deprecated Use {@link onAuthRequired} instead — will be removed in a future major version. */
214
- async authRequired(callback) {
215
- await this.onAuthRequired(callback);
216
- }
217
- /** @deprecated Use {@link onFetchError} instead — will be removed in a future major version. */
218
- async fetchError(callback) {
219
- await this.onFetchError(callback);
220
- }
221
- /** @deprecated Use {@link onResponseCompleted} instead — will be removed in a future major version. */
222
- async responseCompleted(callback) {
223
- await this.onResponseCompleted(callback);
224
- }
225
- /** @deprecated Use {@link onResponseStarted} instead — will be removed in a future major version. */
226
- async responseStarted(callback) {
227
- await this.onResponseStarted(callback);
275
+ const validatedParams = new NetworkSetExtraHeadersParameters(params);
276
+ await this.send('network.setExtraHeaders', validatedParams);
228
277
  }
229
278
  }
230
279
  exports.Network = Network;
280
+ /** @see https://w3c.github.io/webdriver-bidi/#event-network-authRequired */
281
+ Network.AUTH_REQUIRED = (0, domain_js_1.event)('network.authRequired', NetworkAuthRequiredParameters);
282
+ /** @see https://w3c.github.io/webdriver-bidi/#event-network-beforeRequestSent */
283
+ Network.BEFORE_REQUEST_SENT = (0, domain_js_1.event)('network.beforeRequestSent', NetworkBeforeRequestSentParameters);
284
+ /** @see https://w3c.github.io/webdriver-bidi/#event-network-fetchError */
285
+ Network.FETCH_ERROR = (0, domain_js_1.event)('network.fetchError', NetworkFetchErrorParameters);
286
+ /** @see https://w3c.github.io/webdriver-bidi/#event-network-responseCompleted */
287
+ Network.RESPONSE_COMPLETED = (0, domain_js_1.event)('network.responseCompleted', NetworkResponseCompletedParameters);
288
+ /** @see https://w3c.github.io/webdriver-bidi/#event-network-responseStarted */
289
+ Network.RESPONSE_STARTED = (0, domain_js_1.event)('network.responseStarted', NetworkResponseStartedParameters);
290
+ Network.CollectorType = Object.freeze({ BLOB: "blob" });
291
+ Network.SameSite = Object.freeze({ STRICT: "strict", LAX: "lax", NONE: "none", DEFAULT: "default" });
292
+ Network.DataType = Object.freeze({ REQUEST: "request", RESPONSE: "response" });
293
+ Network.InterceptPhase = Object.freeze({ BEFORE_REQUEST_SENT: "beforeRequestSent", RESPONSE_STARTED: "responseStarted", AUTH_REQUIRED: "authRequired" });
294
+ Network.InitiatorType = Object.freeze({ PARSER: "parser", SCRIPT: "script", PREFLIGHT: "preflight", OTHER: "other" });
295
+ Network.ContinueWithAuthNoCredentialsAction = Object.freeze({ DEFAULT: "default", CANCEL: "cancel" });
296
+ Network.SetCacheBehaviorParametersCacheBehavior = Object.freeze({ DEFAULT: "default", BYPASS: "bypass" });
@@ -1,4 +1,4 @@
1
- export type PermissionsCommand = PermissionsSetPermission;
1
+ import { Domain } from '../domain.js';
2
2
  export interface PermissionsPermissionDescriptor {
3
3
  name: string;
4
4
  }
@@ -14,9 +14,27 @@ export interface PermissionsSetPermissionParameters {
14
14
  embeddedOrigin?: string;
15
15
  userContext?: string;
16
16
  }
17
- export declare class Permissions {
18
- private readonly bidi;
19
- private constructor();
17
+ /**
18
+ * This is an unsupported API. No compatibility guarantees are provided.
19
+ * It tracks the W3C WebDriver BiDi specification directly. As the specification
20
+ * evolves, this API will change or be removed without prior notice.
21
+ */
22
+ export declare class Permissions extends Domain {
23
+ static readonly PermissionState: Readonly<{
24
+ readonly GRANTED: "granted";
25
+ readonly DENIED: "denied";
26
+ readonly PROMPT: "prompt";
27
+ }>;
20
28
  static create(driver: unknown): Promise<Permissions>;
29
+ /**
30
+ * @param {PermissionsSetPermissionParameters} params
31
+ * @param {PermissionsPermissionDescriptor} params.descriptor
32
+ * @param {PermissionsPermissionState} params.state
33
+ * @param {string} params.origin
34
+ * @param {string} [params.embeddedOrigin]
35
+ * @param {string} [params.userContext]
36
+ * @returns {Promise<void>}
37
+ * @see https://w3c.github.io/webdriver-bidi/#command-permissions-setPermission
38
+ */
21
39
  setPermission(params: PermissionsSetPermissionParameters): Promise<void>;
22
40
  }