UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

396 lines • 53.3 kB
"use strict";
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.MozBrowsingContext = exports.BrowsingContext = void 0;
require("./browser.js");
require("./common.js");
require("./script.js");
require("./session.js");
const record_js_1 = require("../serialization/record.js");
const enum_js_1 = require("../serialization/enum.js");
const union_js_1 = require("../serialization/union.js");
const domain_js_1 = require("../domain.js");
(0, record_js_1.defineAlias)('browsingContext.BrowsingContext', { "primitive": "string" });
(0, record_js_1.defineAlias)('browsingContext.InfoList', { "list": { "ref": "browsingContext.Info" } });
const BrowsingContextBaseInfo = (0, record_js_1.defineRecord)('browsingContext.BaseInfo', [{ "name": "children", "wire": "children", "required": true, "type": { "ref": "browsingContext.InfoList", "nullable": true } }, { "name": "clientWindow", "wire": "clientWindow", "required": true, "type": { "ref": "browser.ClientWindow" } }, { "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "originalOpener", "wire": "originalOpener", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": true, "type": { "ref": "browser.UserContext" } }, { "name": "parent", "wire": "parent", "required": false, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }]);
const BrowsingContextInfo = (0, record_js_1.defineRecord)('browsingContext.Info', [{ "name": "children", "wire": "children", "required": true, "type": { "ref": "browsingContext.InfoList", "nullable": true } }, { "name": "clientWindow", "wire": "clientWindow", "required": true, "type": { "ref": "browser.ClientWindow" } }, { "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "originalOpener", "wire": "originalOpener", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": true, "type": { "ref": "browser.UserContext" } }, { "name": "parent", "wire": "parent", "required": false, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }], { "extensible": true });
const BrowsingContextLocatorUnion = (0, union_js_1.defineUnion)('browsingContext.Locator', { "by": "type", "variants": [{ "value": "accessibility", "ref": "browsingContext.AccessibilityLocator" }, { "value": "css", "ref": "browsingContext.CssLocator" }, { "value": "context", "ref": "browsingContext.ContextLocator" }, { "value": "innerText", "ref": "browsingContext.InnerTextLocator" }, { "value": "xpath", "ref": "browsingContext.XPathLocator" }] }, { "objectOnly": true });
const BrowsingContextAccessibilityLocator = (0, record_js_1.defineRecord)('browsingContext.AccessibilityLocator', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "accessibility" } }, { "name": "value", "wire": "value", "required": true, "type": { "ref": "browsingContext.AccessibilityLocatorValue" } }]);
const BrowsingContextCssLocator = (0, record_js_1.defineRecord)('browsingContext.CssLocator', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "css" } }, { "name": "value", "wire": "value", "required": true, "type": { "primitive": "string" } }]);
const BrowsingContextContextLocator = (0, record_js_1.defineRecord)('browsingContext.ContextLocator', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "context" } }, { "name": "value", "wire": "value", "required": true, "type": { "ref": "browsingContext.ContextLocatorValue" } }]);
const BrowsingContextInnerTextLocator = (0, record_js_1.defineRecord)('browsingContext.InnerTextLocator', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "innerText" } }, { "name": "value", "wire": "value", "required": true, "type": { "primitive": "string" } }, { "name": "ignoreCase", "wire": "ignoreCase", "required": false, "type": { "primitive": "boolean" } }, { "name": "matchType", "wire": "matchType", "required": false, "type": { "ref": "browsingContext.InnerTextLocatorMatchType" } }, { "name": "maxDepth", "wire": "maxDepth", "required": false, "type": { "ref": "js-uint" } }]);
const BrowsingContextXPathLocator = (0, record_js_1.defineRecord)('browsingContext.XPathLocator', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "xpath" } }, { "name": "value", "wire": "value", "required": true, "type": { "primitive": "string" } }]);
(0, record_js_1.defineAlias)('browsingContext.Navigation', { "primitive": "string" });
(0, record_js_1.defineAlias)('browsingContext.Download', { "primitive": "string" });
const BrowsingContextBaseNavigationInfo = (0, record_js_1.defineRecord)('browsingContext.BaseNavigationInfo', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextNavigationInfo = (0, record_js_1.defineRecord)('browsingContext.NavigationInfo', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextReadinessStateEnum = (0, enum_js_1.defineEnum)('browsingContext.ReadinessState', ["none", "interactive", "complete"]);
const BrowsingContextUserPromptTypeEnum = (0, enum_js_1.defineEnum)('browsingContext.UserPromptType', ["alert", "beforeunload", "confirm", "prompt"]);
const BrowsingContextActivate = (0, record_js_1.defineRecord)('browsingContext.Activate', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.activate" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.ActivateParameters" } }]);
const BrowsingContextActivateParameters = (0, record_js_1.defineRecord)('browsingContext.ActivateParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }]);
(0, record_js_1.defineAlias)('browsingContext.ActivateResult', { "ref": "EmptyResult" });
const BrowsingContextCaptureScreenshot = (0, record_js_1.defineRecord)('browsingContext.CaptureScreenshot', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.captureScreenshot" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.CaptureScreenshotParameters" } }]);
const BrowsingContextCaptureScreenshotParameters = (0, record_js_1.defineRecord)('browsingContext.CaptureScreenshotParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "origin", "wire": "origin", "required": false, "type": { "ref": "browsingContext.CaptureScreenshotParametersOrigin" } }, { "name": "format", "wire": "format", "required": false, "type": { "ref": "browsingContext.ImageFormat" } }, { "name": "clip", "wire": "clip", "required": false, "type": { "ref": "browsingContext.ClipRectangle" } }, { "name": "imageSize", "wire": "imageSize", "required": false, "type": { "ref": "browsingContext.ImageSize" } }]);
const BrowsingContextImageFormat = (0, record_js_1.defineRecord)('browsingContext.ImageFormat', [{ "name": "type", "wire": "type", "required": true, "type": { "primitive": "string" } }, { "name": "quality", "wire": "quality", "required": false, "type": { "primitive": "number" } }]);
const BrowsingContextImageSize = (0, record_js_1.defineRecord)('browsingContext.ImageSize', [{ "name": "maxWidth", "wire": "maxWidth", "required": false, "type": { "ref": "js-uint" } }, { "name": "maxHeight", "wire": "maxHeight", "required": false, "type": { "ref": "js-uint" } }]);
const BrowsingContextClipRectangleUnion = (0, union_js_1.defineUnion)('browsingContext.ClipRectangle', { "by": "type", "variants": [{ "value": "box", "ref": "browsingContext.BoxClipRectangle" }, { "value": "element", "ref": "browsingContext.ElementClipRectangle" }] }, { "objectOnly": true });
const BrowsingContextElementClipRectangle = (0, record_js_1.defineRecord)('browsingContext.ElementClipRectangle', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "element" } }, { "name": "element", "wire": "element", "required": true, "type": { "ref": "script.SharedReference" } }]);
const BrowsingContextBoxClipRectangle = (0, record_js_1.defineRecord)('browsingContext.BoxClipRectangle', [{ "name": "type", "wire": "type", "required": true, "type": { "const": "box" } }, { "name": "x", "wire": "x", "required": true, "type": { "primitive": "number" } }, { "name": "y", "wire": "y", "required": true, "type": { "primitive": "number" } }, { "name": "width", "wire": "width", "required": true, "type": { "primitive": "number" } }, { "name": "height", "wire": "height", "required": true, "type": { "primitive": "number" } }]);
const BrowsingContextCaptureScreenshotResult = (0, record_js_1.defineRecord)('browsingContext.CaptureScreenshotResult', [{ "name": "data", "wire": "data", "required": true, "type": { "primitive": "string" } }]);
const BrowsingContextClose = (0, record_js_1.defineRecord)('browsingContext.Close', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.close" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.CloseParameters" } }]);
const BrowsingContextCloseParameters = (0, record_js_1.defineRecord)('browsingContext.CloseParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "promptUnload", "wire": "promptUnload", "required": false, "type": { "primitive": "boolean" } }]);
(0, record_js_1.defineAlias)('browsingContext.CloseResult', { "ref": "EmptyResult" });
const BrowsingContextCreate = (0, record_js_1.defineRecord)('browsingContext.Create', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.create" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.CreateParameters" } }]);
const BrowsingContextCreateTypeEnum = (0, enum_js_1.defineEnum)('browsingContext.CreateType', ["tab", "window"]);
const BrowsingContextCreateParameters = (0, record_js_1.defineRecord)('browsingContext.CreateParameters', [{ "name": "type", "wire": "type", "required": true, "type": { "ref": "browsingContext.CreateType" } }, { "name": "referenceContext", "wire": "referenceContext", "required": false, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "background", "wire": "background", "required": false, "type": { "primitive": "boolean" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextCreateResult = (0, record_js_1.defineRecord)('browsingContext.CreateResult', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextGetTree = (0, record_js_1.defineRecord)('browsingContext.GetTree', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.getTree" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.GetTreeParameters" } }]);
const BrowsingContextGetTreeParameters = (0, record_js_1.defineRecord)('browsingContext.GetTreeParameters', [{ "name": "maxDepth", "wire": "maxDepth", "required": false, "type": { "ref": "js-uint" } }, { "name": "root", "wire": "root", "required": false, "type": { "ref": "browsingContext.BrowsingContext" } }], { "extensible": true });
const BrowsingContextGetTreeResult = (0, record_js_1.defineRecord)('browsingContext.GetTreeResult', [{ "name": "contexts", "wire": "contexts", "required": true, "type": { "ref": "browsingContext.InfoList" } }]);
const BrowsingContextHandleUserPrompt = (0, record_js_1.defineRecord)('browsingContext.HandleUserPrompt', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.handleUserPrompt" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.HandleUserPromptParameters" } }]);
const BrowsingContextHandleUserPromptParameters = (0, record_js_1.defineRecord)('browsingContext.HandleUserPromptParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "accept", "wire": "accept", "required": false, "type": { "primitive": "boolean" } }, { "name": "userText", "wire": "userText", "required": false, "type": { "primitive": "string" } }]);
(0, record_js_1.defineAlias)('browsingContext.HandleUserPromptResult', { "ref": "EmptyResult" });
const BrowsingContextLocateNodes = (0, record_js_1.defineRecord)('browsingContext.LocateNodes', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.locateNodes" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.LocateNodesParameters" } }]);
const BrowsingContextLocateNodesParameters = (0, record_js_1.defineRecord)('browsingContext.LocateNodesParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "locator", "wire": "locator", "required": true, "type": { "ref": "browsingContext.Locator" } }, { "name": "maxNodeCount", "wire": "maxNodeCount", "required": false, "type": { "ref": "js-uint" } }, { "name": "serializationOptions", "wire": "serializationOptions", "required": false, "type": { "ref": "script.SerializationOptions" } }, { "name": "startNodes", "wire": "startNodes", "required": false, "type": { "list": { "ref": "script.SharedReference" } } }]);
const BrowsingContextLocateNodesResult = (0, record_js_1.defineRecord)('browsingContext.LocateNodesResult', [{ "name": "nodes", "wire": "nodes", "required": true, "type": { "list": { "ref": "script.NodeRemoteValue" } } }]);
const BrowsingContextNavigate = (0, record_js_1.defineRecord)('browsingContext.Navigate', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.navigate" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigateParameters" } }]);
const BrowsingContextNavigateParameters = (0, record_js_1.defineRecord)('browsingContext.NavigateParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "wait", "wire": "wait", "required": false, "type": { "ref": "browsingContext.ReadinessState" } }]);
const BrowsingContextNavigateResult = (0, record_js_1.defineRecord)('browsingContext.NavigateResult', [{ "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }]);
const BrowsingContextPrint = (0, record_js_1.defineRecord)('browsingContext.Print', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.print" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.PrintParameters" } }]);
const BrowsingContextPrintParameters = (0, record_js_1.defineRecord)('browsingContext.PrintParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "background", "wire": "background", "required": false, "type": { "primitive": "boolean" } }, { "name": "margin", "wire": "margin", "required": false, "type": { "ref": "browsingContext.PrintMarginParameters" } }, { "name": "orientation", "wire": "orientation", "required": false, "type": { "ref": "browsingContext.PrintParametersOrientation" } }, { "name": "page", "wire": "page", "required": false, "type": { "ref": "browsingContext.PrintPageParameters" } }, { "name": "pageRanges", "wire": "pageRanges", "required": false, "type": { "list": { "union": [{ "ref": "js-uint" }, { "primitive": "string" }], "scalar": "string" } } }, { "name": "scale", "wire": "scale", "required": false, "type": { "primitive": "number" } }, { "name": "shrinkToFit", "wire": "shrinkToFit", "required": false, "type": { "primitive": "boolean" } }]);
const BrowsingContextPrintMarginParameters = (0, record_js_1.defineRecord)('browsingContext.PrintMarginParameters', [{ "name": "bottom", "wire": "bottom", "required": false, "type": { "primitive": "number" } }, { "name": "left", "wire": "left", "required": false, "type": { "primitive": "number" } }, { "name": "right", "wire": "right", "required": false, "type": { "primitive": "number" } }, { "name": "top", "wire": "top", "required": false, "type": { "primitive": "number" } }]);
const BrowsingContextPrintPageParameters = (0, record_js_1.defineRecord)('browsingContext.PrintPageParameters', [{ "name": "height", "wire": "height", "required": false, "type": { "primitive": "number" } }, { "name": "width", "wire": "width", "required": false, "type": { "primitive": "number" } }]);
const BrowsingContextPrintResult = (0, record_js_1.defineRecord)('browsingContext.PrintResult', [{ "name": "data", "wire": "data", "required": true, "type": { "primitive": "string" } }]);
const BrowsingContextReload = (0, record_js_1.defineRecord)('browsingContext.Reload', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.reload" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.ReloadParameters" } }]);
const BrowsingContextReloadParameters = (0, record_js_1.defineRecord)('browsingContext.ReloadParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "ignoreCache", "wire": "ignoreCache", "required": false, "type": { "primitive": "boolean" } }, { "name": "wait", "wire": "wait", "required": false, "type": { "ref": "browsingContext.ReadinessState" } }]);
(0, record_js_1.defineAlias)('browsingContext.ReloadResult', { "ref": "browsingContext.NavigateResult" });
const BrowsingContextSetBypassCsp = (0, record_js_1.defineRecord)('browsingContext.SetBypassCSP', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.setBypassCSP" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.SetBypassCSPParameters" } }]);
const BrowsingContextSetBypassCspParameters = (0, record_js_1.defineRecord)('browsingContext.SetBypassCSPParameters', [{ "name": "bypass", "wire": "bypass", "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" } } }]);
(0, record_js_1.defineAlias)('browsingContext.SetBypassCSPResult', { "ref": "EmptyResult" });
const BrowsingContextSetViewport = (0, record_js_1.defineRecord)('browsingContext.SetViewport', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.setViewport" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.SetViewportParameters" } }]);
const BrowsingContextSetViewportParameters = (0, record_js_1.defineRecord)('browsingContext.SetViewportParameters', [{ "name": "context", "wire": "context", "required": false, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "viewport", "wire": "viewport", "required": false, "type": { "ref": "browsingContext.Viewport", "nullable": true } }, { "name": "devicePixelRatio", "wire": "devicePixelRatio", "required": false, "type": { "primitive": "number", "nullable": true } }, { "name": "userContexts", "wire": "userContexts", "required": false, "type": { "list": { "ref": "browser.UserContext" } } }]);
const BrowsingContextViewport = (0, record_js_1.defineRecord)('browsingContext.Viewport', [{ "name": "width", "wire": "width", "required": true, "type": { "ref": "js-uint" } }, { "name": "height", "wire": "height", "required": true, "type": { "ref": "js-uint" } }]);
(0, record_js_1.defineAlias)('browsingContext.SetViewportResult', { "ref": "EmptyResult" });
const BrowsingContextStartScreencast = (0, record_js_1.defineRecord)('browsingContext.StartScreencast', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.startScreencast" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.StartScreencastParameters" } }]);
const BrowsingContextStartScreencastParameters = (0, record_js_1.defineRecord)('browsingContext.StartScreencastParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "destinationFolder", "wire": "destinationFolder", "required": false, "type": { "primitive": "string" } }, { "name": "mimeType", "wire": "mimeType", "required": false, "type": { "primitive": "string" } }, { "name": "video", "wire": "video", "required": false, "type": { "ref": "browsingContext.MediaTrackConstraints" } }, { "name": "audio", "wire": "audio", "required": false, "type": { "primitive": "boolean" } }]);
const BrowsingContextMediaTrackConstraints = (0, record_js_1.defineRecord)('browsingContext.MediaTrackConstraints', [{ "name": "width", "wire": "width", "required": false, "type": { "ref": "js-uint" } }, { "name": "height", "wire": "height", "required": false, "type": { "ref": "js-uint" } }, { "name": "frameRate", "wire": "frameRate", "required": false, "type": { "ref": "js-uint" } }]);
const BrowsingContextStartScreencastResult = (0, record_js_1.defineRecord)('browsingContext.StartScreencastResult', [{ "name": "screencast", "wire": "screencast", "required": true, "type": { "ref": "browsingContext.Screencast" } }, { "name": "path", "wire": "path", "required": true, "type": { "primitive": "string" } }]);
(0, record_js_1.defineAlias)('browsingContext.Screencast', { "primitive": "string" });
const BrowsingContextStopScreencast = (0, record_js_1.defineRecord)('browsingContext.StopScreencast', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.stopScreencast" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.StopScreencastParameters" } }]);
const BrowsingContextStopScreencastParameters = (0, record_js_1.defineRecord)('browsingContext.StopScreencastParameters', [{ "name": "screencast", "wire": "screencast", "required": true, "type": { "ref": "browsingContext.Screencast" } }]);
const BrowsingContextStopScreencastResult = (0, record_js_1.defineRecord)('browsingContext.StopScreencastResult', [{ "name": "path", "wire": "path", "required": true, "type": { "primitive": "string" } }, { "name": "error", "wire": "error", "required": false, "type": { "primitive": "string" } }]);
const BrowsingContextTraverseHistory = (0, record_js_1.defineRecord)('browsingContext.TraverseHistory', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.traverseHistory" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.TraverseHistoryParameters" } }]);
const BrowsingContextTraverseHistoryParameters = (0, record_js_1.defineRecord)('browsingContext.TraverseHistoryParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "delta", "wire": "delta", "required": true, "type": { "ref": "js-int" } }]);
(0, record_js_1.defineAlias)('browsingContext.TraverseHistoryResult', { "ref": "EmptyResult" });
const BrowsingContextContextCreated = (0, record_js_1.defineRecord)('browsingContext.ContextCreated', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.contextCreated" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.ContextCreatedParameters" } }]);
const BrowsingContextContextDestroyed = (0, record_js_1.defineRecord)('browsingContext.ContextDestroyed', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.contextDestroyed" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.Info" } }]);
const BrowsingContextNavigationStarted = (0, record_js_1.defineRecord)('browsingContext.NavigationStarted', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.navigationStarted" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextFragmentNavigated = (0, record_js_1.defineRecord)('browsingContext.FragmentNavigated', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.fragmentNavigated" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextHistoryUpdated = (0, record_js_1.defineRecord)('browsingContext.HistoryUpdated', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.historyUpdated" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.HistoryUpdatedParameters" } }]);
const BrowsingContextHistoryUpdatedParameters = (0, record_js_1.defineRecord)('browsingContext.HistoryUpdatedParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextDomContentLoaded = (0, record_js_1.defineRecord)('browsingContext.DomContentLoaded', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.domContentLoaded" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextLoad = (0, record_js_1.defineRecord)('browsingContext.Load', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.load" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextDownloadWillBegin = (0, record_js_1.defineRecord)('browsingContext.DownloadWillBegin', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.downloadWillBegin" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.DownloadWillBeginParams" } }]);
const BrowsingContextDownloadWillBeginParams = (0, record_js_1.defineRecord)('browsingContext.DownloadWillBeginParams', [{ "name": "download", "wire": "download", "required": true, "type": { "ref": "browsingContext.Download" } }, { "name": "suggestedFilename", "wire": "suggestedFilename", "required": true, "type": { "primitive": "string" } }, { "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextDownloadEnd = (0, record_js_1.defineRecord)('browsingContext.DownloadEnd', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.downloadEnd" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.DownloadEndParams" } }]);
const BrowsingContextDownloadEndParamsUnion = (0, union_js_1.defineUnion)('browsingContext.DownloadEndParams', { "by": "status", "variants": [{ "value": "canceled", "ref": "browsingContext.DownloadEndParams_CanceledParams" }, { "value": "complete", "ref": "browsingContext.DownloadEndParams_CompleteParams" }] }, { "objectOnly": true });
const BrowsingContextNavigationAborted = (0, record_js_1.defineRecord)('browsingContext.NavigationAborted', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.navigationAborted" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextNavigationCommitted = (0, record_js_1.defineRecord)('browsingContext.NavigationCommitted', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.navigationCommitted" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextNavigationFailed = (0, record_js_1.defineRecord)('browsingContext.NavigationFailed', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.navigationFailed" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.NavigationInfo" } }]);
const BrowsingContextUserPromptClosed = (0, record_js_1.defineRecord)('browsingContext.UserPromptClosed', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.userPromptClosed" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.UserPromptClosedParameters" } }]);
const BrowsingContextUserPromptClosedParameters = (0, record_js_1.defineRecord)('browsingContext.UserPromptClosedParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "accepted", "wire": "accepted", "required": true, "type": { "primitive": "boolean" } }, { "name": "type", "wire": "type", "required": true, "type": { "ref": "browsingContext.UserPromptType" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }, { "name": "userText", "wire": "userText", "required": false, "type": { "primitive": "string" } }]);
const BrowsingContextUserPromptOpened = (0, record_js_1.defineRecord)('browsingContext.UserPromptOpened', [{ "name": "method", "wire": "method", "required": true, "type": { "const": "browsingContext.userPromptOpened" } }, { "name": "params", "wire": "params", "required": true, "type": { "ref": "browsingContext.UserPromptOpenedParameters" } }]);
const BrowsingContextUserPromptOpenedParameters = (0, record_js_1.defineRecord)('browsingContext.UserPromptOpenedParameters', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "handler", "wire": "handler", "required": true, "type": { "ref": "session.UserPromptHandlerType" } }, { "name": "message", "wire": "message", "required": true, "type": { "primitive": "string" } }, { "name": "type", "wire": "type", "required": true, "type": { "ref": "browsingContext.UserPromptType" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }, { "name": "defaultValue", "wire": "defaultValue", "required": false, "type": { "primitive": "string" } }]);
const BrowsingContextContextCreatedParameters = (0, record_js_1.defineRecord)('browsingContext.ContextCreatedParameters', [{ "name": "children", "wire": "children", "required": true, "type": { "ref": "browsingContext.InfoList", "nullable": true } }, { "name": "clientWindow", "wire": "clientWindow", "required": true, "type": { "ref": "browser.ClientWindow" } }, { "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "originalOpener", "wire": "originalOpener", "required": true, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": true, "type": { "ref": "browser.UserContext" } }, { "name": "parent", "wire": "parent", "required": false, "type": { "ref": "browsingContext.BrowsingContext", "nullable": true } }, { "name": "hasPlannedNavigation", "wire": "hasPlannedNavigation", "required": false, "type": { "primitive": "boolean" } }]);
const BrowsingContextInnerTextLocatorMatchTypeEnum = (0, enum_js_1.defineEnum)('browsingContext.InnerTextLocatorMatchType', ["full", "partial"]);
const BrowsingContextCaptureScreenshotParametersOriginEnum = (0, enum_js_1.defineEnum)('browsingContext.CaptureScreenshotParametersOrigin', ["viewport", "document"]);
const BrowsingContextPrintParametersOrientationEnum = (0, enum_js_1.defineEnum)('browsingContext.PrintParametersOrientation', ["portrait", "landscape"]);
const BrowsingContextDownloadEndParams_CanceledParams = (0, record_js_1.defineRecord)('browsingContext.DownloadEndParams_CanceledParams', [{ "name": "status", "wire": "status", "required": true, "type": { "const": "canceled" } }, { "name": "download", "wire": "download", "required": true, "type": { "ref": "browsingContext.Download" } }, { "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextDownloadEndParams_CompleteParams = (0, record_js_1.defineRecord)('browsingContext.DownloadEndParams_CompleteParams', [{ "name": "status", "wire": "status", "required": true, "type": { "const": "complete" } }, { "name": "download", "wire": "download", "required": true, "type": { "ref": "browsingContext.Download" } }, { "name": "filepath", "wire": "filepath", "required": true, "type": { "primitive": "string", "nullable": true } }, { "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "navigation", "wire": "navigation", "required": true, "type": { "ref": "browsingContext.Navigation", "nullable": true } }, { "name": "timestamp", "wire": "timestamp", "required": true, "type": { "ref": "js-uint" } }, { "name": "url", "wire": "url", "required": true, "type": { "primitive": "string" } }, { "name": "userContext", "wire": "userContext", "required": false, "type": { "ref": "browser.UserContext" } }]);
const BrowsingContextAccessibilityLocatorValue = (0, record_js_1.defineRecord)('browsingContext.AccessibilityLocatorValue', [{ "name": "name", "wire": "name", "required": false, "type": { "primitive": "string" } }, { "name": "role", "wire": "role", "required": false, "type": { "primitive": "string" } }]);
const BrowsingContextContextLocatorValue = (0, record_js_1.defineRecord)('browsingContext.ContextLocatorValue', [{ "name": "context", "wire": "context", "required": true, "type": { "ref": "browsingContext.BrowsingContext" } }]);
const BrowsingContextMozGetTreeParameters = (0, record_js_1.defineRecord)('browsingContext.MozGetTreeParameters', [{ "name": "maxDepth", "wire": "maxDepth", "required": false, "type": { "ref": "js-uint" } }, { "name": "root", "wire": "root", "required": false, "type": { "ref": "browsingContext.BrowsingContext" } }, { "name": "scope", "wire": "moz:scope", "required": false, "type": { "enum": ["chrome", "content"], "primitive": "string" } }], { "extensible": true });
// --- Implementation ---
/**
 * This is an unsupported API. No compatibility guarantees are provided.
 * It tracks the W3C WebDriver BiDi specification directly. As the specification
 * evolves, this API will change or be removed without prior notice.
 */
class BrowsingContext extends domain_js_1.Domain {
    static async create(driver) {
        return new BrowsingContext(await domain_js_1.Domain.connect(driver), domain_js_1.DOMAIN_TOKEN);
    }
    /**
     * @param {BrowsingContextActivateParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @returns {Promise<void>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-activate
     */
    async activate(params) {
        const validatedParams = new BrowsingContextActivateParameters(params);
        await this.send('browsingContext.activate', validatedParams);
    }
    /**
     * @param {BrowsingContextCaptureScreenshotParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {BrowsingContextCaptureScreenshotParametersOrigin} [params.origin]
     * @param {BrowsingContextImageFormat} [params.format]
     * @param {BrowsingContextClipRectangle} [params.clip]
     * @param {BrowsingContextImageSize} [params.imageSize]
     * @returns {Promise<BrowsingContextCaptureScreenshotResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-captureScreenshot
     */
    async captureScreenshot(params) {
        const validatedParams = new BrowsingContextCaptureScreenshotParameters(params);
        const result = await this.send('browsingContext.captureScreenshot', validatedParams);
        return BrowsingContextCaptureScreenshotResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextCloseParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {boolean} [params.promptUnload]
     * @returns {Promise<void>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-close
     */
    async close(params) {
        const validatedParams = new BrowsingContextCloseParameters(params);
        await this.send('browsingContext.close', validatedParams);
    }
    /**
     * @param {BrowsingContextCreateParameters} params
     * @param {BrowsingContextCreateType} params.type
     * @param {BrowsingContextBrowsingContext} [params.referenceContext]
     * @param {boolean} [params.background]
     * @param {BrowserUserContext} [params.userContext]
     * @returns {Promise<BrowsingContextCreateResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-create
     */
    async create(params) {
        const validatedParams = new BrowsingContextCreateParameters(params);
        const result = await this.send('browsingContext.create', validatedParams);
        return BrowsingContextCreateResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextGetTreeParameters} params
     * @param {JsUint} [params.maxDepth]
     * @param {BrowsingContextBrowsingContext} [params.root]
     * @returns {Promise<BrowsingContextGetTreeResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-getTree
     */
    async getTree(params) {
        const validatedParams = new BrowsingContextGetTreeParameters(params);
        const result = await this.send('browsingContext.getTree', validatedParams);
        return BrowsingContextGetTreeResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextHandleUserPromptParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {boolean} [params.accept]
     * @param {string} [params.userText]
     * @returns {Promise<void>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-handleUserPrompt
     */
    async handleUserPrompt(params) {
        const validatedParams = new BrowsingContextHandleUserPromptParameters(params);
        await this.send('browsingContext.handleUserPrompt', validatedParams);
    }
    /**
     * @param {BrowsingContextLocateNodesParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {BrowsingContextLocator} params.locator
     * @param {JsUint} [params.maxNodeCount]
     * @param {ScriptSerializationOptions} [params.serializationOptions]
     * @param {Array<ScriptSharedReference>} [params.startNodes]
     * @returns {Promise<BrowsingContextLocateNodesResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-locateNodes
     */
    async locateNodes(params) {
        const validatedParams = new BrowsingContextLocateNodesParameters(params);
        const result = await this.send('browsingContext.locateNodes', validatedParams);
        return BrowsingContextLocateNodesResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextNavigateParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {string} params.url
     * @param {BrowsingContextReadinessState} [params.wait]
     * @returns {Promise<BrowsingContextNavigateResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-navigate
     */
    async navigate(params) {
        const validatedParams = new BrowsingContextNavigateParameters(params);
        const result = await this.send('browsingContext.navigate', validatedParams);
        return BrowsingContextNavigateResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextPrintParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {boolean} [params.background]
     * @param {BrowsingContextPrintMarginParameters} [params.margin]
     * @param {BrowsingContextPrintParametersOrientation} [params.orientation]
     * @param {BrowsingContextPrintPageParameters} [params.page]
     * @param {Array<JsUint | string>} [params.pageRanges]
     * @param {number} [params.scale]
     * @param {boolean} [params.shrinkToFit]
     * @returns {Promise<BrowsingContextPrintResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-print
     */
    async print(params) {
        const validatedParams = new BrowsingContextPrintParameters(params);
        const result = await this.send('browsingContext.print', validatedParams);
        return BrowsingContextPrintResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextReloadParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {boolean} [params.ignoreCache]
     * @param {BrowsingContextReadinessState} [params.wait]
     * @returns {Promise<BrowsingContextReloadResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-reload
     */
    async reload(params) {
        const validatedParams = new BrowsingContextReloadParameters(params);
        const result = await this.send('browsingContext.reload', validatedParams);
        return BrowsingContextNavigateResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextSetBypassCspParameters} params
     * @param {true | null} params.bypass
     * @param {Array<BrowsingContextBrowsingContext>} [params.contexts]
     * @param {Array<BrowserUserContext>} [params.userContexts]
     * @returns {Promise<void>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-setBypassCSP
     */
    async setBypassCSP(params) {
        const validatedParams = new BrowsingContextSetBypassCspParameters(params);
        await this.send('browsingContext.setBypassCSP', validatedParams);
    }
    /**
     * @param {BrowsingContextSetViewportParameters} params
     * @param {BrowsingContextBrowsingContext} [params.context]
     * @param {BrowsingContextViewport | null} [params.viewport]
     * @param {number | null} [params.devicePixelRatio]
     * @param {Array<BrowserUserContext>} [params.userContexts]
     * @returns {Promise<void>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-setViewport
     */
    async setViewport(params) {
        const validatedParams = new BrowsingContextSetViewportParameters(params);
        await this.send('browsingContext.setViewport', validatedParams);
    }
    /**
     * @param {BrowsingContextStartScreencastParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {string} [params.destinationFolder]
     * @param {string} [params.mimeType]
     * @param {BrowsingContextMediaTrackConstraints} [params.video]
     * @param {boolean} [params.audio]
     * @returns {Promise<BrowsingContextStartScreencastResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-startScreencast
     */
    async startScreencast(params) {
        const validatedParams = new BrowsingContextStartScreencastParameters(params);
        const result = await this.send('browsingContext.startScreencast', validatedParams);
        return BrowsingContextStartScreencastResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextStopScreencastParameters} params
     * @param {BrowsingContextScreencast} params.screencast
     * @returns {Promise<BrowsingContextStopScreencastResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-stopScreencast
     */
    async stopScreencast(params) {
        const validatedParams = new BrowsingContextStopScreencastParameters(params);
        const result = await this.send('browsingContext.stopScreencast', validatedParams);
        return BrowsingContextStopScreencastResult.fromWire(result);
    }
    /**
     * @param {BrowsingContextTraverseHistoryParameters} params
     * @param {BrowsingContextBrowsingContext} params.context
     * @param {JsInt} params.delta
     * @returns {Promise<void>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-traverseHistory
     */
    async traverseHistory(params) {
        const validatedParams = new BrowsingContextTraverseHistoryParameters(params);
        await this.send('browsingContext.traverseHistory', validatedParams);
    }
}
exports.BrowsingContext = BrowsingContext;
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-contextCreated */
BrowsingContext.CONTEXT_CREATED = (0, domain_js_1.event)('browsingContext.contextCreated', BrowsingContextContextCreatedParameters);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-contextDestroyed */
BrowsingContext.CONTEXT_DESTROYED = (0, domain_js_1.event)('browsingContext.contextDestroyed', BrowsingContextInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-domContentLoaded */
BrowsingContext.DOM_CONTENT_LOADED = (0, domain_js_1.event)('browsingContext.domContentLoaded', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-downloadEnd */
BrowsingContext.DOWNLOAD_END = (0, domain_js_1.event)('browsingContext.downloadEnd', BrowsingContextDownloadEndParamsUnion);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-downloadWillBegin */
BrowsingContext.DOWNLOAD_WILL_BEGIN = (0, domain_js_1.event)('browsingContext.downloadWillBegin', BrowsingContextDownloadWillBeginParams);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-fragmentNavigated */
BrowsingContext.FRAGMENT_NAVIGATED = (0, domain_js_1.event)('browsingContext.fragmentNavigated', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-historyUpdated */
BrowsingContext.HISTORY_UPDATED = (0, domain_js_1.event)('browsingContext.historyUpdated', BrowsingContextHistoryUpdatedParameters);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-load */
BrowsingContext.LOAD = (0, domain_js_1.event)('browsingContext.load', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-navigationAborted */
BrowsingContext.NAVIGATION_ABORTED = (0, domain_js_1.event)('browsingContext.navigationAborted', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-navigationCommitted */
BrowsingContext.NAVIGATION_COMMITTED = (0, domain_js_1.event)('browsingContext.navigationCommitted', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-navigationFailed */
BrowsingContext.NAVIGATION_FAILED = (0, domain_js_1.event)('browsingContext.navigationFailed', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-navigationStarted */
BrowsingContext.NAVIGATION_STARTED = (0, domain_js_1.event)('browsingContext.navigationStarted', BrowsingContextNavigationInfo);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-userPromptClosed */
BrowsingContext.USER_PROMPT_CLOSED = (0, domain_js_1.event)('browsingContext.userPromptClosed', BrowsingContextUserPromptClosedParameters);
/** @see https://w3c.github.io/webdriver-bidi/#event-browsingContext-userPromptOpened */
BrowsingContext.USER_PROMPT_OPENED = (0, domain_js_1.event)('browsingContext.userPromptOpened', BrowsingContextUserPromptOpenedParameters);
BrowsingContext.ReadinessState = Object.freeze({ NONE: "none", INTERACTIVE: "interactive", COMPLETE: "complete" });
BrowsingContext.UserPromptType = Object.freeze({ ALERT: "alert", BEFOREUNLOAD: "beforeunload", CONFIRM: "confirm", PROMPT: "prompt" });
BrowsingContext.CreateType = Object.freeze({ TAB: "tab", WINDOW: "window" });
BrowsingContext.InnerTextLocatorMatchType = Object.freeze({ FULL: "full", PARTIAL: "partial" });
BrowsingContext.CaptureScreenshotParametersOrigin = Object.freeze({ VIEWPORT: "viewport", DOCUMENT: "document" });
BrowsingContext.PrintParametersOrientation = Object.freeze({ PORTRAIT: "portrait", LANDSCAPE: "landscape" });
/**
 * moz: vendor variant of BrowsingContext, with browser-specific commands and params.
 * Construct with MozBrowsingContext.create(driver) for a matching session; other sessions use BrowsingContext.
 *
 * This is an unsupported API. No compatibility guarantees are provided.
 * It tracks the W3C WebDriver BiDi specification directly. As the specification
 * evolves, this API will change or be removed without prior notice.
 */
class MozBrowsingContext extends BrowsingContext {
    static async create(driver) {
        return new MozBrowsingContext(await domain_js_1.Domain.connect(driver), domain_js_1.DOMAIN_TOKEN);
    }
    /**
     * @param {BrowsingContextMozGetTreeParameters} params
     * @param {JsUint} [params.maxDepth]
     * @param {BrowsingContextBrowsingContext} [params.root]
     * @param {"chrome" | "content"} [params.scope]
     * @returns {Promise<BrowsingContextGetTreeResult>}
     * @see https://w3c.github.io/webdriver-bidi/#command-browsingContext-getTree
     */
    async getTree(params) {
        const validatedParams = new BrowsingContextMozGetTreeParameters(params);
        const result = await this.send('browsingContext.getTree', validatedParams);
        return BrowsingContextGetTreeResult.fromWire(result);
    }
}
exports.MozBrowsingContext = MozBrowsingContext;