chromium-bidi.d.ts 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Copyright 2023 Google LLC.
  3. * Copyright (c) Microsoft Corporation.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import type * as Cdp from './cdp.js';
  18. import type * as WebDriverBidiPermissions from './generated/webdriver-bidi-permissions.js';
  19. import type * as WebDriverBidi from './generated/webdriver-bidi.js';
  20. export type EventNames = Cdp.EventNames | `${BiDiModule}` | `${BrowsingContext.EventNames}` | `${Log.EventNames}` | `${Network.EventNames}` | `${Script.EventNames}`;
  21. export declare enum BiDiModule {
  22. Browser = "browser",
  23. BrowsingContext = "browsingContext",
  24. Cdp = "cdp",
  25. Input = "input",
  26. Log = "log",
  27. Network = "network",
  28. Script = "script",
  29. Session = "session"
  30. }
  31. export declare namespace Script {
  32. enum EventNames {
  33. Message = "script.message",
  34. RealmCreated = "script.realmCreated",
  35. RealmDestroyed = "script.realmDestroyed"
  36. }
  37. }
  38. export declare namespace Log {
  39. enum EventNames {
  40. LogEntryAdded = "log.entryAdded"
  41. }
  42. }
  43. export declare namespace BrowsingContext {
  44. enum EventNames {
  45. ContextCreated = "browsingContext.contextCreated",
  46. ContextDestroyed = "browsingContext.contextDestroyed",
  47. DomContentLoaded = "browsingContext.domContentLoaded",
  48. DownloadWillBegin = "browsingContext.downloadWillBegin",
  49. FragmentNavigated = "browsingContext.fragmentNavigated",
  50. Load = "browsingContext.load",
  51. NavigationAborted = "browsingContext.navigationAborted",
  52. NavigationFailed = "browsingContext.navigationFailed",
  53. NavigationStarted = "browsingContext.navigationStarted",
  54. UserPromptClosed = "browsingContext.userPromptClosed",
  55. UserPromptOpened = "browsingContext.userPromptOpened"
  56. }
  57. }
  58. export declare namespace Network {
  59. enum EventNames {
  60. AuthRequired = "network.authRequired",
  61. BeforeRequestSent = "network.beforeRequestSent",
  62. FetchError = "network.fetchError",
  63. ResponseCompleted = "network.responseCompleted",
  64. ResponseStarted = "network.responseStarted"
  65. }
  66. }
  67. export type Command = (WebDriverBidi.Command | Cdp.Command | ({
  68. id: WebDriverBidi.JsUint;
  69. } & WebDriverBidiPermissions.PermissionsCommand)) & {
  70. channel?: WebDriverBidi.Script.Channel;
  71. };
  72. export type CommandResponse = WebDriverBidi.CommandResponse | Cdp.CommandResponse;
  73. export type Event = WebDriverBidi.Event | Cdp.Event;
  74. export declare const EVENT_NAMES: Set<BiDiModule | BrowsingContext.EventNames | Log.EventNames.LogEntryAdded | Network.EventNames | Script.EventNames>;
  75. export type ResultData = WebDriverBidi.ResultData | Cdp.ResultData;
  76. export type BidiPlusChannel = string | null;
  77. export type Message = (WebDriverBidi.Message | Cdp.Message) & {
  78. channel?: BidiPlusChannel;
  79. };