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,135 +17,296 @@
17
17
  // under the License.
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.Emulation = void 0;
20
+ require("./browser.js");
21
+ require("./browsing_context.js");
22
+ require("./common.js");
23
+ const record_js_1 = require("../serialization/record.js");
24
+ const enum_js_1 = require("../serialization/enum.js");
25
+ const union_js_1 = require("../serialization/union.js");
26
+ const domain_js_1 = require("../domain.js");
27
+ const EmulationSetForcedColorsModeThemeOverride = (0, record_js_1.defineRecord)('emulation.SetForcedColorsModeThemeOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setForcedColorsModeThemeOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetForcedColorsModeThemeOverrideParameters" } }]);
28
+ const EmulationSetForcedColorsModeThemeOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetForcedColorsModeThemeOverrideParameters', [{ "name": "theme", "wire": "theme", "required": true, "type": { "ref": "emulation.ForcedColorsModeTheme", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
29
+ const EmulationForcedColorsModeThemeEnum = (0, enum_js_1.defineEnum)('emulation.ForcedColorsModeTheme', ["light", "dark"]);
30
+ (0, record_js_1.defineAlias)('emulation.SetForcedColorsModeThemeOverrideResult', { "ref": "EmptyResult" });
31
+ const EmulationSetGeolocationOverride = (0, record_js_1.defineRecord)('emulation.SetGeolocationOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setGeolocationOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetGeolocationOverrideParameters" } }]);
32
+ const EmulationSetGeolocationOverrideParametersUnion = (0, union_js_1.defineUnion)('emulation.SetGeolocationOverrideParameters', { "ordered": [{ "ref": "emulation.SetGeolocationOverrideParameters_Coordinates", "requires": ["coordinates"] }, { "ref": "emulation.SetGeolocationOverrideParameters_Error", "requires": ["error"] }] }, { "objectOnly": true });
33
+ const EmulationGeolocationCoordinates = (0, record_js_1.defineRecord)('emulation.GeolocationCoordinates', [{ "name": "latitude", "wire": "latitude", "required": true, "type": { "primitive": "number" } }, { "name": "longitude", "wire": "longitude", "required": true, "type": { "primitive": "number" } }, { "name": "accuracy", "wire": "accuracy", "required": false, "type": { "primitive": "number" } }, { "name": "altitude", "wire": "altitude", "required": false, "type": { "primitive": "number", "nullable": true } }, { "name": "altitudeAccuracy", "wire": "altitudeAccuracy", "required": false, "type": { "primitive": "number", "nullable": true } }, { "name": "heading", "wire": "heading", "required": false, "type": { "primitive": "number", "nullable": true } }, { "name": "speed", "wire": "speed", "required": false, "type": { "primitive": "number", "nullable": true } }]);
34
+ const EmulationGeolocationPositionError = (0, record_js_1.defineRecord)('emulation.GeolocationPositionError', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "positionUnavailable" } }]);
35
+ (0, record_js_1.defineAlias)('emulation.SetGeolocationOverrideResult', { "ref": "EmptyResult" });
36
+ const EmulationSetLocaleOverride = (0, record_js_1.defineRecord)('emulation.SetLocaleOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setLocaleOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetLocaleOverrideParameters" } }]);
37
+ const EmulationSetLocaleOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetLocaleOverrideParameters', [{ "name": "locale", "wire": "locale", "required": true, "type": { "primitive": "string", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
38
+ (0, record_js_1.defineAlias)('emulation.SetLocaleOverrideResult', { "ref": "EmptyResult" });
39
+ const EmulationSetMediaFeaturesOverride = (0, record_js_1.defineRecord)('emulation.SetMediaFeaturesOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setMediaFeaturesOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetMediaFeaturesOverrideParameters" } }]);
40
+ const EmulationSetMediaFeaturesOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetMediaFeaturesOverrideParameters', [{ "name": "features", "wire": "features", "required": true, "type": { "ref": "emulation.MediaFeatures", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
41
+ const EmulationMediaFeatures = (0, record_js_1.defineRecord)('emulation.MediaFeatures', [{ "name": "anyHover", "wire": "any-hover", "required": false, "type": { "ref": "emulation.MediaFeaturesAnyHover", "nullable": true } }, { "name": "anyPointer", "wire": "any-pointer", "required": false, "type": { "ref": "emulation.MediaFeaturesAnyPointer", "nullable": true } }, { "name": "color", "wire": "color", "required": false, "type": { "ref": "js-uint", "nullable": true } }, { "name": "colorGamut", "wire": "color-gamut", "required": false, "type": { "ref": "emulation.MediaFeaturesColorGamut", "nullable": true } }, { "name": "colorIndex", "wire": "color-index", "required": false, "type": { "ref": "js-uint", "nullable": true } }, { "name": "displayMode", "wire": "display-mode", "required": false, "type": { "ref": "emulation.MediaFeaturesDisplayMode", "nullable": true } }, { "name": "dynamicRange", "wire": "dynamic-range", "required": false, "type": { "ref": "emulation.MediaFeaturesDynamicRange", "nullable": true } }, { "name": "environmentBlending", "wire": "environment-blending", "required": false, "type": { "ref": "emulation.MediaFeaturesEnvironmentBlending", "nullable": true } }, { "name": "forcedColors", "wire": "forced-colors", "required": false, "type": { "ref": "emulation.MediaFeaturesForcedColors", "nullable": true } }, { "name": "grid", "wire": "grid", "required": false, "type": { "ref": "emulation.MediaFeaturesGrid", "nullable": true } }, { "name": "horizontalViewportSegments", "wire": "horizontal-viewport-segments", "required": false, "type": { "ref": "js-uint", "nullable": true } }, { "name": "hover", "wire": "hover", "required": false, "type": { "ref": "emulation.MediaFeaturesHover", "nullable": true } }, { "name": "invertedColors", "wire": "inverted-colors", "required": false, "type": { "ref": "emulation.MediaFeaturesInvertedColors", "nullable": true } }, { "name": "monochrome", "wire": "monochrome", "required": false, "type": { "ref": "js-uint", "nullable": true } }, { "name": "navControls", "wire": "nav-controls", "required": false, "type": { "ref": "emulation.MediaFeaturesNavControls", "nullable": true } }, { "name": "overflowBlock", "wire": "overflow-block", "required": false, "type": { "ref": "emulation.MediaFeaturesOverflowBlock", "nullable": true } }, { "name": "overflowInline", "wire": "overflow-inline", "required": false, "type": { "ref": "emulation.MediaFeaturesOverflowInline", "nullable": true } }, { "name": "pointer", "wire": "pointer", "required": false, "type": { "ref": "emulation.MediaFeaturesPointer", "nullable": true } }, { "name": "prefersColorScheme", "wire": "prefers-color-scheme", "required": false, "type": { "ref": "emulation.MediaFeaturesPrefersColorScheme", "nullable": true } }, { "name": "prefersContrast", "wire": "prefers-contrast", "required": false, "type": { "ref": "emulation.MediaFeaturesPrefersContrast", "nullable": true } }, { "name": "prefersReducedData", "wire": "prefers-reduced-data", "required": false, "type": { "ref": "emulation.MediaFeaturesPrefersReducedData", "nullable": true } }, { "name": "prefersReducedMotion", "wire": "prefers-reduced-motion", "required": false, "type": { "ref": "emulation.MediaFeaturesPrefersReducedMotion", "nullable": true } }, { "name": "prefersReducedTransparency", "wire": "prefers-reduced-transparency", "required": false, "type": { "ref": "emulation.MediaFeaturesPrefersReducedTransparency", "nullable": true } }, { "name": "scan", "wire": "scan", "required": false, "type": { "ref": "emulation.MediaFeaturesScan", "nullable": true } }, { "name": "scripting", "wire": "scripting", "required": false, "type": { "ref": "emulation.MediaFeaturesScripting", "nullable": true } }, { "name": "update", "wire": "update", "required": false, "type": { "ref": "emulation.MediaFeaturesUpdate", "nullable": true } }, { "name": "verticalViewportSegments", "wire": "vertical-viewport-segments", "required": false, "type": { "ref": "js-uint", "nullable": true } }, { "name": "videoColorGamut", "wire": "video-color-gamut", "required": false, "type": { "ref": "emulation.MediaFeaturesVideoColorGamut", "nullable": true } }, { "name": "videoDynamicRange", "wire": "video-dynamic-range", "required": false, "type": { "ref": "emulation.MediaFeaturesVideoDynamicRange", "nullable": true } }]);
42
+ (0, record_js_1.defineAlias)('emulation.SetMediaFeaturesOverrideResult', { "ref": "EmptyResult" });
43
+ const EmulationSetNetworkConditions = (0, record_js_1.defineRecord)('emulation.SetNetworkConditions', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setNetworkConditions" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetNetworkConditionsParameters" } }]);
44
+ const EmulationSetNetworkConditionsParameters = (0, record_js_1.defineRecord)('emulation.SetNetworkConditionsParameters', [{ "name": "networkConditions", "wire": "networkConditions", "required": true, "type": { "ref": "emulation.NetworkConditions", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
45
+ (0, record_js_1.defineAlias)('emulation.NetworkConditions', { "ref": "emulation.NetworkConditionsOffline" });
46
+ const EmulationNetworkConditionsOffline = (0, record_js_1.defineRecord)('emulation.NetworkConditionsOffline', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "offline" } }]);
47
+ (0, record_js_1.defineAlias)('emulation.SetNetworkConditionsResult', { "ref": "EmptyResult" });
48
+ const EmulationSetScreenSettingsOverride = (0, record_js_1.defineRecord)('emulation.SetScreenSettingsOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setScreenSettingsOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetScreenSettingsOverrideParameters" } }]);
49
+ const EmulationScreenArea = (0, record_js_1.defineRecord)('emulation.ScreenArea', [{ "name": "width", "wire": "width", "required": true, "type": { "ref": "js-uint" } }, { "name": "height", "wire": "height", "required": true, "type": { "ref": "js-uint" } }]);
50
+ const EmulationSetScreenSettingsOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetScreenSettingsOverrideParameters', [{ "name": "screenArea", "wire": "screenArea", "required": true, "type": { "ref": "emulation.ScreenArea", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
51
+ (0, record_js_1.defineAlias)('emulation.SetScreenSettingsOverrideResult', { "ref": "EmptyResult" });
52
+ const EmulationSetScreenOrientationOverride = (0, record_js_1.defineRecord)('emulation.SetScreenOrientationOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setScreenOrientationOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetScreenOrientationOverrideParameters" } }]);
53
+ const EmulationScreenOrientationNaturalEnum = (0, enum_js_1.defineEnum)('emulation.ScreenOrientationNatural', ["portrait", "landscape"]);
54
+ const EmulationScreenOrientationTypeEnum = (0, enum_js_1.defineEnum)('emulation.ScreenOrientationType', ["portrait-primary", "portrait-secondary", "landscape-primary", "landscape-secondary"]);
55
+ const EmulationScreenOrientation = (0, record_js_1.defineRecord)('emulation.ScreenOrientation', [{ "name": "natural", "wire": "natural", "required": true, "type": { "ref": "emulation.ScreenOrientationNatural" } }, { "name": "type", "wire": "type", "required": true, "type": { "ref": "emulation.ScreenOrientationType" } }]);
56
+ const EmulationSetScreenOrientationOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetScreenOrientationOverrideParameters', [{ "name": "screenOrientation", "wire": "screenOrientation", "required": true, "type": { "ref": "emulation.ScreenOrientation", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
57
+ (0, record_js_1.defineAlias)('emulation.SetScreenOrientationOverrideResult', { "ref": "EmptyResult" });
58
+ const EmulationSetUserAgentOverride = (0, record_js_1.defineRecord)('emulation.SetUserAgentOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setUserAgentOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetUserAgentOverrideParameters" } }]);
59
+ const EmulationSetUserAgentOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetUserAgentOverrideParameters', [{ "name": "userAgent", "wire": "userAgent", "required": true, "type": { "primitive": "string", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
60
+ (0, record_js_1.defineAlias)('emulation.SetUserAgentOverrideResult', { "ref": "EmptyResult" });
61
+ const EmulationSetViewportMetaOverride = (0, record_js_1.defineRecord)('emulation.SetViewportMetaOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setViewportMetaOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetViewportMetaOverrideParameters" } }]);
62
+ const EmulationSetViewportMetaOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetViewportMetaOverrideParameters', [{ "name": "viewportMeta", "wire": "viewportMeta", "required": true, "type": { "const": true, "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
63
+ (0, record_js_1.defineAlias)('emulation.SetViewportMetaOverrideResult', { "ref": "EmptyResult" });
64
+ const EmulationSetScriptingEnabled = (0, record_js_1.defineRecord)('emulation.SetScriptingEnabled', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setScriptingEnabled" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetScriptingEnabledParameters" } }]);
65
+ const EmulationSetScriptingEnabledParameters = (0, record_js_1.defineRecord)('emulation.SetScriptingEnabledParameters', [{ "name": "enabled", "wire": "enabled", "required": true, "type": { "const": false, "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
66
+ (0, record_js_1.defineAlias)('emulation.SetScriptingEnabledResult', { "ref": "EmptyResult" });
67
+ const EmulationSetScrollbarTypeOverride = (0, record_js_1.defineRecord)('emulation.SetScrollbarTypeOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setScrollbarTypeOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetScrollbarTypeOverrideParameters" } }]);
68
+ const EmulationSetScrollbarTypeOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetScrollbarTypeOverrideParameters', [{ "name": "scrollbarType", "wire": "scrollbarType", "required": true, "type": { "ref": "emulation.SetScrollbarTypeOverrideParametersScrollbarType", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
69
+ (0, record_js_1.defineAlias)('emulation.SetScrollbarTypeOverrideResult', { "ref": "EmptyResult" });
70
+ const EmulationSetTextLayoutModeOverride = (0, record_js_1.defineRecord)('emulation.SetTextLayoutModeOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setTextLayoutModeOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetTextLayoutModeOverrideParameters" } }]);
71
+ const EmulationSetTextLayoutModeOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetTextLayoutModeOverrideParameters', [{ "name": "textLayoutMode", "wire": "textLayoutMode", "required": true, "type": { "ref": "emulation.TextLayoutMode", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
72
+ const EmulationTextLayoutModeEnum = (0, enum_js_1.defineEnum)('emulation.TextLayoutMode', ["mobile"]);
73
+ (0, record_js_1.defineAlias)('emulation.SetTextLayoutModeOverrideResult', { "ref": "EmptyResult" });
74
+ const EmulationSetTimezoneOverride = (0, record_js_1.defineRecord)('emulation.SetTimezoneOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setTimezoneOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetTimezoneOverrideParameters" } }]);
75
+ const EmulationSetTimezoneOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetTimezoneOverrideParameters', [{ "name": "timezone", "wire": "timezone", "required": true, "type": { "primitive": "string", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
76
+ (0, record_js_1.defineAlias)('emulation.SetTimezoneOverrideResult', { "ref": "EmptyResult" });
77
+ const EmulationSetTouchOverride = (0, record_js_1.defineRecord)('emulation.SetTouchOverride', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "emulation.setTouchOverride" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "emulation.SetTouchOverrideParameters" } }]);
78
+ const EmulationSetTouchOverrideParameters = (0, record_js_1.defineRecord)('emulation.SetTouchOverrideParameters', [{ "name": "maxTouchPoints", "wire": "maxTouchPoints", "required": true, "type": { "ref": "js-uint", "nullable": true } }, { "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
79
+ (0, record_js_1.defineAlias)('emulation.SetTouchOverrideResult', { "ref": "EmptyResult" });
80
+ const EmulationMediaFeaturesAnyHoverEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesAnyHover', ["none", "hover"]);
81
+ const EmulationMediaFeaturesAnyPointerEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesAnyPointer', ["none", "coarse", "fine"]);
82
+ const EmulationMediaFeaturesColorGamutEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesColorGamut', ["srgb", "p3", "rec2020"]);
83
+ const EmulationMediaFeaturesDisplayModeEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesDisplayMode', ["fullscreen", "standalone", "minimal-ui", "browser", "picture-in-picture"]);
84
+ const EmulationMediaFeaturesDynamicRangeEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesDynamicRange', ["standard", "high"]);
85
+ const EmulationMediaFeaturesEnvironmentBlendingEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesEnvironmentBlending', ["opaque", "additive", "subtractive"]);
86
+ const EmulationMediaFeaturesForcedColorsEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesForcedColors', ["none", "active"]);
87
+ const EmulationMediaFeaturesGridEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesGrid', [0, 1]);
88
+ const EmulationMediaFeaturesHoverEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesHover', ["none", "hover"]);
89
+ const EmulationMediaFeaturesInvertedColorsEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesInvertedColors', ["none", "inverted"]);
90
+ const EmulationMediaFeaturesNavControlsEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesNavControls', ["none", "back"]);
91
+ const EmulationMediaFeaturesOverflowBlockEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesOverflowBlock', ["none", "scroll", "optional-paged", "paged"]);
92
+ const EmulationMediaFeaturesOverflowInlineEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesOverflowInline', ["none", "scroll"]);
93
+ const EmulationMediaFeaturesPointerEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesPointer', ["none", "coarse", "fine"]);
94
+ const EmulationMediaFeaturesPrefersColorSchemeEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesPrefersColorScheme', ["light", "dark"]);
95
+ const EmulationMediaFeaturesPrefersContrastEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesPrefersContrast', ["no-preference", "more", "less", "custom"]);
96
+ const EmulationMediaFeaturesPrefersReducedDataEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesPrefersReducedData', ["no-preference", "reduce"]);
97
+ const EmulationMediaFeaturesPrefersReducedMotionEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesPrefersReducedMotion', ["no-preference", "reduce"]);
98
+ const EmulationMediaFeaturesPrefersReducedTransparencyEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesPrefersReducedTransparency', ["no-preference", "reduce"]);
99
+ const EmulationMediaFeaturesScanEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesScan', ["interlace", "progressive"]);
100
+ const EmulationMediaFeaturesScriptingEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesScripting', ["none", "initial-only", "enabled"]);
101
+ const EmulationMediaFeaturesUpdateEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesUpdate', ["none", "slow", "fast"]);
102
+ const EmulationMediaFeaturesVideoColorGamutEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesVideoColorGamut', ["srgb", "p3", "rec2020"]);
103
+ const EmulationMediaFeaturesVideoDynamicRangeEnum = (0, enum_js_1.defineEnum)('emulation.MediaFeaturesVideoDynamicRange', ["standard", "high"]);
104
+ const EmulationSetScrollbarTypeOverrideParametersScrollbarTypeEnum = (0, enum_js_1.defineEnum)('emulation.SetScrollbarTypeOverrideParametersScrollbarType', ["classic", "overlay"]);
105
+ const EmulationSetGeolocationOverrideParameters_Coordinates = (0, record_js_1.defineRecord)('emulation.SetGeolocationOverrideParameters_Coordinates', [{ "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }, { "name": "coordinates", "wire": "coordinates", "required": true, "type": { "ref": "emulation.GeolocationCoordinates", "nullable": true } }]);
106
+ const EmulationSetGeolocationOverrideParameters_Error = (0, record_js_1.defineRecord)('emulation.SetGeolocationOverrideParameters_Error', [{ "name": "contexts", "wire": "contexts", "required": false, "type": { "list": { "ref": "browsingContext.BrowsingContext" } } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }, { "name": "error", "wire": "error", "required": true, "type": { "ref": "emulation.GeolocationPositionError" } }]);
20
107
  // --- Implementation ---
21
- class Emulation {
22
- constructor(bidi) {
23
- this.bidi = bidi;
24
- }
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 Emulation extends domain_js_1.Domain {
25
114
  static async create(driver) {
26
- const caps = await driver.getCapabilities();
27
- if (!caps.get('webSocketUrl')) {
28
- throw new Error('WebDriver instance must support BiDi protocol');
29
- }
30
- const bidi = await driver.getBidi();
31
- return new Emulation(bidi);
115
+ return new Emulation(await domain_js_1.Domain.connect(driver), domain_js_1.DOMAIN_TOKEN);
32
116
  }
117
+ /**
118
+ * @param {EmulationSetForcedColorsModeThemeOverrideParameters} params
119
+ * @param {EmulationForcedColorsModeTheme | null} params.theme
120
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
121
+ * @param {Array<BrowserUserContext>} [params.userContexts]
122
+ * @returns {Promise<void>}
123
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setForcedColorsModeThemeOverride
124
+ */
33
125
  async setForcedColorsModeThemeOverride(params) {
34
- const response = await this.bidi.send({
35
- method: 'emulation.setForcedColorsModeThemeOverride',
36
- params: params,
37
- });
38
- if (response['type'] === 'error') {
39
- throw new Error(`${response['error']}: ${response['message']}`);
40
- }
126
+ const validatedParams = new EmulationSetForcedColorsModeThemeOverrideParameters(params);
127
+ await this.send('emulation.setForcedColorsModeThemeOverride', validatedParams);
41
128
  }
129
+ /**
130
+ * @param {EmulationSetGeolocationOverrideParameters} params
131
+ * @returns {Promise<void>}
132
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setGeolocationOverride
133
+ */
42
134
  async setGeolocationOverride(params) {
43
- const response = await this.bidi.send({
44
- method: 'emulation.setGeolocationOverride',
45
- params: params,
46
- });
47
- if (response['type'] === 'error') {
48
- throw new Error(`${response['error']}: ${response['message']}`);
49
- }
135
+ const validatedParams = EmulationSetGeolocationOverrideParametersUnion.build(params);
136
+ await this.send('emulation.setGeolocationOverride', validatedParams);
50
137
  }
138
+ /**
139
+ * @param {EmulationSetLocaleOverrideParameters} params
140
+ * @param {string | null} params.locale
141
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
142
+ * @param {Array<BrowserUserContext>} [params.userContexts]
143
+ * @returns {Promise<void>}
144
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setLocaleOverride
145
+ */
51
146
  async setLocaleOverride(params) {
52
- const response = await this.bidi.send({
53
- method: 'emulation.setLocaleOverride',
54
- params: params,
55
- });
56
- if (response['type'] === 'error') {
57
- throw new Error(`${response['error']}: ${response['message']}`);
58
- }
147
+ const validatedParams = new EmulationSetLocaleOverrideParameters(params);
148
+ await this.send('emulation.setLocaleOverride', validatedParams);
59
149
  }
150
+ /**
151
+ * @param {EmulationSetMediaFeaturesOverrideParameters} params
152
+ * @param {EmulationMediaFeatures | null} params.features
153
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
154
+ * @param {Array<BrowserUserContext>} [params.userContexts]
155
+ * @returns {Promise<void>}
156
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setMediaFeaturesOverride
157
+ */
60
158
  async setMediaFeaturesOverride(params) {
61
- const response = await this.bidi.send({
62
- method: 'emulation.setMediaFeaturesOverride',
63
- params: params,
64
- });
65
- if (response['type'] === 'error') {
66
- throw new Error(`${response['error']}: ${response['message']}`);
67
- }
159
+ const validatedParams = new EmulationSetMediaFeaturesOverrideParameters(params);
160
+ await this.send('emulation.setMediaFeaturesOverride', validatedParams);
68
161
  }
162
+ /**
163
+ * @param {EmulationSetNetworkConditionsParameters} params
164
+ * @param {EmulationNetworkConditions | null} params.networkConditions
165
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
166
+ * @param {Array<BrowserUserContext>} [params.userContexts]
167
+ * @returns {Promise<void>}
168
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setNetworkConditions
169
+ */
69
170
  async setNetworkConditions(params) {
70
- const response = await this.bidi.send({
71
- method: 'emulation.setNetworkConditions',
72
- params: params,
73
- });
74
- if (response['type'] === 'error') {
75
- throw new Error(`${response['error']}: ${response['message']}`);
76
- }
171
+ const validatedParams = new EmulationSetNetworkConditionsParameters(params);
172
+ await this.send('emulation.setNetworkConditions', validatedParams);
77
173
  }
174
+ /**
175
+ * @param {EmulationSetScreenOrientationOverrideParameters} params
176
+ * @param {EmulationScreenOrientation | null} params.screenOrientation
177
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
178
+ * @param {Array<BrowserUserContext>} [params.userContexts]
179
+ * @returns {Promise<void>}
180
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScreenOrientationOverride
181
+ */
78
182
  async setScreenOrientationOverride(params) {
79
- const response = await this.bidi.send({
80
- method: 'emulation.setScreenOrientationOverride',
81
- params: params,
82
- });
83
- if (response['type'] === 'error') {
84
- throw new Error(`${response['error']}: ${response['message']}`);
85
- }
183
+ const validatedParams = new EmulationSetScreenOrientationOverrideParameters(params);
184
+ await this.send('emulation.setScreenOrientationOverride', validatedParams);
86
185
  }
186
+ /**
187
+ * @param {EmulationSetScreenSettingsOverrideParameters} params
188
+ * @param {EmulationScreenArea | null} params.screenArea
189
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
190
+ * @param {Array<BrowserUserContext>} [params.userContexts]
191
+ * @returns {Promise<void>}
192
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScreenSettingsOverride
193
+ */
87
194
  async setScreenSettingsOverride(params) {
88
- const response = await this.bidi.send({
89
- method: 'emulation.setScreenSettingsOverride',
90
- params: params,
91
- });
92
- if (response['type'] === 'error') {
93
- throw new Error(`${response['error']}: ${response['message']}`);
94
- }
195
+ const validatedParams = new EmulationSetScreenSettingsOverrideParameters(params);
196
+ await this.send('emulation.setScreenSettingsOverride', validatedParams);
95
197
  }
198
+ /**
199
+ * @param {EmulationSetScriptingEnabledParameters} params
200
+ * @param {false | null} params.enabled
201
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
202
+ * @param {Array<BrowserUserContext>} [params.userContexts]
203
+ * @returns {Promise<void>}
204
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScriptingEnabled
205
+ */
96
206
  async setScriptingEnabled(params) {
97
- const response = await this.bidi.send({
98
- method: 'emulation.setScriptingEnabled',
99
- params: params,
100
- });
101
- if (response['type'] === 'error') {
102
- throw new Error(`${response['error']}: ${response['message']}`);
103
- }
207
+ const validatedParams = new EmulationSetScriptingEnabledParameters(params);
208
+ await this.send('emulation.setScriptingEnabled', validatedParams);
104
209
  }
210
+ /**
211
+ * @param {EmulationSetScrollbarTypeOverrideParameters} params
212
+ * @param {EmulationSetScrollbarTypeOverrideParametersScrollbarType | null} params.scrollbarType
213
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
214
+ * @param {Array<BrowserUserContext>} [params.userContexts]
215
+ * @returns {Promise<void>}
216
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setScrollbarTypeOverride
217
+ */
105
218
  async setScrollbarTypeOverride(params) {
106
- const response = await this.bidi.send({
107
- method: 'emulation.setScrollbarTypeOverride',
108
- params: params,
109
- });
110
- if (response['type'] === 'error') {
111
- throw new Error(`${response['error']}: ${response['message']}`);
112
- }
219
+ const validatedParams = new EmulationSetScrollbarTypeOverrideParameters(params);
220
+ await this.send('emulation.setScrollbarTypeOverride', validatedParams);
221
+ }
222
+ /**
223
+ * @param {EmulationSetTextLayoutModeOverrideParameters} params
224
+ * @param {EmulationTextLayoutMode | null} params.textLayoutMode
225
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
226
+ * @param {Array<BrowserUserContext>} [params.userContexts]
227
+ * @returns {Promise<void>}
228
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setTextLayoutModeOverride
229
+ */
230
+ async setTextLayoutModeOverride(params) {
231
+ const validatedParams = new EmulationSetTextLayoutModeOverrideParameters(params);
232
+ await this.send('emulation.setTextLayoutModeOverride', validatedParams);
113
233
  }
234
+ /**
235
+ * @param {EmulationSetTimezoneOverrideParameters} params
236
+ * @param {string | null} params.timezone
237
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
238
+ * @param {Array<BrowserUserContext>} [params.userContexts]
239
+ * @returns {Promise<void>}
240
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setTimezoneOverride
241
+ */
114
242
  async setTimezoneOverride(params) {
115
- const response = await this.bidi.send({
116
- method: 'emulation.setTimezoneOverride',
117
- params: params,
118
- });
119
- if (response['type'] === 'error') {
120
- throw new Error(`${response['error']}: ${response['message']}`);
121
- }
243
+ const validatedParams = new EmulationSetTimezoneOverrideParameters(params);
244
+ await this.send('emulation.setTimezoneOverride', validatedParams);
122
245
  }
246
+ /**
247
+ * @param {EmulationSetTouchOverrideParameters} params
248
+ * @param {JsUint | null} params.maxTouchPoints
249
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
250
+ * @param {Array<BrowserUserContext>} [params.userContexts]
251
+ * @returns {Promise<void>}
252
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setTouchOverride
253
+ */
123
254
  async setTouchOverride(params) {
124
- const response = await this.bidi.send({
125
- method: 'emulation.setTouchOverride',
126
- params: params,
127
- });
128
- if (response['type'] === 'error') {
129
- throw new Error(`${response['error']}: ${response['message']}`);
130
- }
255
+ const validatedParams = new EmulationSetTouchOverrideParameters(params);
256
+ await this.send('emulation.setTouchOverride', validatedParams);
131
257
  }
258
+ /**
259
+ * @param {EmulationSetUserAgentOverrideParameters} params
260
+ * @param {string | null} params.userAgent
261
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
262
+ * @param {Array<BrowserUserContext>} [params.userContexts]
263
+ * @returns {Promise<void>}
264
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setUserAgentOverride
265
+ */
132
266
  async setUserAgentOverride(params) {
133
- const response = await this.bidi.send({
134
- method: 'emulation.setUserAgentOverride',
135
- params: params,
136
- });
137
- if (response['type'] === 'error') {
138
- throw new Error(`${response['error']}: ${response['message']}`);
139
- }
267
+ const validatedParams = new EmulationSetUserAgentOverrideParameters(params);
268
+ await this.send('emulation.setUserAgentOverride', validatedParams);
140
269
  }
270
+ /**
271
+ * @param {EmulationSetViewportMetaOverrideParameters} params
272
+ * @param {true | null} params.viewportMeta
273
+ * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
274
+ * @param {Array<BrowserUserContext>} [params.userContexts]
275
+ * @returns {Promise<void>}
276
+ * @see https://w3c.github.io/webdriver-bidi/#command-emulation-setViewportMetaOverride
277
+ */
141
278
  async setViewportMetaOverride(params) {
142
- const response = await this.bidi.send({
143
- method: 'emulation.setViewportMetaOverride',
144
- params: params,
145
- });
146
- if (response['type'] === 'error') {
147
- throw new Error(`${response['error']}: ${response['message']}`);
148
- }
279
+ const validatedParams = new EmulationSetViewportMetaOverrideParameters(params);
280
+ await this.send('emulation.setViewportMetaOverride', validatedParams);
149
281
  }
150
282
  }
151
283
  exports.Emulation = Emulation;
284
+ Emulation.ForcedColorsModeTheme = Object.freeze({ LIGHT: "light", DARK: "dark" });
285
+ Emulation.ScreenOrientationNatural = Object.freeze({ PORTRAIT: "portrait", LANDSCAPE: "landscape" });
286
+ Emulation.ScreenOrientationType = Object.freeze({ PORTRAIT_PRIMARY: "portrait-primary", PORTRAIT_SECONDARY: "portrait-secondary", LANDSCAPE_PRIMARY: "landscape-primary", LANDSCAPE_SECONDARY: "landscape-secondary" });
287
+ Emulation.TextLayoutMode = Object.freeze({ MOBILE: "mobile" });
288
+ Emulation.MediaFeaturesAnyHover = Object.freeze({ NONE: "none", HOVER: "hover" });
289
+ Emulation.MediaFeaturesAnyPointer = Object.freeze({ NONE: "none", COARSE: "coarse", FINE: "fine" });
290
+ Emulation.MediaFeaturesColorGamut = Object.freeze({ SRGB: "srgb", P3: "p3", REC2020: "rec2020" });
291
+ Emulation.MediaFeaturesDisplayMode = Object.freeze({ FULLSCREEN: "fullscreen", STANDALONE: "standalone", MINIMAL_UI: "minimal-ui", BROWSER: "browser", PICTURE_IN_PICTURE: "picture-in-picture" });
292
+ Emulation.MediaFeaturesDynamicRange = Object.freeze({ STANDARD: "standard", HIGH: "high" });
293
+ Emulation.MediaFeaturesEnvironmentBlending = Object.freeze({ OPAQUE: "opaque", ADDITIVE: "additive", SUBTRACTIVE: "subtractive" });
294
+ Emulation.MediaFeaturesForcedColors = Object.freeze({ NONE: "none", ACTIVE: "active" });
295
+ Emulation.MediaFeaturesGrid = Object.freeze({ _0: 0, _1: 1 });
296
+ Emulation.MediaFeaturesHover = Object.freeze({ NONE: "none", HOVER: "hover" });
297
+ Emulation.MediaFeaturesInvertedColors = Object.freeze({ NONE: "none", INVERTED: "inverted" });
298
+ Emulation.MediaFeaturesNavControls = Object.freeze({ NONE: "none", BACK: "back" });
299
+ Emulation.MediaFeaturesOverflowBlock = Object.freeze({ NONE: "none", SCROLL: "scroll", OPTIONAL_PAGED: "optional-paged", PAGED: "paged" });
300
+ Emulation.MediaFeaturesOverflowInline = Object.freeze({ NONE: "none", SCROLL: "scroll" });
301
+ Emulation.MediaFeaturesPointer = Object.freeze({ NONE: "none", COARSE: "coarse", FINE: "fine" });
302
+ Emulation.MediaFeaturesPrefersColorScheme = Object.freeze({ LIGHT: "light", DARK: "dark" });
303
+ Emulation.MediaFeaturesPrefersContrast = Object.freeze({ NO_PREFERENCE: "no-preference", MORE: "more", LESS: "less", CUSTOM: "custom" });
304
+ Emulation.MediaFeaturesPrefersReducedData = Object.freeze({ NO_PREFERENCE: "no-preference", REDUCE: "reduce" });
305
+ Emulation.MediaFeaturesPrefersReducedMotion = Object.freeze({ NO_PREFERENCE: "no-preference", REDUCE: "reduce" });
306
+ Emulation.MediaFeaturesPrefersReducedTransparency = Object.freeze({ NO_PREFERENCE: "no-preference", REDUCE: "reduce" });
307
+ Emulation.MediaFeaturesScan = Object.freeze({ INTERLACE: "interlace", PROGRESSIVE: "progressive" });
308
+ Emulation.MediaFeaturesScripting = Object.freeze({ NONE: "none", INITIAL_ONLY: "initial-only", ENABLED: "enabled" });
309
+ Emulation.MediaFeaturesUpdate = Object.freeze({ NONE: "none", SLOW: "slow", FAST: "fast" });
310
+ Emulation.MediaFeaturesVideoColorGamut = Object.freeze({ SRGB: "srgb", P3: "p3", REC2020: "rec2020" });
311
+ Emulation.MediaFeaturesVideoDynamicRange = Object.freeze({ STANDARD: "standard", HIGH: "high" });
312
+ Emulation.SetScrollbarTypeOverrideParametersScrollbarType = Object.freeze({ CLASSIC: "classic", OVERLAY: "overlay" });
@@ -1,10 +1,12 @@
1
1
  import type { BrowserUserContext } from './browser.js';
2
+ import './browser.js';
2
3
  import type { BrowsingContextBrowsingContext } from './browsing_context.js';
4
+ import './browsing_context.js';
3
5
  import type { EmptyResult, JsInt, JsUint } from './common.js';
6
+ import './common.js';
4
7
  import type { ScriptSharedReference } from './script.js';
5
- export type InputCommand = InputPerformActions | InputReleaseActions | InputSetFiles;
6
- export type InputResult = InputPerformActionsResult | InputReleaseActionsResult | InputSetFilesResult;
7
- export type InputEvent = InputFileDialogOpened;
8
+ import './script.js';
9
+ import { Domain, type EventDescriptor } from '../domain.js';
8
10
  export interface InputElementOrigin {
9
11
  type: "element";
10
12
  element: ScriptSharedReference;
@@ -15,39 +17,36 @@ export interface InputPerformActions {
15
17
  }
16
18
  export interface InputPerformActionsParameters {
17
19
  context: BrowsingContextBrowsingContext;
18
- actions: InputSourceActions[];
20
+ actions: Array<InputSourceActions>;
19
21
  }
20
22
  export type InputSourceActions = InputNoneSourceActions | InputKeySourceActions | InputPointerSourceActions | InputWheelSourceActions;
21
23
  export interface InputNoneSourceActions {
22
24
  type: "none";
23
25
  id: string;
24
- actions: InputNoneSourceAction[];
26
+ actions: Array<InputNoneSourceAction>;
25
27
  }
26
28
  export type InputNoneSourceAction = InputPauseAction;
27
29
  export interface InputKeySourceActions {
28
30
  type: "key";
29
31
  id: string;
30
- actions: InputKeySourceAction[];
32
+ actions: Array<InputKeySourceAction>;
31
33
  }
32
34
  export type InputKeySourceAction = InputPauseAction | InputKeyDownAction | InputKeyUpAction;
33
35
  export interface InputPointerSourceActions {
34
36
  type: "pointer";
35
37
  id: string;
36
38
  parameters?: InputPointerParameters;
37
- actions: InputPointerSourceAction[];
39
+ actions: Array<InputPointerSourceAction>;
38
40
  }
39
41
  export type InputPointerType = "mouse" | "pen" | "touch";
40
42
  export interface InputPointerParameters {
41
- /**
42
- * @default 'mouse'
43
- */
44
43
  pointerType?: InputPointerType;
45
44
  }
46
45
  export type InputPointerSourceAction = InputPauseAction | InputPointerDownAction | InputPointerUpAction | InputPointerMoveAction;
47
46
  export interface InputWheelSourceActions {
48
47
  type: "wheel";
49
48
  id: string;
50
- actions: InputWheelSourceAction[];
49
+ actions: Array<InputWheelSourceAction>;
51
50
  }
52
51
  export type InputWheelSourceAction = InputPauseAction | InputWheelScrollAction;
53
52
  export interface InputPauseAction {
@@ -66,17 +65,31 @@ export interface InputPointerUpAction {
66
65
  type: "pointerUp";
67
66
  button: JsUint;
68
67
  }
69
- export type InputPointerDownAction = InputPointerCommonProperties & {
68
+ export interface InputPointerDownAction {
70
69
  type: "pointerDown";
71
70
  button: JsUint;
72
- };
73
- export type InputPointerMoveAction = InputPointerCommonProperties & {
71
+ width?: JsUint;
72
+ height?: JsUint;
73
+ pressure?: number;
74
+ tangentialPressure?: number;
75
+ twist?: number;
76
+ altitudeAngle?: number;
77
+ azimuthAngle?: number;
78
+ }
79
+ export interface InputPointerMoveAction {
74
80
  type: "pointerMove";
75
81
  x: number;
76
82
  y: number;
77
83
  duration?: JsUint;
78
84
  origin?: InputOrigin;
79
- };
85
+ width?: JsUint;
86
+ height?: JsUint;
87
+ pressure?: number;
88
+ tangentialPressure?: number;
89
+ twist?: number;
90
+ altitudeAngle?: number;
91
+ azimuthAngle?: number;
92
+ }
80
93
  export interface InputWheelScrollAction {
81
94
  type: "scroll";
82
95
  x: JsInt;
@@ -84,9 +97,6 @@ export interface InputWheelScrollAction {
84
97
  deltaX: JsInt;
85
98
  deltaY: JsInt;
86
99
  duration?: JsUint;
87
- /**
88
- * @default 'viewport'
89
- */
90
100
  origin?: InputOrigin;
91
101
  }
92
102
  export interface InputPointerCommonProperties {
@@ -94,13 +104,7 @@ export interface InputPointerCommonProperties {
94
104
  height?: JsUint;
95
105
  pressure?: number;
96
106
  tangentialPressure?: number;
97
- /**
98
- * 0 .. Math.PI / 2
99
- */
100
107
  twist?: number;
101
- /**
102
- * 0 .. 2 * Math.PI
103
- */
104
108
  altitudeAngle?: number;
105
109
  azimuthAngle?: number;
106
110
  }
@@ -121,7 +125,7 @@ export interface InputSetFiles {
121
125
  export interface InputSetFilesParameters {
122
126
  context: BrowsingContextBrowsingContext;
123
127
  element: ScriptSharedReference;
124
- files: string[];
128
+ files: Array<string>;
125
129
  }
126
130
  export type InputSetFilesResult = EmptyResult;
127
131
  export interface InputFileDialogOpened {
@@ -134,18 +138,42 @@ export interface InputFileDialogInfo {
134
138
  element?: ScriptSharedReference;
135
139
  multiple: boolean;
136
140
  }
137
- /** @deprecated Use {@link Input.create} instead — will be removed in a future major version. */
138
- export declare function getInputInstance(driver: unknown): Promise<Input>;
139
- export declare class Input {
140
- private readonly bidi;
141
- private constructor();
141
+ /**
142
+ * This is an unsupported API. No compatibility guarantees are provided.
143
+ * It tracks the W3C WebDriver BiDi specification directly. As the specification
144
+ * evolves, this API will change or be removed without prior notice.
145
+ */
146
+ export declare class Input extends Domain {
147
+ /** @see https://w3c.github.io/webdriver-bidi/#event-input-fileDialogOpened */
148
+ static readonly FILE_DIALOG_OPENED: EventDescriptor<InputFileDialogInfo>;
149
+ static readonly PointerType: Readonly<{
150
+ readonly MOUSE: "mouse";
151
+ readonly PEN: "pen";
152
+ readonly TOUCH: "touch";
153
+ }>;
142
154
  static create(driver: unknown): Promise<Input>;
155
+ /**
156
+ * @param {InputPerformActionsParameters} params
157
+ * @param {BrowsingContextBrowsingContext} params.context
158
+ * @param {Array<InputSourceActions>} params.actions
159
+ * @returns {Promise<void>}
160
+ * @see https://w3c.github.io/webdriver-bidi/#command-input-performActions
161
+ */
143
162
  performActions(params: InputPerformActionsParameters): Promise<void>;
163
+ /**
164
+ * @param {InputReleaseActionsParameters} params
165
+ * @param {BrowsingContextBrowsingContext} params.context
166
+ * @returns {Promise<void>}
167
+ * @see https://w3c.github.io/webdriver-bidi/#command-input-releaseActions
168
+ */
144
169
  releaseActions(params: InputReleaseActionsParameters): Promise<void>;
170
+ /**
171
+ * @param {InputSetFilesParameters} params
172
+ * @param {BrowsingContextBrowsingContext} params.context
173
+ * @param {ScriptSharedReference} params.element
174
+ * @param {Array<string>} params.files
175
+ * @returns {Promise<void>}
176
+ * @see https://w3c.github.io/webdriver-bidi/#command-input-setFiles
177
+ */
145
178
  setFiles(params: InputSetFilesParameters): Promise<void>;
146
- onFileDialogOpened(callback: (params: InputFileDialogInfo) => void): Promise<void>;
147
- /** @deprecated Use {@link performActions} instead — will be removed in a future major version. */
148
- perform(browsingContextId: string, actions: InputSourceActions[]): Promise<void>;
149
- /** @deprecated Use {@link releaseActions} instead — will be removed in a future major version. */
150
- release(browsingContextId: string): Promise<void>;
151
179
  }