@letsscrapedata/controller 0.0.1 → 0.0.3
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/dist/{index.mjs → index.cjs} +293 -184
- package/dist/{index.d.mts → index.d.cts} +67 -19
- package/dist/index.d.ts +67 -19
- package/dist/index.js +273 -204
- package/package.json +3 -2
|
@@ -243,14 +243,15 @@ interface SelectOptions {
|
|
|
243
243
|
*/
|
|
244
244
|
labels?: string[];
|
|
245
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* * playwright: "load" | "domcontentloaded" | "networkidle" | "commit", "networkidle0" | "networkidle2" => "networkidle";
|
|
248
|
+
* * puppeteer: "load" | "domcontentloaded" | "networkidle0" | "networkidle2", "networkidle" => "networkidle0", "commit" ignored;
|
|
249
|
+
*/
|
|
250
|
+
type NavigationWaitUntil = "load" | "domcontentloaded" | "networkidle" | "commit" | "networkidle0" | "networkidle2";
|
|
246
251
|
interface GotoOptions {
|
|
247
252
|
referer?: string;
|
|
248
253
|
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
|
+
waitUntil?: NavigationWaitUntil;
|
|
254
255
|
}
|
|
255
256
|
/**
|
|
256
257
|
* * src takes precedence over selector, at least one of them must be defined
|
|
@@ -351,9 +352,7 @@ interface LsdElement {
|
|
|
351
352
|
press(key: KeyInput, options: KeyPressOptions): Promise<boolean>;
|
|
352
353
|
select(options: SelectOptions): Promise<boolean>;
|
|
353
354
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
354
|
-
scrollBy(x: number, y: number): Promise<boolean>;
|
|
355
355
|
scrollIntoView(): Promise<boolean>;
|
|
356
|
-
scrollTo(x: number, y: number): Promise<boolean>;
|
|
357
356
|
}
|
|
358
357
|
interface ViewportSize {
|
|
359
358
|
height: number;
|
|
@@ -402,9 +401,14 @@ interface RequestInterceptionOption {
|
|
|
402
401
|
* Requests that match all conditions will be intercepted; all requests will be intercepted if no condition.
|
|
403
402
|
*/
|
|
404
403
|
requestMatch?: RequestMatch;
|
|
404
|
+
/**
|
|
405
|
+
* * abort: Aborts the HTTP request
|
|
406
|
+
* * fulfill: Fulfills a request with the value of "fulfill"
|
|
407
|
+
*/
|
|
405
408
|
action: RequestInterceptionAction;
|
|
406
409
|
/**
|
|
407
410
|
* required when action is "fulfill"
|
|
411
|
+
* @default `<html><body><h1>${request.url()}</h1></body></html>`
|
|
408
412
|
*/
|
|
409
413
|
fulfill?: string;
|
|
410
414
|
}
|
|
@@ -432,7 +436,7 @@ interface ResponseInterceptionItem {
|
|
|
432
436
|
/**
|
|
433
437
|
* request.url()
|
|
434
438
|
*/
|
|
435
|
-
|
|
439
|
+
requestUrl: string;
|
|
436
440
|
/**
|
|
437
441
|
* request.postData()
|
|
438
442
|
*/
|
|
@@ -440,7 +444,7 @@ interface ResponseInterceptionItem {
|
|
|
440
444
|
/**
|
|
441
445
|
* response.text()
|
|
442
446
|
*/
|
|
443
|
-
|
|
447
|
+
responseData: string;
|
|
444
448
|
}
|
|
445
449
|
interface ResponseInterceptionOption {
|
|
446
450
|
requestMatch?: RequestMatch;
|
|
@@ -448,7 +452,7 @@ interface ResponseInterceptionOption {
|
|
|
448
452
|
/**
|
|
449
453
|
* the ResponseInterceptionData will be pushed into this array if Array.isArray(cacheArray)
|
|
450
454
|
*/
|
|
451
|
-
|
|
455
|
+
responseItems?: ResponseInterceptionItem[];
|
|
452
456
|
/**
|
|
453
457
|
* handler will be called if handler is a function
|
|
454
458
|
*/
|
|
@@ -681,6 +685,31 @@ interface ScreenshotOptions {
|
|
|
681
685
|
*/
|
|
682
686
|
type?: 'png' | 'jpeg';
|
|
683
687
|
}
|
|
688
|
+
interface WaitElementOptions {
|
|
689
|
+
/**
|
|
690
|
+
* @default 30_000 ms
|
|
691
|
+
*/
|
|
692
|
+
timeout?: number;
|
|
693
|
+
/**
|
|
694
|
+
* @default "visible"
|
|
695
|
+
*/
|
|
696
|
+
state?: "attached" | "detached" | "hidden" | "visible";
|
|
697
|
+
}
|
|
698
|
+
interface WaitNavigationOptions {
|
|
699
|
+
/**
|
|
700
|
+
* only supported in playwright by now
|
|
701
|
+
* @default ""
|
|
702
|
+
*/
|
|
703
|
+
url?: string | RegExp;
|
|
704
|
+
/**
|
|
705
|
+
* @default 30_000 ms
|
|
706
|
+
*/
|
|
707
|
+
timeout?: number;
|
|
708
|
+
/**
|
|
709
|
+
* @default "visible"
|
|
710
|
+
*/
|
|
711
|
+
waitUntil?: NavigationWaitUntil;
|
|
712
|
+
}
|
|
684
713
|
interface LsdPage extends EventEmitter {
|
|
685
714
|
bringToFront(): Promise<boolean>;
|
|
686
715
|
browserContext(): LsdBrowserContext;
|
|
@@ -740,6 +769,8 @@ interface LsdPage extends EventEmitter {
|
|
|
740
769
|
pageWidth(): Promise<number>;
|
|
741
770
|
pdf(options?: PDFOptions): Promise<boolean>;
|
|
742
771
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
772
|
+
scrollBy(x: number, y: number): Promise<boolean>;
|
|
773
|
+
scrollTo(x: number, y: number): Promise<boolean>;
|
|
743
774
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
744
775
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
745
776
|
/**
|
|
@@ -773,6 +804,17 @@ interface LsdPage extends EventEmitter {
|
|
|
773
804
|
* 开始使用该page(当前状态必须为free)
|
|
774
805
|
*/
|
|
775
806
|
use(): boolean;
|
|
807
|
+
/**
|
|
808
|
+
*
|
|
809
|
+
* @param selector CSS selector, not XPath
|
|
810
|
+
* @param options
|
|
811
|
+
*/
|
|
812
|
+
waitForElement(selector: string, options?: WaitElementOptions): Promise<boolean>;
|
|
813
|
+
/**
|
|
814
|
+
*
|
|
815
|
+
* @param options
|
|
816
|
+
*/
|
|
817
|
+
waitForNavigation(options: WaitNavigationOptions): Promise<boolean>;
|
|
776
818
|
/**
|
|
777
819
|
* obj=window?.[key1]...?.[keyn]
|
|
778
820
|
* @return obj ? JSON.stringify(obj) : ""
|
|
@@ -916,6 +958,8 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
|
916
958
|
pageWidth(): Promise<number>;
|
|
917
959
|
pdf(options?: PDFOptions | undefined): Promise<boolean>;
|
|
918
960
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
961
|
+
scrollBy(x: number, y: number): Promise<boolean>;
|
|
962
|
+
scrollTo(x: number, y: number): Promise<boolean>;
|
|
919
963
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
920
964
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
921
965
|
setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
|
|
@@ -930,6 +974,8 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
|
930
974
|
title(): Promise<string>;
|
|
931
975
|
url(): string;
|
|
932
976
|
use(): boolean;
|
|
977
|
+
waitForElement(selector: string, options?: WaitElementOptions): Promise<boolean>;
|
|
978
|
+
waitForNavigation(options: WaitNavigationOptions): Promise<boolean>;
|
|
933
979
|
windowMember(keys: string[]): Promise<string>;
|
|
934
980
|
}
|
|
935
981
|
|
|
@@ -952,9 +998,7 @@ declare class PlaywrightElement implements LsdElement {
|
|
|
952
998
|
press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
|
|
953
999
|
select(options: SelectOptions): Promise<boolean>;
|
|
954
1000
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
955
|
-
scrollBy(x: number, y: number): Promise<boolean>;
|
|
956
1001
|
scrollIntoView(): Promise<boolean>;
|
|
957
|
-
scrollTo(x: number, y: number): Promise<boolean>;
|
|
958
1002
|
}
|
|
959
1003
|
|
|
960
1004
|
declare class PuppeteerBrowser extends EventEmitter implements LsdBrowser {
|
|
@@ -1020,6 +1064,8 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
|
1020
1064
|
pageWidth(): Promise<number>;
|
|
1021
1065
|
pdf(options?: PDFOptions | undefined): Promise<boolean>;
|
|
1022
1066
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
1067
|
+
scrollBy(x: number, y: number): Promise<boolean>;
|
|
1068
|
+
scrollTo(x: number, y: number): Promise<boolean>;
|
|
1023
1069
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
1024
1070
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
1025
1071
|
setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
|
|
@@ -1034,6 +1080,8 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
|
1034
1080
|
title(): Promise<string>;
|
|
1035
1081
|
url(): string;
|
|
1036
1082
|
use(): boolean;
|
|
1083
|
+
waitForElement(selector: string, options?: WaitElementOptions): Promise<boolean>;
|
|
1084
|
+
waitForNavigation(options: WaitNavigationOptions): Promise<boolean>;
|
|
1037
1085
|
windowMember(keys: string[]): Promise<string>;
|
|
1038
1086
|
}
|
|
1039
1087
|
|
|
@@ -1056,9 +1104,7 @@ declare class PuppeteerElement implements LsdElement {
|
|
|
1056
1104
|
press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
|
|
1057
1105
|
select(options: SelectOptions): Promise<boolean>;
|
|
1058
1106
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
1059
|
-
scrollBy(x: number, y: number): Promise<boolean>;
|
|
1060
1107
|
scrollIntoView(): Promise<boolean>;
|
|
1061
|
-
scrollTo(x: number, y: number): Promise<boolean>;
|
|
1062
1108
|
}
|
|
1063
1109
|
|
|
1064
1110
|
declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
@@ -1089,6 +1135,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1089
1135
|
pageWidth(): Promise<number>;
|
|
1090
1136
|
pdf(): Promise<boolean>;
|
|
1091
1137
|
screenshot(): Promise<Buffer>;
|
|
1138
|
+
scrollBy(): Promise<boolean>;
|
|
1139
|
+
scrollTo(): Promise<boolean>;
|
|
1092
1140
|
setCookies(): Promise<boolean>;
|
|
1093
1141
|
setExtraHTTPHeaders(): Promise<boolean>;
|
|
1094
1142
|
setLocalStroage(): Promise<boolean>;
|
|
@@ -1103,6 +1151,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1103
1151
|
title(): Promise<string>;
|
|
1104
1152
|
url(): string;
|
|
1105
1153
|
use(): boolean;
|
|
1154
|
+
waitForElement(): Promise<boolean>;
|
|
1155
|
+
waitForNavigation(): Promise<boolean>;
|
|
1106
1156
|
windowMember(): Promise<string>;
|
|
1107
1157
|
}
|
|
1108
1158
|
|
|
@@ -1111,8 +1161,8 @@ declare class CheerioElement implements LsdElement {
|
|
|
1111
1161
|
constructor(node: CheerioNode);
|
|
1112
1162
|
attribute(attributeName: string): Promise<string>;
|
|
1113
1163
|
attributeNames(): Promise<string[]>;
|
|
1114
|
-
findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
|
|
1115
|
-
findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
|
|
1164
|
+
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
|
|
1165
|
+
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
|
|
1116
1166
|
hasAttribute(attributeName: string): Promise<boolean>;
|
|
1117
1167
|
innerHtml(): Promise<string>;
|
|
1118
1168
|
innerText(): Promise<string>;
|
|
@@ -1125,9 +1175,7 @@ declare class CheerioElement implements LsdElement {
|
|
|
1125
1175
|
press(): Promise<boolean>;
|
|
1126
1176
|
select(): Promise<boolean>;
|
|
1127
1177
|
screenshot(): Promise<Buffer>;
|
|
1128
|
-
scrollBy(): Promise<boolean>;
|
|
1129
1178
|
scrollIntoView(): Promise<boolean>;
|
|
1130
|
-
scrollTo(): Promise<boolean>;
|
|
1131
1179
|
}
|
|
1132
1180
|
|
|
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 };
|
|
1181
|
+
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 NavigationWaitUntil, 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, type WaitElementOptions, type WaitNavigationOptions, defaultProxy };
|
package/dist/index.d.ts
CHANGED
|
@@ -243,14 +243,15 @@ interface SelectOptions {
|
|
|
243
243
|
*/
|
|
244
244
|
labels?: string[];
|
|
245
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* * playwright: "load" | "domcontentloaded" | "networkidle" | "commit", "networkidle0" | "networkidle2" => "networkidle";
|
|
248
|
+
* * puppeteer: "load" | "domcontentloaded" | "networkidle0" | "networkidle2", "networkidle" => "networkidle0", "commit" ignored;
|
|
249
|
+
*/
|
|
250
|
+
type NavigationWaitUntil = "load" | "domcontentloaded" | "networkidle" | "commit" | "networkidle0" | "networkidle2";
|
|
246
251
|
interface GotoOptions {
|
|
247
252
|
referer?: string;
|
|
248
253
|
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
|
+
waitUntil?: NavigationWaitUntil;
|
|
254
255
|
}
|
|
255
256
|
/**
|
|
256
257
|
* * src takes precedence over selector, at least one of them must be defined
|
|
@@ -351,9 +352,7 @@ interface LsdElement {
|
|
|
351
352
|
press(key: KeyInput, options: KeyPressOptions): Promise<boolean>;
|
|
352
353
|
select(options: SelectOptions): Promise<boolean>;
|
|
353
354
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
354
|
-
scrollBy(x: number, y: number): Promise<boolean>;
|
|
355
355
|
scrollIntoView(): Promise<boolean>;
|
|
356
|
-
scrollTo(x: number, y: number): Promise<boolean>;
|
|
357
356
|
}
|
|
358
357
|
interface ViewportSize {
|
|
359
358
|
height: number;
|
|
@@ -402,9 +401,14 @@ interface RequestInterceptionOption {
|
|
|
402
401
|
* Requests that match all conditions will be intercepted; all requests will be intercepted if no condition.
|
|
403
402
|
*/
|
|
404
403
|
requestMatch?: RequestMatch;
|
|
404
|
+
/**
|
|
405
|
+
* * abort: Aborts the HTTP request
|
|
406
|
+
* * fulfill: Fulfills a request with the value of "fulfill"
|
|
407
|
+
*/
|
|
405
408
|
action: RequestInterceptionAction;
|
|
406
409
|
/**
|
|
407
410
|
* required when action is "fulfill"
|
|
411
|
+
* @default `<html><body><h1>${request.url()}</h1></body></html>`
|
|
408
412
|
*/
|
|
409
413
|
fulfill?: string;
|
|
410
414
|
}
|
|
@@ -432,7 +436,7 @@ interface ResponseInterceptionItem {
|
|
|
432
436
|
/**
|
|
433
437
|
* request.url()
|
|
434
438
|
*/
|
|
435
|
-
|
|
439
|
+
requestUrl: string;
|
|
436
440
|
/**
|
|
437
441
|
* request.postData()
|
|
438
442
|
*/
|
|
@@ -440,7 +444,7 @@ interface ResponseInterceptionItem {
|
|
|
440
444
|
/**
|
|
441
445
|
* response.text()
|
|
442
446
|
*/
|
|
443
|
-
|
|
447
|
+
responseData: string;
|
|
444
448
|
}
|
|
445
449
|
interface ResponseInterceptionOption {
|
|
446
450
|
requestMatch?: RequestMatch;
|
|
@@ -448,7 +452,7 @@ interface ResponseInterceptionOption {
|
|
|
448
452
|
/**
|
|
449
453
|
* the ResponseInterceptionData will be pushed into this array if Array.isArray(cacheArray)
|
|
450
454
|
*/
|
|
451
|
-
|
|
455
|
+
responseItems?: ResponseInterceptionItem[];
|
|
452
456
|
/**
|
|
453
457
|
* handler will be called if handler is a function
|
|
454
458
|
*/
|
|
@@ -681,6 +685,31 @@ interface ScreenshotOptions {
|
|
|
681
685
|
*/
|
|
682
686
|
type?: 'png' | 'jpeg';
|
|
683
687
|
}
|
|
688
|
+
interface WaitElementOptions {
|
|
689
|
+
/**
|
|
690
|
+
* @default 30_000 ms
|
|
691
|
+
*/
|
|
692
|
+
timeout?: number;
|
|
693
|
+
/**
|
|
694
|
+
* @default "visible"
|
|
695
|
+
*/
|
|
696
|
+
state?: "attached" | "detached" | "hidden" | "visible";
|
|
697
|
+
}
|
|
698
|
+
interface WaitNavigationOptions {
|
|
699
|
+
/**
|
|
700
|
+
* only supported in playwright by now
|
|
701
|
+
* @default ""
|
|
702
|
+
*/
|
|
703
|
+
url?: string | RegExp;
|
|
704
|
+
/**
|
|
705
|
+
* @default 30_000 ms
|
|
706
|
+
*/
|
|
707
|
+
timeout?: number;
|
|
708
|
+
/**
|
|
709
|
+
* @default "visible"
|
|
710
|
+
*/
|
|
711
|
+
waitUntil?: NavigationWaitUntil;
|
|
712
|
+
}
|
|
684
713
|
interface LsdPage extends EventEmitter {
|
|
685
714
|
bringToFront(): Promise<boolean>;
|
|
686
715
|
browserContext(): LsdBrowserContext;
|
|
@@ -740,6 +769,8 @@ interface LsdPage extends EventEmitter {
|
|
|
740
769
|
pageWidth(): Promise<number>;
|
|
741
770
|
pdf(options?: PDFOptions): Promise<boolean>;
|
|
742
771
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
772
|
+
scrollBy(x: number, y: number): Promise<boolean>;
|
|
773
|
+
scrollTo(x: number, y: number): Promise<boolean>;
|
|
743
774
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
744
775
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
745
776
|
/**
|
|
@@ -773,6 +804,17 @@ interface LsdPage extends EventEmitter {
|
|
|
773
804
|
* 开始使用该page(当前状态必须为free)
|
|
774
805
|
*/
|
|
775
806
|
use(): boolean;
|
|
807
|
+
/**
|
|
808
|
+
*
|
|
809
|
+
* @param selector CSS selector, not XPath
|
|
810
|
+
* @param options
|
|
811
|
+
*/
|
|
812
|
+
waitForElement(selector: string, options?: WaitElementOptions): Promise<boolean>;
|
|
813
|
+
/**
|
|
814
|
+
*
|
|
815
|
+
* @param options
|
|
816
|
+
*/
|
|
817
|
+
waitForNavigation(options: WaitNavigationOptions): Promise<boolean>;
|
|
776
818
|
/**
|
|
777
819
|
* obj=window?.[key1]...?.[keyn]
|
|
778
820
|
* @return obj ? JSON.stringify(obj) : ""
|
|
@@ -916,6 +958,8 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
|
916
958
|
pageWidth(): Promise<number>;
|
|
917
959
|
pdf(options?: PDFOptions | undefined): Promise<boolean>;
|
|
918
960
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
961
|
+
scrollBy(x: number, y: number): Promise<boolean>;
|
|
962
|
+
scrollTo(x: number, y: number): Promise<boolean>;
|
|
919
963
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
920
964
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
921
965
|
setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
|
|
@@ -930,6 +974,8 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
|
930
974
|
title(): Promise<string>;
|
|
931
975
|
url(): string;
|
|
932
976
|
use(): boolean;
|
|
977
|
+
waitForElement(selector: string, options?: WaitElementOptions): Promise<boolean>;
|
|
978
|
+
waitForNavigation(options: WaitNavigationOptions): Promise<boolean>;
|
|
933
979
|
windowMember(keys: string[]): Promise<string>;
|
|
934
980
|
}
|
|
935
981
|
|
|
@@ -952,9 +998,7 @@ declare class PlaywrightElement implements LsdElement {
|
|
|
952
998
|
press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
|
|
953
999
|
select(options: SelectOptions): Promise<boolean>;
|
|
954
1000
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
955
|
-
scrollBy(x: number, y: number): Promise<boolean>;
|
|
956
1001
|
scrollIntoView(): Promise<boolean>;
|
|
957
|
-
scrollTo(x: number, y: number): Promise<boolean>;
|
|
958
1002
|
}
|
|
959
1003
|
|
|
960
1004
|
declare class PuppeteerBrowser extends EventEmitter implements LsdBrowser {
|
|
@@ -1020,6 +1064,8 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
|
1020
1064
|
pageWidth(): Promise<number>;
|
|
1021
1065
|
pdf(options?: PDFOptions | undefined): Promise<boolean>;
|
|
1022
1066
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
1067
|
+
scrollBy(x: number, y: number): Promise<boolean>;
|
|
1068
|
+
scrollTo(x: number, y: number): Promise<boolean>;
|
|
1023
1069
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
1024
1070
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
1025
1071
|
setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
|
|
@@ -1034,6 +1080,8 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
|
1034
1080
|
title(): Promise<string>;
|
|
1035
1081
|
url(): string;
|
|
1036
1082
|
use(): boolean;
|
|
1083
|
+
waitForElement(selector: string, options?: WaitElementOptions): Promise<boolean>;
|
|
1084
|
+
waitForNavigation(options: WaitNavigationOptions): Promise<boolean>;
|
|
1037
1085
|
windowMember(keys: string[]): Promise<string>;
|
|
1038
1086
|
}
|
|
1039
1087
|
|
|
@@ -1056,9 +1104,7 @@ declare class PuppeteerElement implements LsdElement {
|
|
|
1056
1104
|
press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
|
|
1057
1105
|
select(options: SelectOptions): Promise<boolean>;
|
|
1058
1106
|
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
1059
|
-
scrollBy(x: number, y: number): Promise<boolean>;
|
|
1060
1107
|
scrollIntoView(): Promise<boolean>;
|
|
1061
|
-
scrollTo(x: number, y: number): Promise<boolean>;
|
|
1062
1108
|
}
|
|
1063
1109
|
|
|
1064
1110
|
declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
@@ -1089,6 +1135,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1089
1135
|
pageWidth(): Promise<number>;
|
|
1090
1136
|
pdf(): Promise<boolean>;
|
|
1091
1137
|
screenshot(): Promise<Buffer>;
|
|
1138
|
+
scrollBy(): Promise<boolean>;
|
|
1139
|
+
scrollTo(): Promise<boolean>;
|
|
1092
1140
|
setCookies(): Promise<boolean>;
|
|
1093
1141
|
setExtraHTTPHeaders(): Promise<boolean>;
|
|
1094
1142
|
setLocalStroage(): Promise<boolean>;
|
|
@@ -1103,6 +1151,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1103
1151
|
title(): Promise<string>;
|
|
1104
1152
|
url(): string;
|
|
1105
1153
|
use(): boolean;
|
|
1154
|
+
waitForElement(): Promise<boolean>;
|
|
1155
|
+
waitForNavigation(): Promise<boolean>;
|
|
1106
1156
|
windowMember(): Promise<string>;
|
|
1107
1157
|
}
|
|
1108
1158
|
|
|
@@ -1111,8 +1161,8 @@ declare class CheerioElement implements LsdElement {
|
|
|
1111
1161
|
constructor(node: CheerioNode);
|
|
1112
1162
|
attribute(attributeName: string): Promise<string>;
|
|
1113
1163
|
attributeNames(): Promise<string[]>;
|
|
1114
|
-
findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
|
|
1115
|
-
findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
|
|
1164
|
+
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
|
|
1165
|
+
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
|
|
1116
1166
|
hasAttribute(attributeName: string): Promise<boolean>;
|
|
1117
1167
|
innerHtml(): Promise<string>;
|
|
1118
1168
|
innerText(): Promise<string>;
|
|
@@ -1125,9 +1175,7 @@ declare class CheerioElement implements LsdElement {
|
|
|
1125
1175
|
press(): Promise<boolean>;
|
|
1126
1176
|
select(): Promise<boolean>;
|
|
1127
1177
|
screenshot(): Promise<Buffer>;
|
|
1128
|
-
scrollBy(): Promise<boolean>;
|
|
1129
1178
|
scrollIntoView(): Promise<boolean>;
|
|
1130
|
-
scrollTo(): Promise<boolean>;
|
|
1131
1179
|
}
|
|
1132
1180
|
|
|
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 };
|
|
1181
|
+
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 NavigationWaitUntil, 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, type WaitElementOptions, type WaitNavigationOptions, defaultProxy };
|