@letsscrapedata/controller 0.0.1

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.
@@ -0,0 +1,1133 @@
1
+ import EventEmitter from 'node:events';
2
+ import { Browser as Browser$1, BrowserContext as BrowserContext$1, Frame as Frame$1, Page as Page$1, HTTPResponse, ElementHandle } from 'puppeteer';
3
+ import { Browser, BrowserContext, Frame, Page, Response, Locator } from 'playwright';
4
+ import * as cheerio from 'cheerio';
5
+
6
+ /**
7
+ * 命名规则:为了与playwright/puppeteer中的同名区别
8
+ * 1. 类型type的名称:AllXxxYyy,如AllBrowserContext
9
+ * 2. 接口interface的名称: InterfaceXxxYyy,如InterfaceBrowserContext
10
+ * 3. 接口的实现类class的名称: LsdXxxYyy,如LsdBrowserContext
11
+ */
12
+
13
+ type AllBrowser = Browser | Browser$1;
14
+ type AllBrowserContext = BrowserContext | BrowserContext$1;
15
+ type AllFrame = Frame | Frame$1;
16
+ type AllPage = Page | Page$1;
17
+ type AllResponse = Response | HTTPResponse;
18
+ type CheerioNode = cheerio.Cheerio<cheerio.Element>;
19
+ type Proxy = {
20
+ server: string;
21
+ username?: string;
22
+ password?: string;
23
+ proxyId?: string;
24
+ host?: string;
25
+ port?: number;
26
+ expireTime?: number;
27
+ proxyIpType?: string;
28
+ proxyDurationType?: string;
29
+ proxySharedType?: string;
30
+ latitude?: number;
31
+ longitude?: number;
32
+ freeable?: boolean;
33
+ interfaceName?: string;
34
+ packageName?: string;
35
+ };
36
+ type BrowserControllerType = "puppeteer" | "playwright";
37
+ type BrowserCreationMethod = "launch" | "connect";
38
+ type LsdBrowserType = "chromium" | "firefox" | "webkit";
39
+ type BrowserControllerOptions = {
40
+ browserControllerType: BrowserControllerType;
41
+ };
42
+ declare const defaultProxy: Proxy;
43
+ interface BrowserOptions {
44
+ /**
45
+ * Interval between closing free pages (seconds) if more than 0
46
+ * @default 300
47
+ */
48
+ closeFreePagesIntervalSeconds?: number;
49
+ /**
50
+ * max browserContexts per browser
51
+ * @default 10
52
+ */
53
+ maxBrowserContextsPerBrowser?: number;
54
+ /**
55
+ * max pages per browserContext
56
+ * @default 20
57
+ */
58
+ maxPagesPerBrowserContext?: number;
59
+ /**
60
+ * pages, that are free more than this, will be closed
61
+ * @default 900
62
+ */
63
+ maxPageFreeSeconds?: number;
64
+ /**
65
+ * The proxy actually used by the connected browser; for efficient web scraping, please pass an accurate value
66
+ * * this will used as default proxy when creating new browserContexts later
67
+ * @default null
68
+ */
69
+ proxy?: Proxy | null;
70
+ /**
71
+ * Maximum time in milliseconds to wait for the browser instance to start. Pass 0 to disable timeout.
72
+ * * default 30_000 (30 seconds)
73
+ */
74
+ timeout?: number;
75
+ }
76
+ interface LsdLaunchOptions extends BrowserOptions {
77
+ args?: string[];
78
+ executablePath?: string;
79
+ /**
80
+ * @default true
81
+ */
82
+ headless?: boolean;
83
+ /** * @default false for puppeteer, true for playwright
84
+ */
85
+ incognito?: boolean;
86
+ /**
87
+ * workaround for chromium issue on windows: https://github.com/microsoft/playwright/issues/17252 (same in puppeteer)
88
+ * @default false
89
+ */
90
+ proxyPerBrowserContext?: boolean;
91
+ /**
92
+ * userAgent of the new browserContext that is created during launching the browser, valid only in puppeteer:
93
+ * * playwright does not create a browserContext during launching browser
94
+ * * puppeteer creates a default/new browserContext during launching browser
95
+ */
96
+ userAgent?: string;
97
+ userDataDir?: string;
98
+ }
99
+ interface LsdConnectOptions extends BrowserOptions {
100
+ /**
101
+ * url that starts with "http://", such as "http://localhost:9222/"
102
+ */
103
+ browserUrl: string;
104
+ /**
105
+ * executable path of connected browser, optional
106
+ * @default "" that means unkown
107
+ */
108
+ executablePath?: string;
109
+ /**
110
+ * whether the connected browser is headless
111
+ * @default false
112
+ */
113
+ headless?: boolean;
114
+ /**
115
+ * whether the connected browser is headless
116
+ * @default false
117
+ */
118
+ incognito?: boolean;
119
+ /**
120
+ * userAgent of the current browserContexts that were created before connecting to the browser, valid only in puppeteer:
121
+ * * playwright: does not support page.setUserAgent
122
+ * * puppeteer: supports page.setUserAgent
123
+ */
124
+ userAgent?: string;
125
+ }
126
+ type LsdBrowserContextOptions = {
127
+ proxy: Proxy | null;
128
+ /**
129
+ * userAgent of the browserContext:
130
+ * * playwright: set when creating the new browserContext
131
+ * * puppeteer: set when creating the new page in the browserContext
132
+ */
133
+ userAgent?: string;
134
+ fingerPrint: Object;
135
+ };
136
+ type PageStatus = "free" | "busy" | "closed";
137
+ /**
138
+ * newpage: open by browserContext.newPage()
139
+ * popup: open by clicking etc, 主要关注此类
140
+ * manual: open by manual operation
141
+ * launch: open by puppeteer.launch
142
+ * connect: opened pages before connecting to browser
143
+ * other: unkown
144
+ */
145
+ /**
146
+ * * launch: open when creating browserContext(includes launching browser)
147
+ * * connect: open before connected
148
+ * * newpage: open by browserContext.newPage()
149
+ * * popup: popup page
150
+ * * manual: open by adding new page manually
151
+ * * other:
152
+ */
153
+ type PageOpenType = "newpage" | "popup" | "manual" | "launch" | "connect" | "other";
154
+ type PageInfo = {
155
+ /**
156
+ * browser index in all browsers, that starts from 1
157
+ * @default 0
158
+ */
159
+ browserIdx: number;
160
+ /**
161
+ * browserContext index in the same browser, that starts from 1
162
+ * @default 0
163
+ */
164
+ browserContextIdx: number;
165
+ /**
166
+ * page index in the same browserContext, that starts from 1
167
+ * @default 0
168
+ */
169
+ pageIdx: number;
170
+ /**
171
+ * how the page is opened
172
+ * @default other
173
+ */
174
+ openType: PageOpenType;
175
+ /**
176
+ * page添加时间:针对非connect场景,也是page打开时间
177
+ * @default current unix time
178
+ */
179
+ openTime: number;
180
+ /**
181
+ * 上次status变化时间:如果status为free,表示空闲开始时间;如果status为busy,表示TE开始数据
182
+ * @default current unix time
183
+ */
184
+ lastStatusUpdateTime: number;
185
+ /**
186
+ * 正在执行的task的ID,参见enumSpecialTaskId
187
+ * @default 0
188
+ */
189
+ taskId: number;
190
+ };
191
+ interface PageExtInPuppeteer extends Page$1 {
192
+ pageInfo?: PageInfo;
193
+ }
194
+ interface PageExtInPlaywright extends Page {
195
+ pageInfo?: PageInfo;
196
+ }
197
+ interface MouseClickOptions {
198
+ /**
199
+ * Which button will be pressed.
200
+ * @default left
201
+ */
202
+ button?: "left" | "right" | "middle";
203
+ /**
204
+ * Number of clicks to perform.
205
+ * * puppeteer: count (clickCount deprecated)
206
+ * @default 1
207
+ */
208
+ clickCount?: 1 | 2 | 3;
209
+ /**
210
+ * Time to wait between mousedown and mouseup in milliseconds.
211
+ * @default 0
212
+ */
213
+ delay?: number;
214
+ /**
215
+ * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
216
+ * * puppeteer: offset
217
+ */
218
+ position?: {
219
+ x: number;
220
+ y: number;
221
+ };
222
+ /**
223
+ * @default []
224
+ * * puppeteer: not supported, ignored
225
+ */
226
+ modifiers?: Array<"Alt" | "Control" | "Meta" | "Shift">;
227
+ }
228
+ interface SelectOptions {
229
+ /**
230
+ * Which attribute of select option to match
231
+ */
232
+ type: "value" | "label" | "index";
233
+ /**
234
+ * Matches by option.value
235
+ */
236
+ values?: string[];
237
+ /**
238
+ * Matches by the index, that starts from 0
239
+ */
240
+ indexes?: number[];
241
+ /**
242
+ * Matches by option.label
243
+ */
244
+ labels?: string[];
245
+ }
246
+ interface GotoOptions {
247
+ referer?: string;
248
+ timeout?: number;
249
+ /**
250
+ * playwright: "load" | "domcontentloaded" | "networkidle" | "commit", "networkidle0" | "networkidle2" => "networkidle";
251
+ * puppeteer: "load" | "domcontentloaded" | "networkidle0" | "networkidle2", "networkidle" => "networkidle0", "commit" ignored;
252
+ */
253
+ waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit" | "networkidle0" | "networkidle2";
254
+ }
255
+ /**
256
+ * * src takes precedence over selector, at least one of them must be defined
257
+ * * it is recommended to use srcPrefix because selector is valid only in puppeteer
258
+ */
259
+ interface IframeOption {
260
+ /**
261
+ * * string: iframe.src starts with this string
262
+ * * RegExp: iframe.src matches this RegExp
263
+ */
264
+ src?: string | RegExp;
265
+ /**
266
+ * CSS selector or XPath
267
+ */
268
+ selector?: string;
269
+ }
270
+ type KeyInput = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'Power' | 'Eject' | 'Abort' | 'Help' | 'Backspace' | 'Tab' | 'Numpad5' | 'NumpadEnter' | 'Enter' | '\r' | '\n' | 'ShiftLeft' | 'ShiftRight' | 'ControlLeft' | 'ControlRight' | 'AltLeft' | 'AltRight' | 'Pause' | 'CapsLock' | 'Escape' | 'Convert' | 'NonConvert' | 'Space' | 'Numpad9' | 'PageUp' | 'Numpad3' | 'PageDown' | 'End' | 'Numpad1' | 'Home' | 'Numpad7' | 'ArrowLeft' | 'Numpad4' | 'Numpad8' | 'ArrowUp' | 'ArrowRight' | 'Numpad6' | 'Numpad2' | 'ArrowDown' | 'Select' | 'Open' | 'PrintScreen' | 'Insert' | 'Numpad0' | 'Delete' | 'NumpadDecimal' | 'Digit0' | 'Digit1' | 'Digit2' | 'Digit3' | 'Digit4' | 'Digit5' | 'Digit6' | 'Digit7' | 'Digit8' | 'Digit9' | 'KeyA' | 'KeyB' | 'KeyC' | 'KeyD' | 'KeyE' | 'KeyF' | 'KeyG' | 'KeyH' | 'KeyI' | 'KeyJ' | 'KeyK' | 'KeyL' | 'KeyM' | 'KeyN' | 'KeyO' | 'KeyP' | 'KeyQ' | 'KeyR' | 'KeyS' | 'KeyT' | 'KeyU' | 'KeyV' | 'KeyW' | 'KeyX' | 'KeyY' | 'KeyZ' | 'MetaLeft' | 'MetaRight' | 'ContextMenu' | 'NumpadMultiply' | 'NumpadAdd' | 'NumpadSubtract' | 'NumpadDivide' | 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12' | 'F13' | 'F14' | 'F15' | 'F16' | 'F17' | 'F18' | 'F19' | 'F20' | 'F21' | 'F22' | 'F23' | 'F24' | 'NumLock' | 'ScrollLock' | 'AudioVolumeMute' | 'AudioVolumeDown' | 'AudioVolumeUp' | 'MediaTrackNext' | 'MediaTrackPrevious' | 'MediaStop' | 'MediaPlayPause' | 'Semicolon' | 'Equal' | 'NumpadEqual' | 'Comma' | 'Minus' | 'Period' | 'Slash' | 'Backquote' | 'BracketLeft' | 'Backslash' | 'BracketRight' | 'Quote' | 'AltGraph' | 'Props' | 'Cancel' | 'Clear' | 'Shift' | 'Control' | 'Alt' | 'Accept' | 'ModeChange' | ' ' | 'Print' | 'Execute' | '\u0000' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'Meta' | '*' | '+' | '-' | '/' | ';' | '=' | ',' | '.' | '`' | '[' | '\\' | ']' | "'" | 'Attn' | 'CrSel' | 'ExSel' | 'EraseEof' | 'Play' | 'ZoomOut' | ')' | '!' | '@' | '#' | '$' | '%' | '^' | '&' | '(' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | ':' | '<' | '_' | '>' | '?' | '~' | '{' | '|' | '}' | '"' | 'SoftLeft' | 'SoftRight' | 'Camera' | 'Call' | 'EndCall' | 'VolumeDown' | 'VolumeUp';
271
+ interface KeyPressOptions {
272
+ /**
273
+ * Time to wait between keydown and keyup in milliseconds. Defaults to 0.
274
+ */
275
+ delay?: number;
276
+ }
277
+ interface InputOptions {
278
+ /**
279
+ * Time to wait between mousedown and mouseup in milliseconds.
280
+ * * playwright: not supported, ignored
281
+ * @default 0
282
+ */
283
+ delay?: number;
284
+ /**
285
+ * whether to replace the current value
286
+ * @default false
287
+ */
288
+ replace?: boolean;
289
+ /**
290
+ * whether to press Enter after input the value
291
+ * @default false
292
+ */
293
+ enter?: boolean;
294
+ }
295
+ interface LsdElement {
296
+ /**
297
+ *
298
+ * @return the value of a specified attribute on the element
299
+ * @param attributeName
300
+ */
301
+ attribute(attributeName: string): Promise<string>;
302
+ /**
303
+ * @returns the attribute names of the element
304
+ */
305
+ attributeNames(): Promise<string[]>;
306
+ /**
307
+ * @returns the first element matching the given CSS selector or XPath
308
+ * @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
309
+ * @param iframeOptions default [], options to select decendant frame
310
+ * @param absolute valid only if iframeOptions.length===0
311
+ */
312
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
313
+ /**
314
+ * @returns elements matching the given CSS selector or XPath
315
+ * @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
316
+ * @param iframeOptions default [], options to select decendant frame
317
+ * @param absolute valid only if iframeOptions.length===0
318
+ */
319
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
320
+ /**
321
+ * @returns whether the element has the specified attribute or not
322
+ * @param attributeName
323
+ */
324
+ hasAttribute(attributeName: string): Promise<boolean>;
325
+ /**
326
+ * @returns the HTML or XML markup contained within the element
327
+ */
328
+ innerHtml(): Promise<string>;
329
+ /**
330
+ * @returns innerText of element
331
+ * @param onlyChild default false, whether to include only the text of the child text nodes
332
+ */
333
+ innerText(onlyChild?: boolean): Promise<string>;
334
+ /**
335
+ * @returns the serialized HTML fragment describing the element including its descendants
336
+ */
337
+ outerHtml(): Promise<string>;
338
+ textContent(): Promise<string>;
339
+ /**
340
+ * Click this element.
341
+ * @param options default {button: "left", count: 1, delay: 0, modifies: []}
342
+ */
343
+ click(options?: MouseClickOptions): Promise<boolean>;
344
+ focus(): Promise<boolean>;
345
+ hover(): Promise<boolean>;
346
+ /**
347
+ * * playwright: fill
348
+ * * puppeteer: type
349
+ */
350
+ input(value: string, options?: InputOptions): Promise<boolean>;
351
+ press(key: KeyInput, options: KeyPressOptions): Promise<boolean>;
352
+ select(options: SelectOptions): Promise<boolean>;
353
+ screenshot(options?: ScreenshotOptions): Promise<Buffer>;
354
+ scrollBy(x: number, y: number): Promise<boolean>;
355
+ scrollIntoView(): Promise<boolean>;
356
+ scrollTo(x: number, y: number): Promise<boolean>;
357
+ }
358
+ interface ViewportSize {
359
+ height: number;
360
+ width: number;
361
+ }
362
+ interface CookieItem {
363
+ name: string;
364
+ value: string;
365
+ domain: string;
366
+ path: string;
367
+ expires: number;
368
+ httpOnly: boolean;
369
+ secure: boolean;
370
+ sameSite: 'Strict' | 'Lax' | 'None';
371
+ }
372
+ interface LocalStorageItem {
373
+ name: string;
374
+ value: string;
375
+ }
376
+ interface LocalStorageOrigin {
377
+ origin: string;
378
+ localStorage: LocalStorageItem[];
379
+ }
380
+ interface StateData {
381
+ cookies: CookieItem[];
382
+ localStorage: LocalStorageOrigin[];
383
+ }
384
+ /**
385
+ * copy from playwright
386
+ export type URLMatch = string | RegExp | ((url: URL) => boolean);
387
+ export type RouteHandlerCallback = (route: RouteInPlaywright, request: RequestInPlayWright) => Promise<any> | void;
388
+
389
+ export type RequestHandlerCallback = (request: RequestInPlayWright) => Promise<any> | void;
390
+ */
391
+ type RequestResourceType = "document" | "stylesheet" | "image" | "media" | "font" | "script" | "texttrack" | "xhr" | "fetch" | "eventsource" | "websocket" | "manifest" | "other";
392
+ type RequestMethod = "DELETE" | "GET" | "POST" | "PUT" | "CONNECT" | "HEAD" | "OPTIONS" | "PATCH" | "TRACE";
393
+ interface RequestMatch {
394
+ methods?: RequestMethod[];
395
+ postData?: RegExp;
396
+ resourceTypes?: RequestResourceType[];
397
+ url?: RegExp;
398
+ }
399
+ type RequestInterceptionAction = "abort" | "fulfill";
400
+ interface RequestInterceptionOption {
401
+ /**
402
+ * Requests that match all conditions will be intercepted; all requests will be intercepted if no condition.
403
+ */
404
+ requestMatch?: RequestMatch;
405
+ action: RequestInterceptionAction;
406
+ /**
407
+ * required when action is "fulfill"
408
+ */
409
+ fulfill?: string;
410
+ }
411
+ interface ResponseMatch {
412
+ /**
413
+ * min length of response.text()
414
+ */
415
+ minLength?: number;
416
+ /**
417
+ * max length of response.text()
418
+ */
419
+ maxLength?: number;
420
+ }
421
+ type ResponseHandlerOptions = Record<string, any>;
422
+ type ResponseHandler = (response: AllResponse, options?: ResponseHandlerOptions) => Promise<void> | void;
423
+ interface ResponseInterceptionItem {
424
+ /**
425
+ * page.url()
426
+ */
427
+ pageUrl: string;
428
+ /**
429
+ * request.method()
430
+ */
431
+ requestMethod: RequestMethod;
432
+ /**
433
+ * request.url()
434
+ */
435
+ rquestUrl: string;
436
+ /**
437
+ * request.postData()
438
+ */
439
+ requestData: string;
440
+ /**
441
+ * response.text()
442
+ */
443
+ resposeData: string;
444
+ }
445
+ interface ResponseInterceptionOption {
446
+ requestMatch?: RequestMatch;
447
+ responseMatch?: ResponseMatch;
448
+ /**
449
+ * the ResponseInterceptionData will be pushed into this array if Array.isArray(cacheArray)
450
+ */
451
+ cacheArray?: Array<any>;
452
+ /**
453
+ * handler will be called if handler is a function
454
+ */
455
+ handler?: ResponseHandler;
456
+ handlerOptions?: ResponseHandlerOptions;
457
+ }
458
+ interface PDFMargin {
459
+ top?: string | number;
460
+ bottom?: string | number;
461
+ left?: string | number;
462
+ right?: string | number;
463
+ }
464
+ /**
465
+ * @public
466
+ */
467
+ type LowerCasePaperFormat = 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
468
+ /**
469
+ * All the valid paper format types when printing a PDF.
470
+ *
471
+ * @remarks
472
+ *
473
+ * The sizes of each format are as follows:
474
+ *
475
+ * - `Letter`: 8.5in x 11in
476
+ *
477
+ * - `Legal`: 8.5in x 14in
478
+ *
479
+ * - `Tabloid`: 11in x 17in
480
+ *
481
+ * - `Ledger`: 17in x 11in
482
+ *
483
+ * - `A0`: 33.1in x 46.8in
484
+ *
485
+ * - `A1`: 23.4in x 33.1in
486
+ *
487
+ * - `A2`: 16.54in x 23.4in
488
+ *
489
+ * - `A3`: 11.7in x 16.54in
490
+ *
491
+ * - `A4`: 8.27in x 11.7in
492
+ *
493
+ * - `A5`: 5.83in x 8.27in
494
+ *
495
+ * - `A6`: 4.13in x 5.83in
496
+ *
497
+ * @public
498
+ */
499
+ type PaperFormat = Uppercase<LowerCasePaperFormat> | Capitalize<LowerCasePaperFormat> | LowerCasePaperFormat;
500
+ /**
501
+ * Valid options to configure PDF generation via {@link Page.pdf}.
502
+ * @public
503
+ */
504
+ interface PDFOptions {
505
+ /**
506
+ * Whether to show the header and footer.
507
+ * @defaultValue `false`
508
+ */
509
+ displayHeaderFooter?: boolean;
510
+ /**
511
+ * HTML template for the print footer. Has the same constraints and support
512
+ * for special classes as {@link PDFOptions | PDFOptions.headerTemplate}.
513
+ */
514
+ footerTemplate?: string;
515
+ /**
516
+ * @remarks
517
+ * If set, this takes priority over the `width` and `height` options.
518
+ * @defaultValue `letter`.
519
+ */
520
+ format?: PaperFormat;
521
+ /**
522
+ * HTML template for the print header. Should be valid HTML with the following
523
+ * classes used to inject values into them:
524
+ *
525
+ * - `date` formatted print date
526
+ *
527
+ * - `title` document title
528
+ *
529
+ * - `url` document location
530
+ *
531
+ * - `pageNumber` current page number
532
+ *
533
+ * - `totalPages` total pages in the document
534
+ */
535
+ headerTemplate?: string;
536
+ /**
537
+ * Sets the height of paper. You can pass in a number or a string with a unit.
538
+ */
539
+ height?: string | number;
540
+ /**
541
+ * Whether to print in landscape orientation.
542
+ * @defaultValue `false`
543
+ */
544
+ landscape?: boolean;
545
+ /**
546
+ * Set the PDF margins.
547
+ * @defaultValue `undefined` no margins are set.
548
+ */
549
+ margin?: PDFMargin;
550
+ /**
551
+ * Hides default white background and allows generating pdfs with transparency.
552
+ * @defaultValue `false`
553
+ */
554
+ /**
555
+ * Generate document outline.
556
+ *
557
+ * @remarks
558
+ * If this is enabled the PDF will also be tagged (accessible)
559
+ * Currently only works in old Headless (headless = 'shell')
560
+ * crbug/840455#c47
561
+ *
562
+ * @defaultValue `false`
563
+ * @experimental
564
+ */
565
+ outline?: boolean;
566
+ /**
567
+ * Paper ranges to print, e.g. `1-5, 8, 11-13`.
568
+ * @defaultValue The empty string, which means all pages are printed.
569
+ */
570
+ pageRanges?: string;
571
+ /**
572
+ * The path to save the file to.
573
+ *
574
+ * @remarks
575
+ *
576
+ * If the path is relative, it's resolved relative to the current working directory.
577
+ *
578
+ * @defaultValue `undefined`, which means the PDF will not be written to disk.
579
+ */
580
+ path?: string;
581
+ /**
582
+ * Give any CSS `@page` size declared in the page priority over what is
583
+ * declared in the `width` or `height` or `format` option.
584
+ * @defaultValue `false`, which will scale the content to fit the paper size.
585
+ */
586
+ preferCSSPageSize?: boolean;
587
+ /**
588
+ * Set to `true` to print background graphics.
589
+ * @defaultValue `false`
590
+ */
591
+ printBackground?: boolean;
592
+ /**
593
+ * Scales the rendering of the web page. Amount must be between `0.1` and `2`.
594
+ * @defaultValue `1`
595
+ */
596
+ scale?: number;
597
+ /**
598
+ * Generate tagged (accessible) PDF.
599
+ * @defaultValue `true`
600
+ * @experimental
601
+ */
602
+ tagged?: boolean;
603
+ /**
604
+ * Timeout in milliseconds. Pass `0` to disable timeout.
605
+ * @defaultValue `30_000`
606
+ */
607
+ /**
608
+ * Sets the width of paper. You can pass in a number or a string with a unit.
609
+ */
610
+ width?: string | number;
611
+ }
612
+ /**
613
+ * @public
614
+ * not supported by puppeteer: animations, caret, mask, maskColor, scale, style, timeout
615
+ */
616
+ interface ScreenshotOptions {
617
+ /**
618
+ * Capture the screenshot beyond the viewport.
619
+ *
620
+ * @defaultValue `false` if there is no `clip`. `true` otherwise.
621
+ */
622
+ /**
623
+ * Specifies the region of the page to clip.
624
+ */
625
+ clip?: {
626
+ /**
627
+ * x-coordinate of top-left corner of clip area
628
+ */
629
+ x: number;
630
+ /**
631
+ * y-coordinate of top-left corner of clip area
632
+ */
633
+ y: number;
634
+ /**
635
+ * the width of the element in pixels.
636
+ */
637
+ width: number;
638
+ /**
639
+ * the height of the element in pixels.
640
+ */
641
+ height: number;
642
+ };
643
+ /**
644
+ * Encoding of the image.
645
+ *
646
+ * @defaultValue `'binary'`
647
+ */
648
+ /**
649
+ * Capture the screenshot from the surface, rather than the view.
650
+ *
651
+ * @defaultValue `true`
652
+ */
653
+ /**
654
+ * When `true`, takes a screenshot of the full page.
655
+ *
656
+ * @defaultValue `false`
657
+ */
658
+ fullPage?: boolean;
659
+ /**
660
+ * Hides default white background and allows capturing screenshots with transparency.
661
+ *
662
+ * @defaultValue `false`
663
+ */
664
+ omitBackground?: boolean;
665
+ /**
666
+ * @defaultValue `false`
667
+ */
668
+ /**
669
+ * Quality of the image, between 0-100. Not applicable to `png` images.
670
+ */
671
+ quality?: number;
672
+ /**
673
+ * The file path to save the image to. The screenshot type will be inferred
674
+ * from file extension. If path is a relative path, then it is resolved
675
+ * relative to current working directory. If no path is provided, the image
676
+ * won't be saved to the disk.
677
+ */
678
+ path?: string;
679
+ /**
680
+ * @defaultValue `'png'`
681
+ */
682
+ type?: 'png' | 'jpeg';
683
+ }
684
+ interface LsdPage extends EventEmitter {
685
+ bringToFront(): Promise<boolean>;
686
+ browserContext(): LsdBrowserContext;
687
+ clearCookies(): Promise<boolean>;
688
+ clearLocalStorage(): Promise<boolean>;
689
+ /**
690
+ * Clear all request interceptions on the page
691
+ */
692
+ clearRequestInterceptions(): Promise<boolean>;
693
+ /**
694
+ * Clear all response interceptions on the page
695
+ */
696
+ clearResponseInterceptions(): Promise<boolean>;
697
+ clearStateData(): Promise<boolean>;
698
+ /**
699
+ * Only free page can be closed!
700
+ */
701
+ close(): Promise<boolean>;
702
+ /**
703
+ * Get the full HTML content of the page or decendant frame
704
+ * @param iframeOptions default [], selectors of decendant frames
705
+ */
706
+ content(iframeOptions?: IframeOption[]): Promise<string>;
707
+ cookies(): Promise<CookieItem[]>;
708
+ /**
709
+ * @returns the first element matching the given CSS selector or XPath
710
+ * @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
711
+ * @param iframeOptions default [], options to select decendant frame
712
+ */
713
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
714
+ /**
715
+ * @returns elements matching the given CSS selector or XPath
716
+ * @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
717
+ * @param iframeOptions default [], options to select decendant frame
718
+ */
719
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
720
+ /**
721
+ * Free a busy page. All request and response interceptions will be cleared.
722
+ */
723
+ free(): Promise<boolean>;
724
+ /**
725
+ * @returns whether the element has the specified attribute or not
726
+ * @param attributeName
727
+ */
728
+ goto(url: string, options?: GotoOptions): Promise<boolean>;
729
+ id(): string;
730
+ isFree(): boolean;
731
+ /**
732
+ * valid only in CheerioPage
733
+ */
734
+ load(html: string): boolean;
735
+ localStroage(): Promise<LocalStorageOrigin[]>;
736
+ mainFrame(): AllFrame;
737
+ maximizeViewport(): Promise<boolean>;
738
+ pageHeight(): Promise<number>;
739
+ pageInfo(): PageInfo;
740
+ pageWidth(): Promise<number>;
741
+ pdf(options?: PDFOptions): Promise<boolean>;
742
+ screenshot(options?: ScreenshotOptions): Promise<Buffer>;
743
+ setCookies(cookies: CookieItem[]): Promise<boolean>;
744
+ setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
745
+ /**
746
+ * set localStorage on the current web page(page.url())
747
+ * @param localStorageItems
748
+ */
749
+ setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
750
+ setPageInfo(pageInfo: PageInfo): boolean;
751
+ /**
752
+ * Intercept requests that meet the conditions(requestMatch) to perform an action(action and fulfill).
753
+ * @param options
754
+ */
755
+ setRequestInterception(options: RequestInterceptionOption | RequestInterceptionOption[]): Promise<boolean>;
756
+ /**
757
+ * Intercept responses that meet the conditions(requestMatch and responseMatch) to perform actions(cacheArray and handler )
758
+ * @param options
759
+ */
760
+ setResponseInterception(options: ResponseInterceptionOption | ResponseInterceptionOption[]): Promise<boolean>;
761
+ /**
762
+ * Shortcut for LsdPage.browserContext().setStateData(stateData)
763
+ * @param stateData
764
+ */
765
+ setStateData(stateData: StateData): Promise<boolean>;
766
+ setUserAgent(userAgent: string): Promise<boolean>;
767
+ setViewportSize(viewPortSize: ViewportSize): Promise<boolean>;
768
+ stateData(): Promise<StateData>;
769
+ status(): PageStatus;
770
+ title(): Promise<string>;
771
+ url(): string;
772
+ /**
773
+ * 开始使用该page(当前状态必须为free)
774
+ */
775
+ use(): boolean;
776
+ /**
777
+ * obj=window?.[key1]...?.[keyn]
778
+ * @return obj ? JSON.stringify(obj) : ""
779
+ * @param keys
780
+ */
781
+ windowMember(keys: string[]): Promise<string>;
782
+ }
783
+ interface LsdBrowserContext extends EventEmitter {
784
+ browser(): LsdBrowser;
785
+ close(): Promise<boolean>;
786
+ /**
787
+ * close pages that are free more than maxPageFreeSeconds if maxPageFreeSeconds > 0
788
+ * * but the last page in the browserContext will not be closed
789
+ * @default 0 the default maxPageFreeSeconds of the browserContext will be used
790
+ */
791
+ closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
792
+ /**
793
+ * 获取一个page供执行TE(可能从空闲的page中获取,也可能新建一个page)
794
+ * * TBD:需要预留pageQuota给需要capName的TE使用
795
+ */
796
+ getPage(): Promise<LsdPage | null>;
797
+ /**
798
+ * 是否可以获取新page(现有空闲的或新建page)
799
+ * @param pageNum default 1,需要的pages数量
800
+ */
801
+ hasNewPage(pageNum?: number): boolean;
802
+ id(): string;
803
+ isIncognito(): boolean;
804
+ pages(): LsdPage[];
805
+ proxy(): Proxy | null;
806
+ setStateData(stateData: StateData): Promise<boolean>;
807
+ _origBrowserContext(): AllBrowserContext | null;
808
+ }
809
+ interface LsdBrowser extends EventEmitter {
810
+ newBrowserContext(options?: LsdBrowserContextOptions): Promise<LsdBrowserContext | null>;
811
+ close(): Promise<boolean>;
812
+ browserContexts(): LsdBrowserContext[];
813
+ browserControllerType(): BrowserControllerType;
814
+ browserCreationMethod(): BrowserCreationMethod;
815
+ browserType(): LsdBrowserType;
816
+ executablePath(): string;
817
+ id(): string;
818
+ isConnected(): boolean;
819
+ isHeadless(): boolean;
820
+ options(): LsdLaunchOptions | LsdConnectOptions;
821
+ version(): Promise<string>;
822
+ _origBrowserContexts(): AllBrowserContext[];
823
+ }
824
+ interface LsdBrowserController {
825
+ launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdLaunchOptions): Promise<LsdBrowser>;
826
+ connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdConnectOptions): Promise<LsdBrowser>;
827
+ }
828
+ /**
829
+ * globObj.cfg.XXX:
830
+ * 1. 最大browser数:
831
+ * 2. 最大browserContext数/browser:
832
+ * 3. 最大page数/browserContext:
833
+ *
834
+ * 影响一个browserContext是否满足执行某TE(taskCfg)要求的因素包括:
835
+ * 1. domainCfg/taskCfg对代理的要求:proxyTypes:
836
+ * 2. domainCfg/taskCfg对浏览器的要求:
837
+ * * browserControllerTypes: playwright | puppeteer
838
+ * * browserTypes: chromium | firefox | webkit
839
+ * * browserModes: normal | incognito
840
+ * * browserHeads: headless | headful
841
+ * * APP支持的浏览器因素:globObj.cfg.supportedBrowserControllerTypes/supportedBrowserTypes(尝试启动新浏览器时判断)
842
+ * 3. 能力账号:capName
843
+ *
844
+ * 连接已有浏览器:
845
+ * * endpoint:
846
+ * * browserControllerTypes: playwright | puppeteer
847
+ * * browserType: chromium | firefox | webkit
848
+ * * browserMode: normal
849
+ * * browserHead: headful
850
+ * * proxyTypes:
851
+ */
852
+ interface BrowserManager {
853
+ getPage(): any;
854
+ }
855
+
856
+ declare class PlaywrightBrowser extends EventEmitter implements LsdBrowser {
857
+ #private;
858
+ constructor(browser: Browser, browerType: LsdBrowserType, browserCreateMethod: BrowserCreationMethod, options: LsdLaunchOptions | LsdConnectOptions, browserIdx?: number);
859
+ newBrowserContext(options?: LsdBrowserContextOptions): Promise<LsdBrowserContext | null>;
860
+ close(): Promise<boolean>;
861
+ browserContexts(): LsdBrowserContext[];
862
+ browserControllerType(): BrowserControllerType;
863
+ browserCreationMethod(): BrowserCreationMethod;
864
+ browserType(): LsdBrowserType;
865
+ executablePath(): string;
866
+ id(): string;
867
+ isConnected(): boolean;
868
+ isHeadless(): boolean;
869
+ options(): LsdLaunchOptions | LsdConnectOptions;
870
+ version(): Promise<string>;
871
+ _origBrowserContexts(): AllBrowserContext[];
872
+ }
873
+
874
+ declare class PlaywrightBrowserContext extends EventEmitter implements LsdBrowserContext {
875
+ #private;
876
+ constructor(lsdBrowser: LsdBrowser, browserContext: BrowserContext, incognito?: boolean, proxy?: Proxy | null, browserIdx?: number, browserContextIdx?: number, maxPagesPerBrowserContext?: number, maxPageFreeSeconds?: number);
877
+ browser(): LsdBrowser;
878
+ close(): Promise<boolean>;
879
+ closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
880
+ getPage(): Promise<LsdPage | null>;
881
+ hasNewPage(pageNum?: number): boolean;
882
+ id(): string;
883
+ isIncognito(): boolean;
884
+ pages(): LsdPage[];
885
+ proxy(): Proxy | null;
886
+ setStateData(stateData: StateData): Promise<boolean>;
887
+ _origBrowserContext(): AllBrowserContext | null;
888
+ }
889
+
890
+ declare class PlaywrightPage extends EventEmitter implements LsdPage {
891
+ #private;
892
+ constructor(browserContext: LsdBrowserContext, page: Page, pageInfo?: PageInfo);
893
+ bringToFront(): Promise<boolean>;
894
+ browserContext(): LsdBrowserContext;
895
+ clearCookies(): Promise<boolean>;
896
+ clearLocalStorage(): Promise<boolean>;
897
+ clearRequestInterceptions(): Promise<boolean>;
898
+ clearResponseInterceptions(): Promise<boolean>;
899
+ clearStateData(): Promise<boolean>;
900
+ close(): Promise<boolean>;
901
+ content(iframeOptions?: IframeOption[]): Promise<string>;
902
+ cookies(): Promise<CookieItem[]>;
903
+ documentHeight(): Promise<number>;
904
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
905
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
906
+ free(): Promise<boolean>;
907
+ goto(url: string, options?: GotoOptions | undefined): Promise<boolean>;
908
+ id(): string;
909
+ isFree(): boolean;
910
+ localStroage(): Promise<LocalStorageOrigin[]>;
911
+ load(): boolean;
912
+ mainFrame(): AllFrame;
913
+ maximizeViewport(): Promise<boolean>;
914
+ pageHeight(): Promise<number>;
915
+ pageInfo(): PageInfo;
916
+ pageWidth(): Promise<number>;
917
+ pdf(options?: PDFOptions | undefined): Promise<boolean>;
918
+ screenshot(options?: ScreenshotOptions): Promise<Buffer>;
919
+ setCookies(cookies: CookieItem[]): Promise<boolean>;
920
+ setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
921
+ setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
922
+ setPageInfo(pageInfo: PageInfo): boolean;
923
+ setRequestInterception(options: RequestInterceptionOption | RequestInterceptionOption[]): Promise<boolean>;
924
+ setResponseInterception(options: ResponseInterceptionOption | ResponseInterceptionOption[]): Promise<boolean>;
925
+ setStateData(stateData: StateData): Promise<boolean>;
926
+ setUserAgent(userAgent: string): Promise<boolean>;
927
+ setViewportSize(viewPortSize: ViewportSize): Promise<boolean>;
928
+ stateData(): Promise<StateData>;
929
+ status(): PageStatus;
930
+ title(): Promise<string>;
931
+ url(): string;
932
+ use(): boolean;
933
+ windowMember(keys: string[]): Promise<string>;
934
+ }
935
+
936
+ declare class PlaywrightElement implements LsdElement {
937
+ #private;
938
+ constructor(locator: Locator, frame: Frame);
939
+ attribute(attributeName: string): Promise<string>;
940
+ attributeNames(): Promise<string[]>;
941
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
942
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
943
+ hasAttribute(attributeName: string): Promise<boolean>;
944
+ innerHtml(): Promise<string>;
945
+ innerText(onlyChild?: boolean): Promise<string>;
946
+ outerHtml(): Promise<string>;
947
+ textContent(): Promise<string>;
948
+ click(options?: MouseClickOptions): Promise<boolean>;
949
+ focus(): Promise<boolean>;
950
+ hover(): Promise<boolean>;
951
+ input(value: string, options?: InputOptions): Promise<boolean>;
952
+ press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
953
+ select(options: SelectOptions): Promise<boolean>;
954
+ screenshot(options?: ScreenshotOptions): Promise<Buffer>;
955
+ scrollBy(x: number, y: number): Promise<boolean>;
956
+ scrollIntoView(): Promise<boolean>;
957
+ scrollTo(x: number, y: number): Promise<boolean>;
958
+ }
959
+
960
+ declare class PuppeteerBrowser extends EventEmitter implements LsdBrowser {
961
+ #private;
962
+ constructor(browser: Browser$1, browerType: LsdBrowserType, browserCreateMethod: BrowserCreationMethod, options: LsdLaunchOptions | LsdConnectOptions, browserIdx?: number);
963
+ newBrowserContext(options?: LsdBrowserContextOptions | undefined): Promise<LsdBrowserContext | null>;
964
+ close(): Promise<boolean>;
965
+ browserContexts(): LsdBrowserContext[];
966
+ browserControllerType(): BrowserControllerType;
967
+ browserCreationMethod(): BrowserCreationMethod;
968
+ browserType(): LsdBrowserType;
969
+ executablePath(): string;
970
+ id(): string;
971
+ isConnected(): boolean;
972
+ isHeadless(): boolean;
973
+ options(): LsdLaunchOptions | LsdConnectOptions;
974
+ version(): Promise<string>;
975
+ _origBrowserContexts(): AllBrowserContext[];
976
+ }
977
+
978
+ declare class PuppeteerBrowserContext extends EventEmitter implements LsdBrowserContext {
979
+ #private;
980
+ constructor(lsdBrowser: LsdBrowser, browserContext: BrowserContext$1, incognito?: boolean, proxy?: Proxy | null, browserIdx?: number, browserContextIdx?: number, maxPagesPerBrowserContext?: number, maxPageFreeSeconds?: number, userAgent?: string);
981
+ browser(): LsdBrowser;
982
+ close(): Promise<boolean>;
983
+ closeFreePages(maxPageFreeSeconds?: number): Promise<boolean>;
984
+ getPage(): Promise<LsdPage | null>;
985
+ hasNewPage(pageNum?: number): boolean;
986
+ id(): string;
987
+ isIncognito(): boolean;
988
+ pages(): LsdPage[];
989
+ proxy(): Proxy | null;
990
+ setStateData(stateData: StateData): Promise<boolean>;
991
+ _origBrowserContext(): AllBrowserContext | null;
992
+ }
993
+
994
+ declare class PuppeteerPage extends EventEmitter implements LsdPage {
995
+ #private;
996
+ constructor(browserContext: LsdBrowserContext, page: Page$1, pageInfo?: PageInfo);
997
+ bringToFront(): Promise<boolean>;
998
+ browserContext(): LsdBrowserContext;
999
+ clearCookies(): Promise<boolean>;
1000
+ clearLocalStorage(): Promise<boolean>;
1001
+ clearRequestInterceptions(): Promise<boolean>;
1002
+ clearResponseInterceptions(): Promise<boolean>;
1003
+ clearStateData(): Promise<boolean>;
1004
+ close(): Promise<boolean>;
1005
+ content(iframeOptions?: IframeOption[]): Promise<string>;
1006
+ cookies(): Promise<CookieItem[]>;
1007
+ documentHeight(): Promise<number>;
1008
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
1009
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
1010
+ free(): Promise<boolean>;
1011
+ goto(url: string, options?: GotoOptions | undefined): Promise<boolean>;
1012
+ id(): string;
1013
+ isFree(): boolean;
1014
+ localStroage(): Promise<LocalStorageOrigin[]>;
1015
+ load(): boolean;
1016
+ mainFrame(): AllFrame;
1017
+ maximizeViewport(): Promise<boolean>;
1018
+ pageHeight(): Promise<number>;
1019
+ pageInfo(): PageInfo;
1020
+ pageWidth(): Promise<number>;
1021
+ pdf(options?: PDFOptions | undefined): Promise<boolean>;
1022
+ screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1023
+ setCookies(cookies: CookieItem[]): Promise<boolean>;
1024
+ setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1025
+ setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
1026
+ setPageInfo(pageInfo: PageInfo): boolean;
1027
+ setRequestInterception(options: RequestInterceptionOption | RequestInterceptionOption[]): Promise<boolean>;
1028
+ setResponseInterception(options: ResponseInterceptionOption | ResponseInterceptionOption[]): Promise<boolean>;
1029
+ setStateData(stateData: StateData): Promise<boolean>;
1030
+ setUserAgent(userAgent: string): Promise<boolean>;
1031
+ setViewportSize(viewPortSize: ViewportSize): Promise<boolean>;
1032
+ stateData(): Promise<StateData>;
1033
+ status(): PageStatus;
1034
+ title(): Promise<string>;
1035
+ url(): string;
1036
+ use(): boolean;
1037
+ windowMember(keys: string[]): Promise<string>;
1038
+ }
1039
+
1040
+ declare class PuppeteerElement implements LsdElement {
1041
+ #private;
1042
+ constructor($ele: ElementHandle, frame: Frame$1);
1043
+ attribute(attributeName: string): Promise<string>;
1044
+ attributeNames(): Promise<string[]>;
1045
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
1046
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
1047
+ hasAttribute(attributeName: string): Promise<boolean>;
1048
+ innerHtml(): Promise<string>;
1049
+ innerText(onlyChild?: boolean): Promise<string>;
1050
+ outerHtml(): Promise<string>;
1051
+ textContent(): Promise<string>;
1052
+ click(options?: MouseClickOptions): Promise<boolean>;
1053
+ focus(): Promise<boolean>;
1054
+ hover(): Promise<boolean>;
1055
+ input(value: string, options?: InputOptions): Promise<boolean>;
1056
+ press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
1057
+ select(options: SelectOptions): Promise<boolean>;
1058
+ screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1059
+ scrollBy(x: number, y: number): Promise<boolean>;
1060
+ scrollIntoView(): Promise<boolean>;
1061
+ scrollTo(x: number, y: number): Promise<boolean>;
1062
+ }
1063
+
1064
+ declare class CheerioPage extends EventEmitter implements LsdPage {
1065
+ #private;
1066
+ constructor(html?: string);
1067
+ bringToFront(): Promise<boolean>;
1068
+ browserContext(): LsdBrowserContext;
1069
+ clearCookies(): Promise<boolean>;
1070
+ clearLocalStorage(): Promise<boolean>;
1071
+ clearRequestInterceptions(): Promise<boolean>;
1072
+ clearResponseInterceptions(): Promise<boolean>;
1073
+ clearStateData(): Promise<boolean>;
1074
+ close(): Promise<boolean>;
1075
+ content(): Promise<string>;
1076
+ cookies(): Promise<CookieItem[]>;
1077
+ findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
1078
+ findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
1079
+ free(): Promise<boolean>;
1080
+ goto(): Promise<boolean>;
1081
+ id(): string;
1082
+ isFree(): boolean;
1083
+ load(html: string): boolean;
1084
+ localStroage(): Promise<LocalStorageOrigin[]>;
1085
+ mainFrame(): AllFrame;
1086
+ maximizeViewport(): Promise<boolean>;
1087
+ pageHeight(): Promise<number>;
1088
+ pageInfo(): PageInfo;
1089
+ pageWidth(): Promise<number>;
1090
+ pdf(): Promise<boolean>;
1091
+ screenshot(): Promise<Buffer>;
1092
+ setCookies(): Promise<boolean>;
1093
+ setExtraHTTPHeaders(): Promise<boolean>;
1094
+ setLocalStroage(): Promise<boolean>;
1095
+ setPageInfo(): boolean;
1096
+ setRequestInterception(): Promise<boolean>;
1097
+ setResponseInterception(): Promise<boolean>;
1098
+ setStateData(): Promise<boolean>;
1099
+ setUserAgent(): Promise<boolean>;
1100
+ setViewportSize(): Promise<boolean>;
1101
+ stateData(): Promise<StateData>;
1102
+ status(): PageStatus;
1103
+ title(): Promise<string>;
1104
+ url(): string;
1105
+ use(): boolean;
1106
+ windowMember(): Promise<string>;
1107
+ }
1108
+
1109
+ declare class CheerioElement implements LsdElement {
1110
+ #private;
1111
+ constructor(node: CheerioNode);
1112
+ attribute(attributeName: string): Promise<string>;
1113
+ attributeNames(): Promise<string[]>;
1114
+ findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
1115
+ findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
1116
+ hasAttribute(attributeName: string): Promise<boolean>;
1117
+ innerHtml(): Promise<string>;
1118
+ innerText(): Promise<string>;
1119
+ outerHtml(): Promise<string>;
1120
+ textContent(): Promise<string>;
1121
+ click(): Promise<boolean>;
1122
+ focus(): Promise<boolean>;
1123
+ hover(): Promise<boolean>;
1124
+ input(): Promise<boolean>;
1125
+ press(): Promise<boolean>;
1126
+ select(): Promise<boolean>;
1127
+ screenshot(): Promise<Buffer>;
1128
+ scrollBy(): Promise<boolean>;
1129
+ scrollIntoView(): Promise<boolean>;
1130
+ scrollTo(): Promise<boolean>;
1131
+ }
1132
+
1133
+ export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type PDFMargin, type PDFOptions, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type ViewportSize, defaultProxy };