testplane 8.42.2 → 8.42.4
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/build/package.json +1 -1
- package/build/src/base-testplane.d.ts +3 -1
- package/build/src/base-testplane.js +7 -2
- package/build/src/base-testplane.js.map +1 -1
- package/build/src/browser/cdp/domains/css.d.ts +14 -6
- package/build/src/browser/cdp/domains/css.js +4 -0
- package/build/src/browser/cdp/domains/css.js.map +1 -1
- package/build/src/browser/cdp/domains/debugger.d.ts +1 -1
- package/build/src/browser/cdp/domains/fetch.d.ts +157 -3
- package/build/src/browser/cdp/domains/fetch.js +40 -1
- package/build/src/browser/cdp/domains/fetch.js.map +1 -1
- package/build/src/browser/cdp/domains/network.d.ts +284 -18
- package/build/src/browser/cdp/domains/network.js +64 -1
- package/build/src/browser/cdp/domains/network.js.map +1 -1
- package/build/src/browser/cdp/domains/page.d.ts +378 -0
- package/build/src/browser/cdp/domains/page.js +114 -0
- package/build/src/browser/cdp/domains/page.js.map +1 -0
- package/build/src/browser/cdp/emitter.d.ts +2 -1
- package/build/src/browser/cdp/emitter.js +2 -2
- package/build/src/browser/cdp/emitter.js.map +1 -1
- package/build/src/browser/cdp/index.d.ts +2 -0
- package/build/src/browser/cdp/index.js +15 -10
- package/build/src/browser/cdp/index.js.map +1 -1
- package/build/src/browser/cdp/selectivity/css-selectivity.d.ts +4 -0
- package/build/src/browser/cdp/selectivity/css-selectivity.js +55 -47
- package/build/src/browser/cdp/selectivity/css-selectivity.js.map +1 -1
- package/build/src/browser/cdp/selectivity/index.js +47 -7
- package/build/src/browser/cdp/selectivity/index.js.map +1 -1
- package/build/src/browser/cdp/selectivity/js-selectivity.d.ts +4 -1
- package/build/src/browser/cdp/selectivity/js-selectivity.js +76 -68
- package/build/src/browser/cdp/selectivity/js-selectivity.js.map +1 -1
- package/build/src/browser/cdp/types.d.ts +214 -0
- package/build/src/testplane.d.ts +1 -1
- package/build/src/testplane.js +4 -4
- package/build/src/testplane.js.map +1 -1
- package/build/src/worker/testplane.js +1 -1
- package/build/src/worker/testplane.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,8 +4,71 @@ exports.CDPNetwork = void 0;
|
|
|
4
4
|
const emitter_1 = require("../emitter");
|
|
5
5
|
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/ */
|
|
6
6
|
class CDPNetwork extends emitter_1.CDPEventEmitter {
|
|
7
|
-
constructor() {
|
|
7
|
+
constructor(connection) {
|
|
8
8
|
super();
|
|
9
|
+
this._connection = connection;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @param sessionId result of "Target.attachToTarget"
|
|
13
|
+
* @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-enable
|
|
14
|
+
*/
|
|
15
|
+
async enable(sessionId, params) {
|
|
16
|
+
return this._connection.request("Network.enable", { sessionId, params });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @param sessionId result of "Target.attachToTarget"
|
|
20
|
+
* @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-disable
|
|
21
|
+
*/
|
|
22
|
+
async disable(sessionId) {
|
|
23
|
+
return this._connection.request("Network.disable", { sessionId });
|
|
24
|
+
}
|
|
25
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-clearBrowserCache */
|
|
26
|
+
async clearBrowserCache(sessionId) {
|
|
27
|
+
return this._connection.request("Network.clearBrowserCache", { sessionId });
|
|
28
|
+
}
|
|
29
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-clearBrowserCookies */
|
|
30
|
+
async clearBrowserCookies(sessionId) {
|
|
31
|
+
return this._connection.request("Network.clearBrowserCookies", { sessionId });
|
|
32
|
+
}
|
|
33
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-deleteCookies */
|
|
34
|
+
async deleteCookies(sessionId, params) {
|
|
35
|
+
return this._connection.request("Network.deleteCookies", { sessionId, params });
|
|
36
|
+
}
|
|
37
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-getCookies */
|
|
38
|
+
async getCookies(sessionId, params) {
|
|
39
|
+
return this._connection.request("Network.getCookies", { sessionId, params });
|
|
40
|
+
}
|
|
41
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-getResponseBody */
|
|
42
|
+
async getResponseBody(sessionId, requestId) {
|
|
43
|
+
return this._connection.request("Network.getResponseBody", { sessionId, params: { requestId } });
|
|
44
|
+
}
|
|
45
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-getRequestPostData */
|
|
46
|
+
async getRequestPostData(sessionId, requestId) {
|
|
47
|
+
return this._connection.request("Network.getRequestPostData", { sessionId, params: { requestId } });
|
|
48
|
+
}
|
|
49
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-setBypassServiceWorker */
|
|
50
|
+
async setBypassServiceWorker(sessionId, bypass) {
|
|
51
|
+
return this._connection.request("Network.setBypassServiceWorker", { sessionId, params: { bypass } });
|
|
52
|
+
}
|
|
53
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-setCacheDisabled */
|
|
54
|
+
async setCacheDisabled(sessionId, cacheDisabled) {
|
|
55
|
+
return this._connection.request("Network.setCacheDisabled", { sessionId, params: { cacheDisabled } });
|
|
56
|
+
}
|
|
57
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-setCookie */
|
|
58
|
+
async setCookie(sessionId, params) {
|
|
59
|
+
return this._connection.request("Network.setCookie", { sessionId, params });
|
|
60
|
+
}
|
|
61
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-setCookies */
|
|
62
|
+
async setCookies(sessionId, cookies) {
|
|
63
|
+
return this._connection.request("Network.setCookies", { sessionId, params: { cookies } });
|
|
64
|
+
}
|
|
65
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-setExtraHTTPHeaders */
|
|
66
|
+
async setExtraHTTPHeaders(sessionId, headers) {
|
|
67
|
+
return this._connection.request("Network.setExtraHTTPHeaders", { sessionId, params: { headers } });
|
|
68
|
+
}
|
|
69
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-setUserAgentOverride */
|
|
70
|
+
async setUserAgentOverride(sessionId, params) {
|
|
71
|
+
return this._connection.request("Network.setUserAgentOverride", { sessionId, params });
|
|
9
72
|
}
|
|
10
73
|
}
|
|
11
74
|
exports.CDPNetwork = CDPNetwork;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../../../src/browser/cdp/domains/network.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../../../src/browser/cdp/domains/network.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;AA8Q7C,4EAA4E;AAC5E,MAAa,UAAW,SAAQ,yBAA8B;IAG1D,YAAmB,UAAyB;QACxC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,SAAuB,EAAE,MAAsB;QACxD,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,SAAuB;QACjC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,qGAAqG;IACrG,KAAK,CAAC,iBAAiB,CAAC,SAAuB;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,uGAAuG;IACvG,KAAK,CAAC,mBAAm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EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED,6FAA6F;IAC7F,KAAK,CAAC,SAAS,CAAC,SAAuB,EAAE,MAAwB;QAC7D,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,8FAA8F;IAC9F,KAAK,CAAC,UAAU,CAAC,SAAuB,EAAE,OAAgC;QACtE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,uGAAuG;IACvG,KAAK,CAAC,mBAAmB,CAAC,SAAuB,EAAE,OAA0B;QACzE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,wGAAwG;IACxG,KAAK,CAAC,oBAAoB,CACtB,SAAuB,EACvB,MAAyE;QAEzE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,8BAA8B,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3F,CAAC;CACJ;AA1FD,gCA0FC"}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { CDPEventEmitter } from "../emitter";
|
|
2
|
+
import { CDPConnection } from "../connection";
|
|
3
|
+
import type { CDPExecutionContextId, CDPFrameId, CDPNetworkLoaderId, CDPNetworkMonotonicTime, CDPSessionId } from "../types";
|
|
4
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-ScriptIdentifier */
|
|
5
|
+
type PageScriptIdentifier = string;
|
|
6
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-TransitionType */
|
|
7
|
+
type PageTransitionType = "link" | "typed" | "address_bar" | "auto_bookmark" | "auto_subframe" | "manual_subframe" | "generated" | "auto_toplevel" | "form_submit" | "reload" | "keyword" | "keyword_generated" | "other";
|
|
8
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-DialogType */
|
|
9
|
+
type PageDialogType = "alert" | "confirm" | "prompt" | "beforeunload";
|
|
10
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-Frame */
|
|
11
|
+
interface PageFrame {
|
|
12
|
+
/** Frame unique identifier. */
|
|
13
|
+
id: CDPFrameId;
|
|
14
|
+
/** Parent frame identifier. */
|
|
15
|
+
parentId?: CDPFrameId;
|
|
16
|
+
/** Identifier of the loader associated with this frame. */
|
|
17
|
+
loaderId: CDPNetworkLoaderId;
|
|
18
|
+
/** Frame's name as specified in the tag. */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Frame document's URL without fragment. */
|
|
21
|
+
url: string;
|
|
22
|
+
/** Frame document's security origin. */
|
|
23
|
+
securityOrigin: string;
|
|
24
|
+
/** Frame document's mimeType as determined by the browser. */
|
|
25
|
+
mimeType: string;
|
|
26
|
+
}
|
|
27
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-FrameTree */
|
|
28
|
+
interface PageFrameTree {
|
|
29
|
+
/** Frame information for this tree item. */
|
|
30
|
+
frame: PageFrame;
|
|
31
|
+
/** Child frames. */
|
|
32
|
+
childFrames?: PageFrameTree[];
|
|
33
|
+
}
|
|
34
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-NavigationEntry */
|
|
35
|
+
interface PageNavigationEntry {
|
|
36
|
+
/** Unique id of the navigation history entry. */
|
|
37
|
+
id: number;
|
|
38
|
+
/** URL of the navigation history entry. */
|
|
39
|
+
url: string;
|
|
40
|
+
/** URL that the user typed in the url bar. */
|
|
41
|
+
userTypedURL: string;
|
|
42
|
+
/** Title of the navigation history entry. */
|
|
43
|
+
title: string;
|
|
44
|
+
/** Transition type. */
|
|
45
|
+
transitionType: PageTransitionType;
|
|
46
|
+
}
|
|
47
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-LayoutViewport */
|
|
48
|
+
interface PageLayoutViewport {
|
|
49
|
+
/** Horizontal offset relative to the document (CSS pixels). */
|
|
50
|
+
pageX: number;
|
|
51
|
+
/** Vertical offset relative to the document (CSS pixels). */
|
|
52
|
+
pageY: number;
|
|
53
|
+
/** Width (CSS pixels), excludes scrollbar if present. */
|
|
54
|
+
clientWidth: number;
|
|
55
|
+
/** Height (CSS pixels), excludes scrollbar if present. */
|
|
56
|
+
clientHeight: number;
|
|
57
|
+
}
|
|
58
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-VisualViewport */
|
|
59
|
+
interface PageVisualViewport {
|
|
60
|
+
/** Horizontal offset relative to the layout viewport (CSS pixels). */
|
|
61
|
+
offsetX: number;
|
|
62
|
+
/** Vertical offset relative to the layout viewport (CSS pixels). */
|
|
63
|
+
offsetY: number;
|
|
64
|
+
/** Horizontal offset relative to the document (CSS pixels). */
|
|
65
|
+
pageX: number;
|
|
66
|
+
/** Vertical offset relative to the document (CSS pixels). */
|
|
67
|
+
pageY: number;
|
|
68
|
+
/** Width (CSS pixels), excludes scrollbar if present. */
|
|
69
|
+
clientWidth: number;
|
|
70
|
+
/** Height (CSS pixels), excludes scrollbar if present. */
|
|
71
|
+
clientHeight: number;
|
|
72
|
+
/** Scale relative to the ideal viewport (size at width=device-width). */
|
|
73
|
+
scale: number;
|
|
74
|
+
/** Page zoom factor (CSS to device independent pixels ratio). */
|
|
75
|
+
zoom?: number;
|
|
76
|
+
}
|
|
77
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-Viewport */
|
|
78
|
+
interface PageViewport {
|
|
79
|
+
/** X offset in device independent pixels (dip). */
|
|
80
|
+
x: number;
|
|
81
|
+
/** Y offset in device independent pixels (dip). */
|
|
82
|
+
y: number;
|
|
83
|
+
/** Rectangle width in device independent pixels (dip). */
|
|
84
|
+
width: number;
|
|
85
|
+
/** Rectangle height in device independent pixels (dip). */
|
|
86
|
+
height: number;
|
|
87
|
+
/** Page scale factor. */
|
|
88
|
+
scale: number;
|
|
89
|
+
}
|
|
90
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#type-AppManifestError */
|
|
91
|
+
interface PageAppManifestError {
|
|
92
|
+
/** Error message. */
|
|
93
|
+
message: string;
|
|
94
|
+
/** If critical, this is a non-recoverable parse error. */
|
|
95
|
+
critical: number;
|
|
96
|
+
/** Error line. */
|
|
97
|
+
line: number;
|
|
98
|
+
/** Error column. */
|
|
99
|
+
column: number;
|
|
100
|
+
}
|
|
101
|
+
interface AddScriptToEvaluateOnNewDocumentRequest {
|
|
102
|
+
source: string;
|
|
103
|
+
}
|
|
104
|
+
interface AddScriptToEvaluateOnNewDocumentResponse {
|
|
105
|
+
/** Identifier of the added script. */
|
|
106
|
+
identifier: PageScriptIdentifier;
|
|
107
|
+
}
|
|
108
|
+
interface CaptureScreenshotRequest {
|
|
109
|
+
/** Image compression format (defaults to png). */
|
|
110
|
+
format?: "jpeg" | "png" | "webp";
|
|
111
|
+
/** Compression quality from range [0..100] (jpeg only). */
|
|
112
|
+
quality?: number;
|
|
113
|
+
/** Capture the screenshot of a given region only. */
|
|
114
|
+
clip?: PageViewport;
|
|
115
|
+
}
|
|
116
|
+
interface CaptureScreenshotResponse {
|
|
117
|
+
/** Base64-encoded image data. (Encoded as a base64 string when passed over JSON) */
|
|
118
|
+
data: string;
|
|
119
|
+
}
|
|
120
|
+
interface CreateIsolatedWorldRequest {
|
|
121
|
+
/** Id of the frame in which the isolated world should be created. */
|
|
122
|
+
frameId: CDPFrameId;
|
|
123
|
+
/** An optional name which is reported in the Execution Context. */
|
|
124
|
+
worldName?: string;
|
|
125
|
+
}
|
|
126
|
+
interface CreateIsolatedWorldResponse {
|
|
127
|
+
/** Execution context of the isolated world. */
|
|
128
|
+
executionContextId: CDPExecutionContextId;
|
|
129
|
+
}
|
|
130
|
+
interface GetAppManifestResponse {
|
|
131
|
+
/** Manifest location. */
|
|
132
|
+
url: string;
|
|
133
|
+
errors: PageAppManifestError[];
|
|
134
|
+
/** Manifest content. */
|
|
135
|
+
data?: string;
|
|
136
|
+
}
|
|
137
|
+
interface GetFrameTreeResponse {
|
|
138
|
+
/** Present frame tree structure. */
|
|
139
|
+
frameTree: PageFrameTree;
|
|
140
|
+
}
|
|
141
|
+
interface GetLayoutMetricsResponse {
|
|
142
|
+
/** Deprecated metrics relating to the layout viewport. Is in device pixels. Use `cssLayoutViewport` instead. */
|
|
143
|
+
layoutViewport: PageLayoutViewport;
|
|
144
|
+
/** Deprecated metrics relating to the visual viewport. Is in device pixels. Use `cssVisualViewport` instead. */
|
|
145
|
+
visualViewport: PageVisualViewport;
|
|
146
|
+
/** Deprecated size of scrollable area. Is in DP. Use `cssContentSize` instead. */
|
|
147
|
+
contentSize: {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
};
|
|
153
|
+
/** Metrics relating to the layout viewport in CSS pixels. */
|
|
154
|
+
cssLayoutViewport: PageLayoutViewport;
|
|
155
|
+
/** Metrics relating to the visual viewport in CSS pixels. */
|
|
156
|
+
cssVisualViewport: PageVisualViewport;
|
|
157
|
+
/** Size of scrollable area in CSS pixels. */
|
|
158
|
+
cssContentSize: {
|
|
159
|
+
x: number;
|
|
160
|
+
y: number;
|
|
161
|
+
width: number;
|
|
162
|
+
height: number;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
interface GetNavigationHistoryResponse {
|
|
166
|
+
/** Index of the current navigation history entry. */
|
|
167
|
+
currentIndex: number;
|
|
168
|
+
/** Array of navigation history entries. */
|
|
169
|
+
entries: PageNavigationEntry[];
|
|
170
|
+
}
|
|
171
|
+
interface HandleJavaScriptDialogRequest {
|
|
172
|
+
/** Whether to accept or dismiss the dialog. */
|
|
173
|
+
accept: boolean;
|
|
174
|
+
/** The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog. */
|
|
175
|
+
promptText?: string;
|
|
176
|
+
}
|
|
177
|
+
interface NavigateRequest {
|
|
178
|
+
/** URL to navigate the page to. */
|
|
179
|
+
url: string;
|
|
180
|
+
/** Referrer URL. */
|
|
181
|
+
referrer?: string;
|
|
182
|
+
/** Intended transition type. */
|
|
183
|
+
transitionType?: PageTransitionType;
|
|
184
|
+
/** Frame id to navigate, if not specified navigates the top level frame. */
|
|
185
|
+
frameId?: CDPFrameId;
|
|
186
|
+
}
|
|
187
|
+
interface NavigateResponse {
|
|
188
|
+
/** Frame id that has navigated (or failed to navigate). */
|
|
189
|
+
frameId: CDPFrameId;
|
|
190
|
+
/** Loader identifier. This is omitted in case of same-document navigation, as the previously committed loaderId would not change. */
|
|
191
|
+
loaderId?: CDPNetworkLoaderId;
|
|
192
|
+
/** User friendly error message, present if and only if navigation has failed. */
|
|
193
|
+
errorText?: string;
|
|
194
|
+
}
|
|
195
|
+
interface PrintToPDFRequest {
|
|
196
|
+
/** Paper orientation. Defaults to false. */
|
|
197
|
+
landscape?: boolean;
|
|
198
|
+
/** Display header and footer. Defaults to false. */
|
|
199
|
+
displayHeaderFooter?: boolean;
|
|
200
|
+
/** Print background graphics. Defaults to false. */
|
|
201
|
+
printBackground?: boolean;
|
|
202
|
+
/** Scale of the webpage rendering. Defaults to 1. */
|
|
203
|
+
scale?: number;
|
|
204
|
+
/** Paper width in inches. Defaults to 8.5 inches. */
|
|
205
|
+
paperWidth?: number;
|
|
206
|
+
/** Paper height in inches. Defaults to 11 inches. */
|
|
207
|
+
paperHeight?: number;
|
|
208
|
+
/** Top margin in inches. Defaults to 1cm (~0.4 inches). */
|
|
209
|
+
marginTop?: number;
|
|
210
|
+
/** Bottom margin in inches. Defaults to 1cm (~0.4 inches). */
|
|
211
|
+
marginBottom?: number;
|
|
212
|
+
/** Left margin in inches. Defaults to 1cm (~0.4 inches). */
|
|
213
|
+
marginLeft?: number;
|
|
214
|
+
/** Right margin in inches. Defaults to 1cm (~0.4 inches). */
|
|
215
|
+
marginRight?: number;
|
|
216
|
+
/** Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed in the document order, not in the order specified, and no more than once. Defaults to empty string, which implies the entire document is printed. */
|
|
217
|
+
pageRanges?: string;
|
|
218
|
+
/** HTML template for the print header. Should be valid HTML markup. */
|
|
219
|
+
headerTemplate?: string;
|
|
220
|
+
/** HTML template for the print footer. Should use the same format as the headerTemplate. */
|
|
221
|
+
footerTemplate?: string;
|
|
222
|
+
/** Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. */
|
|
223
|
+
preferCSSPageSize?: boolean;
|
|
224
|
+
}
|
|
225
|
+
interface PrintToPDFResponse {
|
|
226
|
+
/** Base64-encoded pdf data. (Encoded as a base64 string when passed over JSON) */
|
|
227
|
+
data: string;
|
|
228
|
+
}
|
|
229
|
+
interface ReloadRequest {
|
|
230
|
+
/** If true, browser cache is ignored (as if the user pressed Shift+refresh). */
|
|
231
|
+
ignoreCache?: boolean;
|
|
232
|
+
/** If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin. */
|
|
233
|
+
scriptToEvaluateOnLoad?: string;
|
|
234
|
+
}
|
|
235
|
+
interface SetDocumentContentRequest {
|
|
236
|
+
/** Frame id to set HTML for. */
|
|
237
|
+
frameId: CDPFrameId;
|
|
238
|
+
/** HTML content to set. */
|
|
239
|
+
html: string;
|
|
240
|
+
}
|
|
241
|
+
export interface PageEvents {
|
|
242
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-domContentEventFired */
|
|
243
|
+
domContentEventFired: {
|
|
244
|
+
timestamp: CDPNetworkMonotonicTime;
|
|
245
|
+
};
|
|
246
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-fileChooserOpened */
|
|
247
|
+
fileChooserOpened: {
|
|
248
|
+
/** Input mode. */
|
|
249
|
+
mode: "selectSingle" | "selectMultiple";
|
|
250
|
+
};
|
|
251
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-frameAttached */
|
|
252
|
+
frameAttached: {
|
|
253
|
+
/** Id of the frame that has been attached. */
|
|
254
|
+
frameId: CDPFrameId;
|
|
255
|
+
/** Parent frame identifier. */
|
|
256
|
+
parentFrameId: CDPFrameId;
|
|
257
|
+
/** JavaScript stack trace of when frame was attached, only set if frame initiated from script. */
|
|
258
|
+
stack?: Record<string, unknown>;
|
|
259
|
+
};
|
|
260
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-frameDetached */
|
|
261
|
+
frameDetached: {
|
|
262
|
+
/** Id of the frame that has been detached. */
|
|
263
|
+
frameId: CDPFrameId;
|
|
264
|
+
reason: "remove" | "swap";
|
|
265
|
+
};
|
|
266
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-frameNavigated */
|
|
267
|
+
frameNavigated: {
|
|
268
|
+
/** Frame object. */
|
|
269
|
+
frame: PageFrame;
|
|
270
|
+
type: PageTransitionType;
|
|
271
|
+
};
|
|
272
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-interstitialHidden */
|
|
273
|
+
interstitialHidden: Record<string, never>;
|
|
274
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-interstitialShown */
|
|
275
|
+
interstitialShown: Record<string, never>;
|
|
276
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-javascriptDialogClosed */
|
|
277
|
+
javascriptDialogClosed: {
|
|
278
|
+
/** Whether dialog was confirmed. */
|
|
279
|
+
result: boolean;
|
|
280
|
+
/** User input in case of prompt. */
|
|
281
|
+
userInput: string;
|
|
282
|
+
};
|
|
283
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-javascriptDialogOpening */
|
|
284
|
+
javascriptDialogOpening: {
|
|
285
|
+
/** Frame url. */
|
|
286
|
+
url: string;
|
|
287
|
+
/** Message that will be displayed by the dialog. */
|
|
288
|
+
message: string;
|
|
289
|
+
/** Dialog type. */
|
|
290
|
+
type: PageDialogType;
|
|
291
|
+
/** True iff browser is capable showing or acting on the given dialog. When browser has no dialog handler for given target, calling alert while Page domain is engaged will stall the page execution. Execution can be resumed via calling Page.handleJavaScriptDialog. */
|
|
292
|
+
hasBrowserHandler: boolean;
|
|
293
|
+
/** Default dialog prompt. */
|
|
294
|
+
defaultPrompt?: string;
|
|
295
|
+
};
|
|
296
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-lifecycleEvent */
|
|
297
|
+
lifecycleEvent: {
|
|
298
|
+
/** Id of the frame. */
|
|
299
|
+
frameId: CDPFrameId;
|
|
300
|
+
/** Loader identifier. Empty string if the request is fetched from worker. */
|
|
301
|
+
loaderId: CDPNetworkLoaderId;
|
|
302
|
+
name: string;
|
|
303
|
+
timestamp: CDPNetworkMonotonicTime;
|
|
304
|
+
};
|
|
305
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-loadEventFired */
|
|
306
|
+
loadEventFired: {
|
|
307
|
+
timestamp: CDPNetworkMonotonicTime;
|
|
308
|
+
};
|
|
309
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#event-windowOpen */
|
|
310
|
+
windowOpen: {
|
|
311
|
+
/** The URL for the new window. */
|
|
312
|
+
url: string;
|
|
313
|
+
/** Window name. */
|
|
314
|
+
windowName: string;
|
|
315
|
+
/** An array of enabled window features. */
|
|
316
|
+
windowFeatures: string[];
|
|
317
|
+
/** Whether or not it was triggered by user gesture. */
|
|
318
|
+
userGesture: boolean;
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/ */
|
|
322
|
+
export declare class CDPPage extends CDPEventEmitter<PageEvents> {
|
|
323
|
+
private readonly _connection;
|
|
324
|
+
constructor(connection: CDPConnection);
|
|
325
|
+
/**
|
|
326
|
+
* @param sessionId result of "Target.attachToTarget"
|
|
327
|
+
* @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-enable
|
|
328
|
+
*/
|
|
329
|
+
enable(sessionId: CDPSessionId): Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* @param sessionId result of "Target.attachToTarget"
|
|
332
|
+
* @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-disable
|
|
333
|
+
*/
|
|
334
|
+
disable(sessionId: CDPSessionId): Promise<void>;
|
|
335
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-addScriptToEvaluateOnNewDocument */
|
|
336
|
+
addScriptToEvaluateOnNewDocument(sessionId: CDPSessionId, params: AddScriptToEvaluateOnNewDocumentRequest): Promise<AddScriptToEvaluateOnNewDocumentResponse>;
|
|
337
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-removeScriptToEvaluateOnNewDocument */
|
|
338
|
+
removeScriptToEvaluateOnNewDocument(sessionId: CDPSessionId, identifier: PageScriptIdentifier): Promise<void>;
|
|
339
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-bringToFront */
|
|
340
|
+
bringToFront(sessionId: CDPSessionId): Promise<void>;
|
|
341
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-captureScreenshot */
|
|
342
|
+
captureScreenshot(sessionId: CDPSessionId, params?: CaptureScreenshotRequest): Promise<CaptureScreenshotResponse>;
|
|
343
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-close */
|
|
344
|
+
close(sessionId: CDPSessionId): Promise<void>;
|
|
345
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-createIsolatedWorld */
|
|
346
|
+
createIsolatedWorld(sessionId: CDPSessionId, params: CreateIsolatedWorldRequest): Promise<CreateIsolatedWorldResponse>;
|
|
347
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getAppManifest */
|
|
348
|
+
getAppManifest(sessionId: CDPSessionId): Promise<GetAppManifestResponse>;
|
|
349
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getFrameTree */
|
|
350
|
+
getFrameTree(sessionId: CDPSessionId): Promise<GetFrameTreeResponse>;
|
|
351
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getLayoutMetrics */
|
|
352
|
+
getLayoutMetrics(sessionId: CDPSessionId): Promise<GetLayoutMetricsResponse>;
|
|
353
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getNavigationHistory */
|
|
354
|
+
getNavigationHistory(sessionId: CDPSessionId): Promise<GetNavigationHistoryResponse>;
|
|
355
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-resetNavigationHistory */
|
|
356
|
+
resetNavigationHistory(sessionId: CDPSessionId): Promise<void>;
|
|
357
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-handleJavaScriptDialog */
|
|
358
|
+
handleJavaScriptDialog(sessionId: CDPSessionId, params: HandleJavaScriptDialogRequest): Promise<void>;
|
|
359
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-navigate */
|
|
360
|
+
navigate(sessionId: CDPSessionId, params: NavigateRequest): Promise<NavigateResponse>;
|
|
361
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-navigateToHistoryEntry */
|
|
362
|
+
navigateToHistoryEntry(sessionId: CDPSessionId, entryId: number): Promise<void>;
|
|
363
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-printToPDF */
|
|
364
|
+
printToPDF(sessionId: CDPSessionId, params?: PrintToPDFRequest): Promise<PrintToPDFResponse>;
|
|
365
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-reload */
|
|
366
|
+
reload(sessionId: CDPSessionId, params?: ReloadRequest): Promise<void>;
|
|
367
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setBypassCSP */
|
|
368
|
+
setBypassCSP(sessionId: CDPSessionId, enabled: boolean): Promise<void>;
|
|
369
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setDocumentContent */
|
|
370
|
+
setDocumentContent(sessionId: CDPSessionId, params: SetDocumentContentRequest): Promise<void>;
|
|
371
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setInterceptFileChooserDialog */
|
|
372
|
+
setInterceptFileChooserDialog(sessionId: CDPSessionId, enabled: boolean): Promise<void>;
|
|
373
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setLifecycleEventsEnabled */
|
|
374
|
+
setLifecycleEventsEnabled(sessionId: CDPSessionId, enabled: boolean): Promise<void>;
|
|
375
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-stopLoading */
|
|
376
|
+
stopLoading(sessionId: CDPSessionId): Promise<void>;
|
|
377
|
+
}
|
|
378
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDPPage = void 0;
|
|
4
|
+
const emitter_1 = require("../emitter");
|
|
5
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/ */
|
|
6
|
+
class CDPPage extends emitter_1.CDPEventEmitter {
|
|
7
|
+
constructor(connection) {
|
|
8
|
+
super();
|
|
9
|
+
this._connection = connection;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @param sessionId result of "Target.attachToTarget"
|
|
13
|
+
* @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-enable
|
|
14
|
+
*/
|
|
15
|
+
async enable(sessionId) {
|
|
16
|
+
return this._connection.request("Page.enable", { sessionId });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @param sessionId result of "Target.attachToTarget"
|
|
20
|
+
* @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-disable
|
|
21
|
+
*/
|
|
22
|
+
async disable(sessionId) {
|
|
23
|
+
return this._connection.request("Page.disable", { sessionId });
|
|
24
|
+
}
|
|
25
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-addScriptToEvaluateOnNewDocument */
|
|
26
|
+
async addScriptToEvaluateOnNewDocument(sessionId, params) {
|
|
27
|
+
return this._connection.request("Page.addScriptToEvaluateOnNewDocument", { sessionId, params });
|
|
28
|
+
}
|
|
29
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-removeScriptToEvaluateOnNewDocument */
|
|
30
|
+
async removeScriptToEvaluateOnNewDocument(sessionId, identifier) {
|
|
31
|
+
return this._connection.request("Page.removeScriptToEvaluateOnNewDocument", {
|
|
32
|
+
sessionId,
|
|
33
|
+
params: { identifier },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-bringToFront */
|
|
37
|
+
async bringToFront(sessionId) {
|
|
38
|
+
return this._connection.request("Page.bringToFront", { sessionId });
|
|
39
|
+
}
|
|
40
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-captureScreenshot */
|
|
41
|
+
async captureScreenshot(sessionId, params) {
|
|
42
|
+
return this._connection.request("Page.captureScreenshot", { sessionId, params });
|
|
43
|
+
}
|
|
44
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-close */
|
|
45
|
+
async close(sessionId) {
|
|
46
|
+
return this._connection.request("Page.close", { sessionId });
|
|
47
|
+
}
|
|
48
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-createIsolatedWorld */
|
|
49
|
+
async createIsolatedWorld(sessionId, params) {
|
|
50
|
+
return this._connection.request("Page.createIsolatedWorld", { sessionId, params });
|
|
51
|
+
}
|
|
52
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getAppManifest */
|
|
53
|
+
async getAppManifest(sessionId) {
|
|
54
|
+
return this._connection.request("Page.getAppManifest", { sessionId });
|
|
55
|
+
}
|
|
56
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getFrameTree */
|
|
57
|
+
async getFrameTree(sessionId) {
|
|
58
|
+
return this._connection.request("Page.getFrameTree", { sessionId });
|
|
59
|
+
}
|
|
60
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getLayoutMetrics */
|
|
61
|
+
async getLayoutMetrics(sessionId) {
|
|
62
|
+
return this._connection.request("Page.getLayoutMetrics", { sessionId });
|
|
63
|
+
}
|
|
64
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-getNavigationHistory */
|
|
65
|
+
async getNavigationHistory(sessionId) {
|
|
66
|
+
return this._connection.request("Page.getNavigationHistory", { sessionId });
|
|
67
|
+
}
|
|
68
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-resetNavigationHistory */
|
|
69
|
+
async resetNavigationHistory(sessionId) {
|
|
70
|
+
return this._connection.request("Page.resetNavigationHistory", { sessionId });
|
|
71
|
+
}
|
|
72
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-handleJavaScriptDialog */
|
|
73
|
+
async handleJavaScriptDialog(sessionId, params) {
|
|
74
|
+
return this._connection.request("Page.handleJavaScriptDialog", { sessionId, params });
|
|
75
|
+
}
|
|
76
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-navigate */
|
|
77
|
+
async navigate(sessionId, params) {
|
|
78
|
+
return this._connection.request("Page.navigate", { sessionId, params });
|
|
79
|
+
}
|
|
80
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-navigateToHistoryEntry */
|
|
81
|
+
async navigateToHistoryEntry(sessionId, entryId) {
|
|
82
|
+
return this._connection.request("Page.navigateToHistoryEntry", { sessionId, params: { entryId } });
|
|
83
|
+
}
|
|
84
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-printToPDF */
|
|
85
|
+
async printToPDF(sessionId, params) {
|
|
86
|
+
return this._connection.request("Page.printToPDF", { sessionId, params });
|
|
87
|
+
}
|
|
88
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-reload */
|
|
89
|
+
async reload(sessionId, params) {
|
|
90
|
+
return this._connection.request("Page.reload", { sessionId, params });
|
|
91
|
+
}
|
|
92
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setBypassCSP */
|
|
93
|
+
async setBypassCSP(sessionId, enabled) {
|
|
94
|
+
return this._connection.request("Page.setBypassCSP", { sessionId, params: { enabled } });
|
|
95
|
+
}
|
|
96
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setDocumentContent */
|
|
97
|
+
async setDocumentContent(sessionId, params) {
|
|
98
|
+
return this._connection.request("Page.setDocumentContent", { sessionId, params });
|
|
99
|
+
}
|
|
100
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setInterceptFileChooserDialog */
|
|
101
|
+
async setInterceptFileChooserDialog(sessionId, enabled) {
|
|
102
|
+
return this._connection.request("Page.setInterceptFileChooserDialog", { sessionId, params: { enabled } });
|
|
103
|
+
}
|
|
104
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-setLifecycleEventsEnabled */
|
|
105
|
+
async setLifecycleEventsEnabled(sessionId, enabled) {
|
|
106
|
+
return this._connection.request("Page.setLifecycleEventsEnabled", { sessionId, params: { enabled } });
|
|
107
|
+
}
|
|
108
|
+
/** @link https://chromedevtools.github.io/devtools-protocol/1-3/Page/#method-stopLoading */
|
|
109
|
+
async stopLoading(sessionId) {
|
|
110
|
+
return this._connection.request("Page.stopLoading", { sessionId });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.CDPPage = CDPPage;
|
|
114
|
+
//# sourceMappingURL=page.js.map
|
|
@@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AE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,8GAA8G;IAC9G,KAAK,CAAC,6BAA6B,CAAC,SAAuB,EAAE,OAAgB;QACzE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9G,CAAC;IAED,0GAA0G;IAC1G,KAAK,CAAC,yBAAyB,CAAC,SAAuB,EAAE,OAAgB;QACrE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,gCAAgC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED,4FAA4F;IAC5F,KAAK,CAAC,WAAW,CAAC,SAAuB;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACvE,CAAC;CACJ;AAhJD,0BAgJC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
|
+
import { CDPSessionId } from "./types";
|
|
3
4
|
export declare class CDPEventEmitter<Events extends {
|
|
4
5
|
[key in keyof Events]: unknown;
|
|
5
6
|
}> extends EventEmitter {
|
|
6
7
|
private _callbackMap;
|
|
7
|
-
on<U extends string & keyof Events>(event: U, listener: (params: Events[U]) => void | Promise<void>): this;
|
|
8
|
+
on<U extends string & keyof Events>(event: U, listener: (params: Events[U], sessionId?: CDPSessionId) => void | Promise<void>): this;
|
|
8
9
|
off<U extends string & keyof Events>(event: U, listener: (params: Events[U]) => void | Promise<void>): this;
|
|
9
10
|
}
|
|
@@ -33,12 +33,12 @@ class CDPEventEmitter extends events_1.EventEmitter {
|
|
|
33
33
|
}
|
|
34
34
|
on(event, listener) {
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
-
const eventListenerWithErrorBoundary = (params) => {
|
|
36
|
+
const eventListenerWithErrorBoundary = (params, sessionId) => {
|
|
37
37
|
const logError = (e) => {
|
|
38
38
|
logger.error(`Catched unhandled error in CDP "${event}" handler: ${(e && e.stack) || e}`);
|
|
39
39
|
};
|
|
40
40
|
try {
|
|
41
|
-
const result = listener(params);
|
|
41
|
+
const result = listener(params, sessionId);
|
|
42
42
|
return result instanceof Promise ? result.catch(logError) : result;
|
|
43
43
|
}
|
|
44
44
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../../src/browser/cdp/emitter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAC7C,mCAAsC;
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../../src/browser/cdp/emitter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAC7C,mCAAsC;AAMtC,MAAa,eAAmE,SAAQ,qBAAY;IAApG;;QACY,iBAAY,GAA0B,IAAI,GAAG,EAAE,CAAC;IAoC5D,CAAC;IAlCG,EAAE,CACE,KAAQ,EACR,QAA+E;QAE/E,8DAA8D;QAC9D,MAAM,8BAA8B,GAAG,CAAC,MAAiB,EAAE,SAAwB,EAAwB,EAAE;YACzG,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAQ,EAAE;gBAClC,MAAM,CAAC,KAAK,CAAC,mCAAmC,KAAK,cAAc,CAAC,CAAC,IAAK,CAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACzG,CAAC,CAAC;YAEF,IAAI,CAAC;gBACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBAE3C,OAAO,MAAM,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACvE,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,QAAQ,CAAC,CAAC,CAAC,CAAC;YAChB,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC;QAEhE,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;IAC3D,CAAC;IAED,GAAG,CAAkC,KAAQ,EAAE,QAAqD;QAChG,MAAM,8BAA8B,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEvE,IAAI,8BAA8B,EAAE,CAAC;YACjC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AArCD,0CAqCC"}
|
|
@@ -9,6 +9,7 @@ import { CDPDom } from "./domains/dom";
|
|
|
9
9
|
import { CDPCss } from "./domains/css";
|
|
10
10
|
import { CDPNetwork } from "./domains/network";
|
|
11
11
|
import { CDFetch } from "./domains/fetch";
|
|
12
|
+
import { CDPPage } from "./domains/page";
|
|
12
13
|
export declare class CDP {
|
|
13
14
|
private readonly _connection;
|
|
14
15
|
readonly target: CDPTarget;
|
|
@@ -19,6 +20,7 @@ export declare class CDP {
|
|
|
19
20
|
readonly css: CDPCss;
|
|
20
21
|
readonly network: CDPNetwork;
|
|
21
22
|
readonly fetch: CDFetch;
|
|
23
|
+
readonly page: CDPPage;
|
|
22
24
|
static create(browser: Browser): Promise<CDP | null>;
|
|
23
25
|
constructor(connection: CDPConnection);
|
|
24
26
|
request<T = Record<string, unknown>>(method: CDPRequest["method"], params?: CDPRequest["params"] | null, cdpSessionId?: CDPSessionId | null): Promise<T>;
|