patchright-core 1.56.1 → 1.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ThirdPartyNotices.txt +3134 -560
- package/bin/install_webkit_wsl.ps1 +1 -3
- package/browsers.json +21 -22
- package/lib/cli/program.js +16 -60
- package/lib/client/api.js +3 -3
- package/lib/client/browser.js +3 -5
- package/lib/client/browserContext.js +62 -8
- package/lib/client/browserType.js +4 -3
- package/lib/client/connection.js +4 -0
- package/lib/client/consoleMessage.js +5 -1
- package/lib/client/electron.js +1 -1
- package/lib/client/elementHandle.js +3 -0
- package/lib/client/events.js +5 -1
- package/lib/client/fetch.js +3 -4
- package/lib/client/frame.js +10 -1
- package/lib/client/locator.js +12 -1
- package/lib/client/network.js +5 -1
- package/lib/client/page.js +31 -6
- package/lib/client/pageAgent.js +64 -0
- package/lib/client/platform.js +3 -0
- package/lib/client/playwright.js +1 -5
- package/lib/client/tracing.js +7 -5
- package/lib/client/worker.js +22 -0
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/inProcessFactory.js +0 -2
- package/lib/mcpBundle.js +84 -0
- package/lib/mcpBundleImpl/index.js +147 -0
- package/lib/protocol/serializers.js +5 -0
- package/lib/protocol/validator.js +112 -50
- package/lib/remote/playwrightServer.js +1 -2
- package/lib/server/agent/actionRunner.js +335 -0
- package/lib/server/agent/actions.js +128 -0
- package/lib/server/agent/codegen.js +111 -0
- package/lib/server/agent/context.js +150 -0
- package/lib/server/agent/expectTools.js +156 -0
- package/lib/server/agent/pageAgent.js +204 -0
- package/lib/server/agent/performTools.js +262 -0
- package/lib/server/agent/tool.js +109 -0
- package/lib/server/android/android.js +1 -1
- package/lib/server/artifact.js +1 -1
- package/lib/server/bidi/bidiBrowser.js +81 -22
- package/lib/server/bidi/bidiChromium.js +9 -13
- package/lib/server/bidi/bidiConnection.js +1 -0
- package/lib/server/bidi/bidiDeserializer.js +116 -0
- package/lib/server/bidi/bidiExecutionContext.js +75 -29
- package/lib/server/bidi/bidiFirefox.js +7 -9
- package/lib/server/bidi/bidiNetworkManager.js +1 -1
- package/lib/server/bidi/bidiPage.js +61 -30
- package/lib/server/bidi/third_party/bidiProtocolCore.js +1 -0
- package/lib/server/browserContext.js +43 -36
- package/lib/server/browserType.js +12 -4
- package/lib/server/chromium/chromium.js +26 -21
- package/lib/server/chromium/chromiumSwitches.js +12 -3
- package/lib/server/chromium/crBrowser.js +30 -12
- package/lib/server/chromium/crConnection.js +0 -5
- package/lib/server/chromium/crCoverage.js +13 -1
- package/lib/server/chromium/crDevTools.js +0 -2
- package/lib/server/chromium/crNetworkManager.js +107 -18
- package/lib/server/chromium/crPage.js +68 -124
- package/lib/server/chromium/crServiceWorker.js +14 -1
- package/lib/server/codegen/javascript.js +6 -29
- package/lib/server/console.js +5 -1
- package/lib/server/deviceDescriptorsSource.json +56 -56
- package/lib/server/dispatchers/browserContextDispatcher.js +26 -8
- package/lib/server/dispatchers/dispatcher.js +6 -13
- package/lib/server/dispatchers/frameDispatcher.js +1 -1
- package/lib/server/dispatchers/jsHandleDispatcher.js +2 -2
- package/lib/server/dispatchers/pageAgentDispatcher.js +96 -0
- package/lib/server/dispatchers/pageDispatcher.js +14 -22
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -4
- package/lib/server/dom.js +12 -3
- package/lib/server/electron/electron.js +6 -3
- package/lib/server/firefox/ffBrowser.js +10 -20
- package/lib/server/firefox/ffConnection.js +0 -5
- package/lib/server/firefox/ffNetworkManager.js +2 -2
- package/lib/server/firefox/ffPage.js +18 -24
- package/lib/server/firefox/firefox.js +18 -9
- package/lib/server/frameSelectors.js +18 -8
- package/lib/server/frames.js +257 -87
- package/lib/server/input.js +7 -3
- package/lib/server/instrumentation.js +3 -0
- package/lib/server/javascript.js +8 -4
- package/lib/server/launchApp.js +2 -1
- package/lib/server/localUtils.js +4 -8
- package/lib/server/network.js +50 -12
- package/lib/server/page.js +112 -126
- package/lib/server/playwright.js +2 -4
- package/lib/server/progress.js +26 -6
- package/lib/server/recorder/recorderApp.js +80 -101
- package/lib/server/recorder.js +3 -2
- package/lib/server/registry/browserFetcher.js +6 -4
- package/lib/server/registry/index.js +278 -189
- package/lib/server/registry/oopDownloadBrowserMain.js +9 -2
- package/lib/server/screencast.js +190 -0
- package/lib/server/screenshotter.js +6 -0
- package/lib/server/socksClientCertificatesInterceptor.js +1 -1
- package/lib/server/trace/recorder/snapshotter.js +17 -8
- package/lib/server/trace/recorder/snapshotterInjected.js +30 -72
- package/lib/server/trace/recorder/tracing.js +31 -21
- package/lib/server/trace/viewer/traceParser.js +72 -0
- package/lib/server/trace/viewer/traceViewer.js +45 -40
- package/lib/server/utils/comparators.js +3 -25
- package/lib/server/utils/expectUtils.js +87 -2
- package/lib/server/utils/hostPlatform.js +30 -3
- package/lib/server/utils/httpServer.js +5 -20
- package/lib/server/utils/imageUtils.js +141 -0
- package/lib/server/utils/network.js +55 -40
- package/lib/server/utils/nodePlatform.js +6 -0
- package/lib/server/{chromium/videoRecorder.js → videoRecorder.js} +35 -24
- package/lib/server/webkit/webkit.js +5 -16
- package/lib/server/webkit/wkBrowser.js +2 -6
- package/lib/server/webkit/wkConnection.js +1 -6
- package/lib/server/webkit/wkInterceptableRequest.js +29 -1
- package/lib/server/webkit/wkPage.js +76 -51
- package/lib/server/webkit/wkWorkers.js +2 -1
- package/lib/utils/isomorphic/ariaSnapshot.js +63 -0
- package/lib/utils/isomorphic/locatorGenerators.js +24 -8
- package/lib/utils/isomorphic/lruCache.js +51 -0
- package/lib/utils/isomorphic/mimeType.js +1 -1
- package/lib/utils/isomorphic/protocolFormatter.js +3 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +11 -2
- package/lib/utils/isomorphic/stringUtils.js +49 -0
- package/lib/utils/isomorphic/trace/entries.js +16 -0
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +499 -0
- package/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/lib/utils/isomorphic/trace/traceLoader.js +131 -0
- package/lib/utils/isomorphic/trace/traceModel.js +365 -0
- package/lib/utils/isomorphic/trace/traceModernizer.js +400 -0
- package/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +19 -5
- package/lib/utils/isomorphic/yaml.js +84 -0
- package/lib/utils.js +4 -0
- package/lib/utilsBundle.js +1 -1
- package/lib/utilsBundleImpl/index.js +124 -124
- package/lib/vite/htmlReport/index.html +21 -21
- package/lib/vite/recorder/assets/codeMirrorModule-CFUTFUO7.js +32 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-C3UTv-Ge.css → codeMirrorModule-DYBRYzYX.css} +1 -1
- package/lib/vite/recorder/assets/{index-Ri0uHF7I.css → index-BSjZa4pk.css} +1 -1
- package/lib/vite/recorder/assets/index-CVkBxsGf.js +193 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-BVA4h_ZY.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-CjfmcdOz.js +266 -0
- package/lib/vite/traceViewer/{codeMirrorModule.C3UTv-Ge.css → codeMirrorModule.DYBRYzYX.css} +1 -1
- package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +1 -0
- package/lib/vite/traceViewer/index.BVu7tZDe.css +1 -0
- package/lib/vite/traceViewer/index.BtyWtaE-.js +2 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/snapshot.html +3 -3
- package/lib/vite/traceViewer/sw.bundle.js +5 -3
- package/lib/vite/traceViewer/uiMode.fyrXARf2.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +2 -1
- package/types/protocol.d.ts +939 -245
- package/types/types.d.ts +143 -153
- package/lib/client/accessibility.js +0 -49
- package/lib/server/accessibility.js +0 -69
- package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
- package/lib/server/chromium/crAccessibility.js +0 -263
- package/lib/server/firefox/ffAccessibility.js +0 -238
- package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
- package/lib/server/webkit/wkAccessibility.js +0 -237
- package/lib/server/webkit/wsl/webkit-wsl-transport-client.js +0 -74
- package/lib/server/webkit/wsl/webkit-wsl-transport-server.js +0 -113
- package/lib/vite/recorder/assets/codeMirrorModule-RJCXzfmE.js +0 -24
- package/lib/vite/recorder/assets/index-Y-X2TGJv.js +0 -193
- package/lib/vite/traceViewer/assets/codeMirrorModule-rbQPefq7.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-CLbol9XR.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.TQ8_7ybu.css +0 -1
- package/lib/vite/traceViewer/index.I8N9v4jT.css +0 -1
- package/lib/vite/traceViewer/index.zIVi6mN9.js +0 -2
- package/lib/vite/traceViewer/uiMode.B_CpmIpF.js +0 -5
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var bidiDeserializer_exports = {};
|
|
20
|
-
__export(bidiDeserializer_exports, {
|
|
21
|
-
BidiDeserializer: () => BidiDeserializer
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(bidiDeserializer_exports);
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2024 Google Inc.
|
|
27
|
-
* Modifications copyright (c) Microsoft Corporation.
|
|
28
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
29
|
-
*/
|
|
30
|
-
class BidiDeserializer {
|
|
31
|
-
static deserialize(result) {
|
|
32
|
-
if (!result)
|
|
33
|
-
return void 0;
|
|
34
|
-
switch (result.type) {
|
|
35
|
-
case "array":
|
|
36
|
-
return result.value?.map((value) => {
|
|
37
|
-
return BidiDeserializer.deserialize(value);
|
|
38
|
-
});
|
|
39
|
-
case "set":
|
|
40
|
-
return result.value?.reduce((acc, value) => {
|
|
41
|
-
return acc.add(BidiDeserializer.deserialize(value));
|
|
42
|
-
}, /* @__PURE__ */ new Set());
|
|
43
|
-
case "object":
|
|
44
|
-
return result.value?.reduce((acc, tuple) => {
|
|
45
|
-
const { key, value } = BidiDeserializer._deserializeTuple(tuple);
|
|
46
|
-
acc[key] = value;
|
|
47
|
-
return acc;
|
|
48
|
-
}, {});
|
|
49
|
-
case "map":
|
|
50
|
-
return result.value?.reduce((acc, tuple) => {
|
|
51
|
-
const { key, value } = BidiDeserializer._deserializeTuple(tuple);
|
|
52
|
-
return acc.set(key, value);
|
|
53
|
-
}, /* @__PURE__ */ new Map());
|
|
54
|
-
case "promise":
|
|
55
|
-
return {};
|
|
56
|
-
case "regexp":
|
|
57
|
-
return new RegExp(result.value.pattern, result.value.flags);
|
|
58
|
-
case "date":
|
|
59
|
-
return new Date(result.value);
|
|
60
|
-
case "undefined":
|
|
61
|
-
return void 0;
|
|
62
|
-
case "null":
|
|
63
|
-
return null;
|
|
64
|
-
case "number":
|
|
65
|
-
return BidiDeserializer._deserializeNumber(result.value);
|
|
66
|
-
case "bigint":
|
|
67
|
-
return BigInt(result.value);
|
|
68
|
-
case "boolean":
|
|
69
|
-
return Boolean(result.value);
|
|
70
|
-
case "string":
|
|
71
|
-
return result.value;
|
|
72
|
-
}
|
|
73
|
-
throw new Error(`Deserialization of type ${result.type} not supported.`);
|
|
74
|
-
}
|
|
75
|
-
static _deserializeNumber(value) {
|
|
76
|
-
switch (value) {
|
|
77
|
-
case "-0":
|
|
78
|
-
return -0;
|
|
79
|
-
case "NaN":
|
|
80
|
-
return NaN;
|
|
81
|
-
case "Infinity":
|
|
82
|
-
return Infinity;
|
|
83
|
-
case "-Infinity":
|
|
84
|
-
return -Infinity;
|
|
85
|
-
default:
|
|
86
|
-
return value;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
static _deserializeTuple([serializedKey, serializedValue]) {
|
|
90
|
-
const key = typeof serializedKey === "string" ? serializedKey : BidiDeserializer.deserialize(serializedKey);
|
|
91
|
-
const value = BidiDeserializer.deserialize(serializedValue);
|
|
92
|
-
return { key, value };
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
-
0 && (module.exports = {
|
|
97
|
-
BidiDeserializer
|
|
98
|
-
});
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var crAccessibility_exports = {};
|
|
20
|
-
__export(crAccessibility_exports, {
|
|
21
|
-
getAccessibilityTree: () => getAccessibilityTree
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(crAccessibility_exports);
|
|
24
|
-
async function getAccessibilityTree(client, needle) {
|
|
25
|
-
const { nodes } = await client.send("Accessibility.getFullAXTree");
|
|
26
|
-
const tree = CRAXNode.createTree(client, nodes);
|
|
27
|
-
return {
|
|
28
|
-
tree,
|
|
29
|
-
needle: needle ? await tree._findElement(needle) : null
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
class CRAXNode {
|
|
33
|
-
constructor(client, payload) {
|
|
34
|
-
this._children = [];
|
|
35
|
-
this._richlyEditable = false;
|
|
36
|
-
this._editable = false;
|
|
37
|
-
this._focusable = false;
|
|
38
|
-
this._expanded = false;
|
|
39
|
-
this._hidden = false;
|
|
40
|
-
this._client = client;
|
|
41
|
-
this._payload = payload;
|
|
42
|
-
this._name = this._payload.name ? this._payload.name.value : "";
|
|
43
|
-
this._role = this._payload.role ? this._payload.role.value : "Unknown";
|
|
44
|
-
for (const property of this._payload.properties || []) {
|
|
45
|
-
if (property.name === "editable") {
|
|
46
|
-
this._richlyEditable = property.value.value === "richtext";
|
|
47
|
-
this._editable = true;
|
|
48
|
-
}
|
|
49
|
-
if (property.name === "focusable")
|
|
50
|
-
this._focusable = property.value.value;
|
|
51
|
-
if (property.name === "expanded")
|
|
52
|
-
this._expanded = property.value.value;
|
|
53
|
-
if (property.name === "hidden")
|
|
54
|
-
this._hidden = property.value.value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
_isPlainTextField() {
|
|
58
|
-
if (this._richlyEditable)
|
|
59
|
-
return false;
|
|
60
|
-
if (this._editable)
|
|
61
|
-
return true;
|
|
62
|
-
return this._role === "textbox" || this._role === "ComboBox" || this._role === "searchbox";
|
|
63
|
-
}
|
|
64
|
-
_isTextOnlyObject() {
|
|
65
|
-
const role = this._role;
|
|
66
|
-
return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
|
|
67
|
-
}
|
|
68
|
-
_hasFocusableChild() {
|
|
69
|
-
if (this._cachedHasFocusableChild === void 0) {
|
|
70
|
-
this._cachedHasFocusableChild = false;
|
|
71
|
-
for (const child of this._children) {
|
|
72
|
-
if (child._focusable || child._hasFocusableChild()) {
|
|
73
|
-
this._cachedHasFocusableChild = true;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return this._cachedHasFocusableChild;
|
|
79
|
-
}
|
|
80
|
-
children() {
|
|
81
|
-
return this._children;
|
|
82
|
-
}
|
|
83
|
-
async _findElement(element) {
|
|
84
|
-
const objectId = element._objectId;
|
|
85
|
-
const { node: { backendNodeId } } = await this._client.send("DOM.describeNode", { objectId });
|
|
86
|
-
const needle = this.find((node) => node._payload.backendDOMNodeId === backendNodeId);
|
|
87
|
-
return needle || null;
|
|
88
|
-
}
|
|
89
|
-
find(predicate) {
|
|
90
|
-
if (predicate(this))
|
|
91
|
-
return this;
|
|
92
|
-
for (const child of this._children) {
|
|
93
|
-
const result = child.find(predicate);
|
|
94
|
-
if (result)
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
isLeafNode() {
|
|
100
|
-
if (!this._children.length)
|
|
101
|
-
return true;
|
|
102
|
-
if (this._isPlainTextField() || this._isTextOnlyObject())
|
|
103
|
-
return true;
|
|
104
|
-
switch (this._role) {
|
|
105
|
-
case "doc-cover":
|
|
106
|
-
case "graphics-symbol":
|
|
107
|
-
case "img":
|
|
108
|
-
case "Meter":
|
|
109
|
-
case "scrollbar":
|
|
110
|
-
case "slider":
|
|
111
|
-
case "separator":
|
|
112
|
-
case "progressbar":
|
|
113
|
-
return true;
|
|
114
|
-
default:
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
if (this._hasFocusableChild())
|
|
118
|
-
return false;
|
|
119
|
-
if (this._focusable && this._role !== "WebArea" && this._role !== "RootWebArea" && this._name)
|
|
120
|
-
return true;
|
|
121
|
-
if (this._role === "heading" && this._name)
|
|
122
|
-
return true;
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
isControl() {
|
|
126
|
-
switch (this._role) {
|
|
127
|
-
case "button":
|
|
128
|
-
case "checkbox":
|
|
129
|
-
case "ColorWell":
|
|
130
|
-
case "combobox":
|
|
131
|
-
case "DisclosureTriangle":
|
|
132
|
-
case "listbox":
|
|
133
|
-
case "menu":
|
|
134
|
-
case "menubar":
|
|
135
|
-
case "menuitem":
|
|
136
|
-
case "menuitemcheckbox":
|
|
137
|
-
case "menuitemradio":
|
|
138
|
-
case "radio":
|
|
139
|
-
case "scrollbar":
|
|
140
|
-
case "searchbox":
|
|
141
|
-
case "slider":
|
|
142
|
-
case "spinbutton":
|
|
143
|
-
case "switch":
|
|
144
|
-
case "tab":
|
|
145
|
-
case "textbox":
|
|
146
|
-
case "tree":
|
|
147
|
-
return true;
|
|
148
|
-
default:
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
isInteresting(insideControl) {
|
|
153
|
-
const role = this._role;
|
|
154
|
-
if (role === "Ignored" || this._hidden)
|
|
155
|
-
return false;
|
|
156
|
-
if (this._focusable || this._richlyEditable)
|
|
157
|
-
return true;
|
|
158
|
-
if (this.isControl())
|
|
159
|
-
return true;
|
|
160
|
-
if (insideControl)
|
|
161
|
-
return false;
|
|
162
|
-
return this.isLeafNode() && !!this._name;
|
|
163
|
-
}
|
|
164
|
-
normalizedRole() {
|
|
165
|
-
switch (this._role) {
|
|
166
|
-
case "RootWebArea":
|
|
167
|
-
return "WebArea";
|
|
168
|
-
case "StaticText":
|
|
169
|
-
return "text";
|
|
170
|
-
default:
|
|
171
|
-
return this._role;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
serialize() {
|
|
175
|
-
const properties = /* @__PURE__ */ new Map();
|
|
176
|
-
for (const property of this._payload.properties || [])
|
|
177
|
-
properties.set(property.name.toLowerCase(), property.value.value);
|
|
178
|
-
if (this._payload.description)
|
|
179
|
-
properties.set("description", this._payload.description.value);
|
|
180
|
-
const node = {
|
|
181
|
-
role: this.normalizedRole(),
|
|
182
|
-
name: this._payload.name ? this._payload.name.value || "" : ""
|
|
183
|
-
};
|
|
184
|
-
const userStringProperties = [
|
|
185
|
-
"description",
|
|
186
|
-
"keyshortcuts",
|
|
187
|
-
"roledescription",
|
|
188
|
-
"valuetext"
|
|
189
|
-
];
|
|
190
|
-
for (const userStringProperty of userStringProperties) {
|
|
191
|
-
if (!properties.has(userStringProperty))
|
|
192
|
-
continue;
|
|
193
|
-
node[userStringProperty] = properties.get(userStringProperty);
|
|
194
|
-
}
|
|
195
|
-
const booleanProperties = [
|
|
196
|
-
"disabled",
|
|
197
|
-
"expanded",
|
|
198
|
-
"focused",
|
|
199
|
-
"modal",
|
|
200
|
-
"multiline",
|
|
201
|
-
"multiselectable",
|
|
202
|
-
"readonly",
|
|
203
|
-
"required",
|
|
204
|
-
"selected"
|
|
205
|
-
];
|
|
206
|
-
for (const booleanProperty of booleanProperties) {
|
|
207
|
-
if (booleanProperty === "focused" && (this._role === "WebArea" || this._role === "RootWebArea"))
|
|
208
|
-
continue;
|
|
209
|
-
const value = properties.get(booleanProperty);
|
|
210
|
-
if (!value)
|
|
211
|
-
continue;
|
|
212
|
-
node[booleanProperty] = value;
|
|
213
|
-
}
|
|
214
|
-
const numericalProperties = [
|
|
215
|
-
"level",
|
|
216
|
-
"valuemax",
|
|
217
|
-
"valuemin"
|
|
218
|
-
];
|
|
219
|
-
for (const numericalProperty of numericalProperties) {
|
|
220
|
-
if (!properties.has(numericalProperty))
|
|
221
|
-
continue;
|
|
222
|
-
node[numericalProperty] = properties.get(numericalProperty);
|
|
223
|
-
}
|
|
224
|
-
const tokenProperties = [
|
|
225
|
-
"autocomplete",
|
|
226
|
-
"haspopup",
|
|
227
|
-
"invalid",
|
|
228
|
-
"orientation"
|
|
229
|
-
];
|
|
230
|
-
for (const tokenProperty of tokenProperties) {
|
|
231
|
-
const value = properties.get(tokenProperty);
|
|
232
|
-
if (!value || value === "false")
|
|
233
|
-
continue;
|
|
234
|
-
node[tokenProperty] = value;
|
|
235
|
-
}
|
|
236
|
-
const axNode = node;
|
|
237
|
-
if (this._payload.value) {
|
|
238
|
-
if (typeof this._payload.value.value === "string")
|
|
239
|
-
axNode.valueString = this._payload.value.value;
|
|
240
|
-
if (typeof this._payload.value.value === "number")
|
|
241
|
-
axNode.valueNumber = this._payload.value.value;
|
|
242
|
-
}
|
|
243
|
-
if (properties.has("checked"))
|
|
244
|
-
axNode.checked = properties.get("checked") === "true" ? "checked" : properties.get("checked") === "false" ? "unchecked" : "mixed";
|
|
245
|
-
if (properties.has("pressed"))
|
|
246
|
-
axNode.pressed = properties.get("pressed") === "true" ? "pressed" : properties.get("pressed") === "false" ? "released" : "mixed";
|
|
247
|
-
return axNode;
|
|
248
|
-
}
|
|
249
|
-
static createTree(client, payloads) {
|
|
250
|
-
const nodeById = /* @__PURE__ */ new Map();
|
|
251
|
-
for (const payload of payloads)
|
|
252
|
-
nodeById.set(payload.nodeId, new CRAXNode(client, payload));
|
|
253
|
-
for (const node of nodeById.values()) {
|
|
254
|
-
for (const childId of node._payload.childIds || [])
|
|
255
|
-
node._children.push(nodeById.get(childId));
|
|
256
|
-
}
|
|
257
|
-
return nodeById.values().next().value;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
261
|
-
0 && (module.exports = {
|
|
262
|
-
getAccessibilityTree
|
|
263
|
-
});
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var ffAccessibility_exports = {};
|
|
20
|
-
__export(ffAccessibility_exports, {
|
|
21
|
-
getAccessibilityTree: () => getAccessibilityTree
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(ffAccessibility_exports);
|
|
24
|
-
async function getAccessibilityTree(session, needle) {
|
|
25
|
-
const objectId = needle ? needle._objectId : void 0;
|
|
26
|
-
const { tree } = await session.send("Accessibility.getFullAXTree", { objectId });
|
|
27
|
-
const axNode = new FFAXNode(tree);
|
|
28
|
-
return {
|
|
29
|
-
tree: axNode,
|
|
30
|
-
needle: needle ? axNode._findNeedle() : null
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const FFRoleToARIARole = new Map(Object.entries({
|
|
34
|
-
"pushbutton": "button",
|
|
35
|
-
"checkbutton": "checkbox",
|
|
36
|
-
"editcombobox": "combobox",
|
|
37
|
-
"content deletion": "deletion",
|
|
38
|
-
"footnote": "doc-footnote",
|
|
39
|
-
"non-native document": "document",
|
|
40
|
-
"grouping": "group",
|
|
41
|
-
"graphic": "img",
|
|
42
|
-
"content insertion": "insertion",
|
|
43
|
-
"animation": "marquee",
|
|
44
|
-
"flat equation": "math",
|
|
45
|
-
"menupopup": "menu",
|
|
46
|
-
"check menu item": "menuitemcheckbox",
|
|
47
|
-
"radio menu item": "menuitemradio",
|
|
48
|
-
"listbox option": "option",
|
|
49
|
-
"radiobutton": "radio",
|
|
50
|
-
"statusbar": "status",
|
|
51
|
-
"pagetab": "tab",
|
|
52
|
-
"pagetablist": "tablist",
|
|
53
|
-
"propertypage": "tabpanel",
|
|
54
|
-
"entry": "textbox",
|
|
55
|
-
"outline": "tree",
|
|
56
|
-
"tree table": "treegrid",
|
|
57
|
-
"outlineitem": "treeitem"
|
|
58
|
-
}));
|
|
59
|
-
class FFAXNode {
|
|
60
|
-
constructor(payload) {
|
|
61
|
-
this._payload = payload;
|
|
62
|
-
this._children = (payload.children || []).map((x) => new FFAXNode(x));
|
|
63
|
-
this._editable = !!payload.editable;
|
|
64
|
-
this._richlyEditable = this._editable && (payload.tag !== "textarea" && payload.tag !== "input");
|
|
65
|
-
this._focusable = !!payload.focusable;
|
|
66
|
-
this._expanded = !!payload.expanded;
|
|
67
|
-
this._name = this._payload.name;
|
|
68
|
-
this._role = this._payload.role;
|
|
69
|
-
}
|
|
70
|
-
_isPlainTextField() {
|
|
71
|
-
if (this._richlyEditable)
|
|
72
|
-
return false;
|
|
73
|
-
if (this._editable)
|
|
74
|
-
return true;
|
|
75
|
-
return this._role === "entry";
|
|
76
|
-
}
|
|
77
|
-
_isTextOnlyObject() {
|
|
78
|
-
const role = this._role;
|
|
79
|
-
return role === "text leaf" || role === "text" || role === "statictext";
|
|
80
|
-
}
|
|
81
|
-
_hasFocusableChild() {
|
|
82
|
-
if (this._cachedHasFocusableChild === void 0) {
|
|
83
|
-
this._cachedHasFocusableChild = false;
|
|
84
|
-
for (const child of this._children) {
|
|
85
|
-
if (child._focusable || child._hasFocusableChild()) {
|
|
86
|
-
this._cachedHasFocusableChild = true;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return this._cachedHasFocusableChild;
|
|
92
|
-
}
|
|
93
|
-
children() {
|
|
94
|
-
return this._children;
|
|
95
|
-
}
|
|
96
|
-
_findNeedle() {
|
|
97
|
-
if (this._payload.foundObject)
|
|
98
|
-
return this;
|
|
99
|
-
for (const child of this._children) {
|
|
100
|
-
const found = child._findNeedle();
|
|
101
|
-
if (found)
|
|
102
|
-
return found;
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
isLeafNode() {
|
|
107
|
-
if (!this._children.length)
|
|
108
|
-
return true;
|
|
109
|
-
if (this._isPlainTextField() || this._isTextOnlyObject())
|
|
110
|
-
return true;
|
|
111
|
-
switch (this._role) {
|
|
112
|
-
case "graphic":
|
|
113
|
-
case "scrollbar":
|
|
114
|
-
case "slider":
|
|
115
|
-
case "separator":
|
|
116
|
-
case "progressbar":
|
|
117
|
-
return true;
|
|
118
|
-
default:
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
if (this._hasFocusableChild())
|
|
122
|
-
return false;
|
|
123
|
-
if (this._focusable && this._role !== "document" && this._name)
|
|
124
|
-
return true;
|
|
125
|
-
if (this._role === "heading" && this._name)
|
|
126
|
-
return true;
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
isControl() {
|
|
130
|
-
switch (this._role) {
|
|
131
|
-
case "checkbutton":
|
|
132
|
-
case "check menu item":
|
|
133
|
-
case "check rich option":
|
|
134
|
-
case "combobox":
|
|
135
|
-
case "combobox option":
|
|
136
|
-
case "color chooser":
|
|
137
|
-
case "listbox":
|
|
138
|
-
case "listbox option":
|
|
139
|
-
case "listbox rich option":
|
|
140
|
-
case "popup menu":
|
|
141
|
-
case "menupopup":
|
|
142
|
-
case "menuitem":
|
|
143
|
-
case "menubar":
|
|
144
|
-
case "button":
|
|
145
|
-
case "pushbutton":
|
|
146
|
-
case "radiobutton":
|
|
147
|
-
case "radio menuitem":
|
|
148
|
-
case "scrollbar":
|
|
149
|
-
case "slider":
|
|
150
|
-
case "spinbutton":
|
|
151
|
-
case "switch":
|
|
152
|
-
case "pagetab":
|
|
153
|
-
case "entry":
|
|
154
|
-
case "tree table":
|
|
155
|
-
return true;
|
|
156
|
-
default:
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
isInteresting(insideControl) {
|
|
161
|
-
if (this._focusable || this._richlyEditable)
|
|
162
|
-
return true;
|
|
163
|
-
if (this.isControl())
|
|
164
|
-
return true;
|
|
165
|
-
if (insideControl)
|
|
166
|
-
return false;
|
|
167
|
-
return this.isLeafNode() && !!this._name.trim();
|
|
168
|
-
}
|
|
169
|
-
serialize() {
|
|
170
|
-
const node = {
|
|
171
|
-
role: FFRoleToARIARole.get(this._role) || this._role,
|
|
172
|
-
name: this._name || ""
|
|
173
|
-
};
|
|
174
|
-
const userStringProperties = [
|
|
175
|
-
"name",
|
|
176
|
-
"description",
|
|
177
|
-
"roledescription",
|
|
178
|
-
"valuetext",
|
|
179
|
-
"keyshortcuts"
|
|
180
|
-
];
|
|
181
|
-
for (const userStringProperty of userStringProperties) {
|
|
182
|
-
if (!(userStringProperty in this._payload))
|
|
183
|
-
continue;
|
|
184
|
-
node[userStringProperty] = this._payload[userStringProperty];
|
|
185
|
-
}
|
|
186
|
-
const booleanProperties = [
|
|
187
|
-
"disabled",
|
|
188
|
-
"expanded",
|
|
189
|
-
"focused",
|
|
190
|
-
"modal",
|
|
191
|
-
"multiline",
|
|
192
|
-
"multiselectable",
|
|
193
|
-
"readonly",
|
|
194
|
-
"required",
|
|
195
|
-
"selected"
|
|
196
|
-
];
|
|
197
|
-
for (const booleanProperty of booleanProperties) {
|
|
198
|
-
if (this._role === "document" && booleanProperty === "focused")
|
|
199
|
-
continue;
|
|
200
|
-
const value = this._payload[booleanProperty];
|
|
201
|
-
if (!value)
|
|
202
|
-
continue;
|
|
203
|
-
node[booleanProperty] = value;
|
|
204
|
-
}
|
|
205
|
-
const numericalProperties = [
|
|
206
|
-
"level"
|
|
207
|
-
];
|
|
208
|
-
for (const numericalProperty of numericalProperties) {
|
|
209
|
-
if (!(numericalProperty in this._payload))
|
|
210
|
-
continue;
|
|
211
|
-
node[numericalProperty] = this._payload[numericalProperty];
|
|
212
|
-
}
|
|
213
|
-
const tokenProperties = [
|
|
214
|
-
"autocomplete",
|
|
215
|
-
"haspopup",
|
|
216
|
-
"orientation"
|
|
217
|
-
];
|
|
218
|
-
for (const tokenProperty of tokenProperties) {
|
|
219
|
-
const value = this._payload[tokenProperty];
|
|
220
|
-
if (!value || value === "false")
|
|
221
|
-
continue;
|
|
222
|
-
node[tokenProperty] = value;
|
|
223
|
-
}
|
|
224
|
-
const axNode = node;
|
|
225
|
-
axNode.valueString = this._payload.value;
|
|
226
|
-
if ("checked" in this._payload)
|
|
227
|
-
axNode.checked = this._payload.checked === true ? "checked" : this._payload.checked === "mixed" ? "mixed" : "unchecked";
|
|
228
|
-
if ("pressed" in this._payload)
|
|
229
|
-
axNode.pressed = this._payload.pressed === true ? "pressed" : "released";
|
|
230
|
-
if ("invalid" in this._payload)
|
|
231
|
-
axNode.invalid = this._payload.invalid === true ? "true" : "false";
|
|
232
|
-
return axNode;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
236
|
-
0 && (module.exports = {
|
|
237
|
-
getAccessibilityTree
|
|
238
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var inMemorySnapshotter_exports = {};
|
|
20
|
-
__export(inMemorySnapshotter_exports, {
|
|
21
|
-
InMemorySnapshotter: () => InMemorySnapshotter
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(inMemorySnapshotter_exports);
|
|
24
|
-
var import_snapshotStorage = require("../../../../../trace-viewer/src/sw/snapshotStorage");
|
|
25
|
-
var import_utils = require("../../../utils");
|
|
26
|
-
var import_harTracer = require("../../har/harTracer");
|
|
27
|
-
var import_snapshotter = require("../recorder/snapshotter");
|
|
28
|
-
class InMemorySnapshotter {
|
|
29
|
-
constructor(context) {
|
|
30
|
-
this._blobs = /* @__PURE__ */ new Map();
|
|
31
|
-
this._snapshotReadyPromises = /* @__PURE__ */ new Map();
|
|
32
|
-
this._snapshotCount = 0;
|
|
33
|
-
this._snapshotter = new import_snapshotter.Snapshotter(context, this);
|
|
34
|
-
this._harTracer = new import_harTracer.HarTracer(context, null, this, { content: "attach", includeTraceInfo: true, recordRequestOverrides: false, waitForContentOnStop: false });
|
|
35
|
-
this._storage = new import_snapshotStorage.SnapshotStorage();
|
|
36
|
-
}
|
|
37
|
-
async initialize() {
|
|
38
|
-
await this._snapshotter.start();
|
|
39
|
-
this._harTracer.start({ omitScripts: true });
|
|
40
|
-
}
|
|
41
|
-
async reset() {
|
|
42
|
-
await this._snapshotter.reset();
|
|
43
|
-
await this._harTracer.flush();
|
|
44
|
-
this._harTracer.stop();
|
|
45
|
-
this._harTracer.start({ omitScripts: true });
|
|
46
|
-
}
|
|
47
|
-
async dispose() {
|
|
48
|
-
this._snapshotter.dispose();
|
|
49
|
-
await this._harTracer.flush();
|
|
50
|
-
this._harTracer.stop();
|
|
51
|
-
}
|
|
52
|
-
async captureSnapshot(page, callId, snapshotName) {
|
|
53
|
-
if (this._snapshotReadyPromises.has(snapshotName))
|
|
54
|
-
throw new Error("Duplicate snapshot name: " + snapshotName);
|
|
55
|
-
this._snapshotter.captureSnapshot(page, callId, snapshotName).catch(() => {
|
|
56
|
-
});
|
|
57
|
-
const promise = new import_utils.ManualPromise();
|
|
58
|
-
this._snapshotReadyPromises.set(snapshotName, promise);
|
|
59
|
-
return promise;
|
|
60
|
-
}
|
|
61
|
-
onEntryStarted(entry) {
|
|
62
|
-
}
|
|
63
|
-
onEntryFinished(entry) {
|
|
64
|
-
this._storage.addResource("", entry);
|
|
65
|
-
}
|
|
66
|
-
onContentBlob(sha1, buffer) {
|
|
67
|
-
this._blobs.set(sha1, buffer);
|
|
68
|
-
}
|
|
69
|
-
onSnapshotterBlob(blob) {
|
|
70
|
-
this._blobs.set(blob.sha1, blob.buffer);
|
|
71
|
-
}
|
|
72
|
-
onFrameSnapshot(snapshot) {
|
|
73
|
-
++this._snapshotCount;
|
|
74
|
-
const renderer = this._storage.addFrameSnapshot("", snapshot, []);
|
|
75
|
-
this._snapshotReadyPromises.get(snapshot.snapshotName || "")?.resolve(renderer);
|
|
76
|
-
}
|
|
77
|
-
async resourceContentForTest(sha1) {
|
|
78
|
-
return this._blobs.get(sha1);
|
|
79
|
-
}
|
|
80
|
-
snapshotCount() {
|
|
81
|
-
return this._snapshotCount;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
InMemorySnapshotter
|
|
87
|
-
});
|