@letsscrapedata/controller 0.0.51 → 0.0.53
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.cjs +2189 -132
- package/dist/index.d.cts +145 -28
- package/dist/index.d.ts +145 -28
- package/dist/index.js +2191 -134
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import EventEmitter from 'node:events';
|
|
2
|
-
import { Browser
|
|
3
|
-
import { Browser, BrowserContext
|
|
2
|
+
import { Browser, BrowserContext, Locator, ElementHandle as ElementHandle$1, Frame, Page, Response, APIRequestContext, BrowserType, FrameLocator } from 'playwright';
|
|
3
|
+
import { Browser as Browser$1, BrowserContext as BrowserContext$1, ElementHandle, Frame as Frame$1, Page as Page$1, HTTPResponse } from 'puppeteer';
|
|
4
|
+
import { Browser as Browser$2, BrowserContext as BrowserContext$2, Locator as Locator$1, ElementHandle as ElementHandle$2, Frame as Frame$2, Page as Page$2, Response as Response$1, APIRequestContext as APIRequestContext$1, BrowserType as BrowserType$1 } from 'patchright';
|
|
5
|
+
import { Serializable } from 'node:child_process';
|
|
4
6
|
import { LogFunction } from '@letsscrapedata/utils';
|
|
7
|
+
import { Serializable as Serializable$1 } from 'child_process';
|
|
5
8
|
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
type
|
|
12
|
-
type
|
|
9
|
+
type BrowserControllerType = "playwright" | "puppeteer" | "patchright";
|
|
10
|
+
type AllBrowser = Browser | Browser$1 | Browser$2;
|
|
11
|
+
type AllBrowserContext = BrowserContext | BrowserContext$1 | BrowserContext$2;
|
|
12
|
+
type AllElement = Locator | ElementHandle | Locator$1;
|
|
13
|
+
type AllElementHandle = ElementHandle$1 | ElementHandle | ElementHandle$2;
|
|
14
|
+
type AllFrame = Frame | Frame$1 | Frame$2;
|
|
15
|
+
type AllPage = Page | Page$1 | Page$2;
|
|
16
|
+
type AllResponse = Response | HTTPResponse | Response$1;
|
|
17
|
+
type AllApiRequestContext = APIRequestContext | APIRequestContext$1;
|
|
13
18
|
type CheerioNode = cheerio.Cheerio;
|
|
14
|
-
type BrowserControllerType = "puppeteer" | "playwright";
|
|
15
19
|
type BrowserCreationMethod = "launch" | "connect";
|
|
16
20
|
type BrowserContextCreationMethod = "launch" | "new";
|
|
17
21
|
type BrowserContextStatus = "free" | "busy" | "closed";
|
|
@@ -91,6 +95,11 @@ interface PlaywrightBrowserTypes {
|
|
|
91
95
|
firefox: BrowserType;
|
|
92
96
|
webkit: BrowserType;
|
|
93
97
|
}
|
|
98
|
+
interface PatchrightBrowserTypes {
|
|
99
|
+
chromium: BrowserType$1;
|
|
100
|
+
firefox: BrowserType$1;
|
|
101
|
+
webkit: BrowserType$1;
|
|
102
|
+
}
|
|
94
103
|
interface BrowserOptions {
|
|
95
104
|
/**
|
|
96
105
|
* Interval between closing free pages (seconds) if greater than 0
|
|
@@ -297,6 +306,36 @@ interface PageExtInPuppeteer extends Page$1 {
|
|
|
297
306
|
interface PageExtInPlaywright extends Page {
|
|
298
307
|
pageInfo?: PageInfo;
|
|
299
308
|
}
|
|
309
|
+
interface PageExtInPatchright extends Page$2 {
|
|
310
|
+
pageInfo?: PageInfo;
|
|
311
|
+
}
|
|
312
|
+
interface FrameAddScriptTagOptions {
|
|
313
|
+
/**
|
|
314
|
+
* URL of the script to be added.
|
|
315
|
+
*/
|
|
316
|
+
url?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Path to a JavaScript file to be injected into the frame.
|
|
319
|
+
*
|
|
320
|
+
* @remarks
|
|
321
|
+
* If `path` is a relative path, it is resolved relative to the current
|
|
322
|
+
* working directory (`process.cwd()` in Node.js).
|
|
323
|
+
*/
|
|
324
|
+
path?: string;
|
|
325
|
+
/**
|
|
326
|
+
* JavaScript to be injected into the frame.
|
|
327
|
+
*/
|
|
328
|
+
content?: string;
|
|
329
|
+
/**
|
|
330
|
+
* Sets the `type` of the script. Use `module` in order to load an ES2015 module.
|
|
331
|
+
*/
|
|
332
|
+
type?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Sets the `id` of the script.
|
|
335
|
+
* * supported only in puppeteer
|
|
336
|
+
*/
|
|
337
|
+
id?: string;
|
|
338
|
+
}
|
|
300
339
|
type MouseClickType = "click" | "evaluate";
|
|
301
340
|
interface MouseClickOptions {
|
|
302
341
|
/**
|
|
@@ -371,6 +410,10 @@ interface IframeOption {
|
|
|
371
410
|
* * RegExp: iframe.src matches this RegExp
|
|
372
411
|
*/
|
|
373
412
|
src?: string | RegExp;
|
|
413
|
+
/**
|
|
414
|
+
* id of iframe
|
|
415
|
+
*/
|
|
416
|
+
id?: string;
|
|
374
417
|
/**
|
|
375
418
|
* CSS selector or XPath
|
|
376
419
|
*/
|
|
@@ -412,6 +455,17 @@ interface LsdElement {
|
|
|
412
455
|
* @returns the attribute names of the element
|
|
413
456
|
*/
|
|
414
457
|
attributeNames(): Promise<string[]>;
|
|
458
|
+
dataset(): Promise<Record<string, string>>;
|
|
459
|
+
/**
|
|
460
|
+
* In order to be compatible with various browser controllers, if you need to use this function, please follow the following conventions:
|
|
461
|
+
* * If the element is in an iframe, use the descendant type when locating the iframe, not the child type!
|
|
462
|
+
* * * Reason: args of <page/frame | locator>.evaluate are different in Playwright
|
|
463
|
+
* * When there is only one parameter: element.evaluate(arg=>statements, val)
|
|
464
|
+
* * When there are one or more parameters: element.evaluate(([arg1, arg2]=>statements, [val1, val2])
|
|
465
|
+
* @param func
|
|
466
|
+
* @param args
|
|
467
|
+
*/
|
|
468
|
+
evaluate(func: Function, args?: any[]): Promise<Serializable>;
|
|
415
469
|
/**
|
|
416
470
|
* @returns the first element matching the given CSS selector or XPath
|
|
417
471
|
* @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
|
|
@@ -831,6 +885,19 @@ interface WaitNavigationOptions {
|
|
|
831
885
|
}
|
|
832
886
|
type PageEvent = "pageClose" | "pagePopup";
|
|
833
887
|
interface LsdPage extends EventEmitter {
|
|
888
|
+
/**
|
|
889
|
+
* Adds a script which would be evaluated in one of the following scenarios:
|
|
890
|
+
* * Whenever the page is navigated.
|
|
891
|
+
* * Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the newly attached frame.
|
|
892
|
+
* @param scriptOrFunc
|
|
893
|
+
* @param arg
|
|
894
|
+
*/
|
|
895
|
+
addPreloadScript(scriptOrFunc: string | Function, arg?: Serializable): Promise<boolean>;
|
|
896
|
+
/**
|
|
897
|
+
* Adds a `<script>` tag into the page with the desired URL or content.
|
|
898
|
+
* @param options
|
|
899
|
+
*/
|
|
900
|
+
addScriptTag(options: FrameAddScriptTagOptions): Promise<AllElementHandle>;
|
|
834
901
|
/**
|
|
835
902
|
* Get the LsdApiContext associated with this page's LsdBrowserContext
|
|
836
903
|
* * only vaild in playwright
|
|
@@ -866,19 +933,38 @@ interface LsdPage extends EventEmitter {
|
|
|
866
933
|
* Only free page can be closed!
|
|
867
934
|
*/
|
|
868
935
|
close(): Promise<boolean>;
|
|
936
|
+
/**
|
|
937
|
+
* Should the page be closed when it is freed?
|
|
938
|
+
* * Sometimes, in order to avoid being used again, you need to close the page.
|
|
939
|
+
* * valid only in browser page
|
|
940
|
+
* @default false, please call setCloseWhenFree to change it
|
|
941
|
+
*/
|
|
942
|
+
closeWhenFree(): boolean;
|
|
869
943
|
/**
|
|
870
944
|
* Get the full HTML content of the page or decendant frame
|
|
871
945
|
* @param iframeOptions default [], selectors of decendant frames
|
|
872
946
|
*/
|
|
873
947
|
content(iframeOptions?: IframeOption[]): Promise<string>;
|
|
874
948
|
cookies(): Promise<CookieItem[]>;
|
|
875
|
-
|
|
949
|
+
evaluate(func: Function, args?: any[]): Promise<any>;
|
|
950
|
+
/**
|
|
951
|
+
* The method adds a function called `name` on the page's `window` object.
|
|
952
|
+
* When called, the function executes `callbackFunction` in node.js and
|
|
953
|
+
* returns a `Promise` which resolves to the return value of `callbackFunction`.
|
|
954
|
+
* * Reminder: It is not recommended to use this function because it is easy to be detected !!!
|
|
955
|
+
* @param name Name of the function on the window object
|
|
956
|
+
* @param callbackFunction Callback function which will be called in node.js context
|
|
957
|
+
*/
|
|
958
|
+
exposeFunction(name: string, callbackFunction: Function): Promise<void>;
|
|
876
959
|
/**
|
|
877
960
|
* @returns the first element matching the given CSS selector or XPath
|
|
878
961
|
* @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
|
|
879
962
|
* @param iframeOptions default [], options to select decendant frame
|
|
963
|
+
* @param iframeType default "child", "descendant" is valid only if selectorOrXpath is string , iframeOptions.length is 1 and iframeOptions[0].src is string or RegExp
|
|
964
|
+
* @example
|
|
965
|
+
* * findElement("body", [{src: iframe.src}], "descendant"): to get the body element of a descendant iframe with src
|
|
880
966
|
*/
|
|
881
|
-
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
|
|
967
|
+
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], iframeType?: "child" | "descendant"): Promise<LsdElement | null>;
|
|
882
968
|
/**
|
|
883
969
|
* @returns elements matching the given CSS selector or XPath
|
|
884
970
|
* @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
|
|
@@ -920,6 +1006,12 @@ interface LsdPage extends EventEmitter {
|
|
|
920
1006
|
* @param detach default true, whether to detach the CDPSession from target
|
|
921
1007
|
*/
|
|
922
1008
|
sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
|
|
1009
|
+
/**
|
|
1010
|
+
* set new value of closeWhenFree, refer to closeWhenFree
|
|
1011
|
+
* * valid only in browser page
|
|
1012
|
+
* @param closeWhenFree
|
|
1013
|
+
*/
|
|
1014
|
+
setCloseWhenFree(closeWhenFree: boolean): boolean;
|
|
923
1015
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
924
1016
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
925
1017
|
/**
|
|
@@ -1094,15 +1186,15 @@ interface LsdBrowserController$1 {
|
|
|
1094
1186
|
*/
|
|
1095
1187
|
connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options?: LsdConnectOptions): Promise<LsdBrowser>;
|
|
1096
1188
|
/**
|
|
1097
|
-
*
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
*
|
|
1103
|
-
* @param
|
|
1189
|
+
* use special plugin, such as playwrightExtra.chromium.use(StealthPlugin()
|
|
1190
|
+
** import puppeteerExtra from "puppeteer-extra";
|
|
1191
|
+
** import * as playwrightExtra from "playwright-extra";
|
|
1192
|
+
** import StealthPlugin from "puppeteer-extra-plugin-stealth";
|
|
1193
|
+
* @param browserControllerType
|
|
1194
|
+
* @param browserType
|
|
1195
|
+
* @param plugin
|
|
1104
1196
|
*/
|
|
1105
|
-
|
|
1197
|
+
setBrowserPlugin(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, plugin: any): boolean;
|
|
1106
1198
|
/**
|
|
1107
1199
|
* Create a new LsdApiContext, valid in playwright;
|
|
1108
1200
|
*/
|
|
@@ -1113,7 +1205,8 @@ declare function setControllerLogFun(logFun: LogFunction): boolean;
|
|
|
1113
1205
|
|
|
1114
1206
|
declare class PlaywrightBrowser extends EventEmitter implements LsdBrowser {
|
|
1115
1207
|
#private;
|
|
1116
|
-
|
|
1208
|
+
static doesSupport(browserType: LsdBrowserType): boolean;
|
|
1209
|
+
constructor(browser: Browser, browserType: LsdBrowserType, browserCreateMethod: BrowserCreationMethod, options: LsdLaunchOptions | LsdConnectOptions, browserIdx?: number, pid?: number);
|
|
1117
1210
|
newBrowserContext(options?: LsdBrowserContextOptions): Promise<LsdBrowserContext | null>;
|
|
1118
1211
|
close(): Promise<boolean>;
|
|
1119
1212
|
browserContexts(): LsdBrowserContext[];
|
|
@@ -1164,6 +1257,8 @@ declare class PlaywrightBrowserContext extends EventEmitter implements LsdBrowse
|
|
|
1164
1257
|
declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
1165
1258
|
#private;
|
|
1166
1259
|
constructor(browserContext: LsdBrowserContext, page: Page, pageInfo?: PageInfo);
|
|
1260
|
+
addPreloadScript(scriptOrFunc: string | Function, arg?: Serializable$1): Promise<boolean>;
|
|
1261
|
+
addScriptTag(options: FrameAddScriptTagOptions): Promise<AllElementHandle>;
|
|
1167
1262
|
apiContext(): LsdApiContext;
|
|
1168
1263
|
bringToFront(): Promise<boolean>;
|
|
1169
1264
|
browserContext(): LsdBrowserContext;
|
|
@@ -1173,10 +1268,12 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
|
1173
1268
|
clearResponseInterceptions(): Promise<boolean>;
|
|
1174
1269
|
clearStateData(): Promise<boolean>;
|
|
1175
1270
|
close(): Promise<boolean>;
|
|
1271
|
+
closeWhenFree(): boolean;
|
|
1176
1272
|
content(iframeOptions?: IframeOption[]): Promise<string>;
|
|
1177
1273
|
cookies(): Promise<CookieItem[]>;
|
|
1178
1274
|
documentHeight(): Promise<number>;
|
|
1179
|
-
|
|
1275
|
+
evaluate(func: Function, args?: any[]): Promise<any>;
|
|
1276
|
+
exposeFunction(name: string, callbackFunction: Function): Promise<void>;
|
|
1180
1277
|
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
|
|
1181
1278
|
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
|
|
1182
1279
|
free(): Promise<boolean>;
|
|
@@ -1195,6 +1292,7 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
|
|
|
1195
1292
|
scrollBy(x: number, y: number): Promise<boolean>;
|
|
1196
1293
|
scrollTo(x: number, y: number): Promise<boolean>;
|
|
1197
1294
|
sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
|
|
1295
|
+
setCloseWhenFree(closeWhenFree: boolean): boolean;
|
|
1198
1296
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
1199
1297
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
1200
1298
|
setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
|
|
@@ -1220,6 +1318,8 @@ declare class PlaywrightElement implements LsdElement {
|
|
|
1220
1318
|
constructor(locator: Locator, frame: Frame | FrameLocator);
|
|
1221
1319
|
attribute(attributeName: string): Promise<string>;
|
|
1222
1320
|
attributeNames(): Promise<string[]>;
|
|
1321
|
+
dataset(): Promise<Record<string, string>>;
|
|
1322
|
+
evaluate(func: Function, args?: any[]): Promise<any>;
|
|
1223
1323
|
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
|
|
1224
1324
|
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
|
|
1225
1325
|
hasAttribute(attributeName: string): Promise<boolean>;
|
|
@@ -1241,7 +1341,8 @@ declare class PlaywrightElement implements LsdElement {
|
|
|
1241
1341
|
|
|
1242
1342
|
declare class PuppeteerBrowser extends EventEmitter implements LsdBrowser {
|
|
1243
1343
|
#private;
|
|
1244
|
-
|
|
1344
|
+
static doesSupport(browserType: LsdBrowserType): boolean;
|
|
1345
|
+
constructor(browser: Browser$1, browserType: LsdBrowserType, browserCreateMethod: BrowserCreationMethod, options: LsdLaunchOptions | LsdConnectOptions, browserIdx?: number, pid?: number);
|
|
1245
1346
|
newBrowserContext(options?: LsdBrowserContextOptions | undefined): Promise<LsdBrowserContext | null>;
|
|
1246
1347
|
close(): Promise<boolean>;
|
|
1247
1348
|
browserContexts(): LsdBrowserContext[];
|
|
@@ -1292,6 +1393,8 @@ declare class PuppeteerBrowserContext extends EventEmitter implements LsdBrowser
|
|
|
1292
1393
|
declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
1293
1394
|
#private;
|
|
1294
1395
|
constructor(browserContext: LsdBrowserContext, page: Page$1, pageInfo?: PageInfo);
|
|
1396
|
+
addPreloadScript(scriptOrFunc: string | Function, arg?: Serializable$1): Promise<boolean>;
|
|
1397
|
+
addScriptTag(options: FrameAddScriptTagOptions): Promise<AllElementHandle>;
|
|
1295
1398
|
apiContext(): LsdApiContext;
|
|
1296
1399
|
bringToFront(): Promise<boolean>;
|
|
1297
1400
|
browserContext(): LsdBrowserContext;
|
|
@@ -1301,10 +1404,12 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
|
1301
1404
|
clearResponseInterceptions(): Promise<boolean>;
|
|
1302
1405
|
clearStateData(): Promise<boolean>;
|
|
1303
1406
|
close(): Promise<boolean>;
|
|
1407
|
+
closeWhenFree(): boolean;
|
|
1304
1408
|
content(iframeOptions?: IframeOption[]): Promise<string>;
|
|
1305
1409
|
cookies(): Promise<CookieItem[]>;
|
|
1306
1410
|
documentHeight(): Promise<number>;
|
|
1307
|
-
|
|
1411
|
+
evaluate(func: Function, args?: any[]): Promise<any>;
|
|
1412
|
+
exposeFunction(name: string, callbackFunction: Function): Promise<void>;
|
|
1308
1413
|
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
|
|
1309
1414
|
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
|
|
1310
1415
|
free(): Promise<boolean>;
|
|
@@ -1323,6 +1428,7 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
|
|
|
1323
1428
|
scrollBy(x: number, y: number): Promise<boolean>;
|
|
1324
1429
|
scrollTo(x: number, y: number): Promise<boolean>;
|
|
1325
1430
|
sendCDPMessage(method: string, params?: object | null, detach?: boolean): Promise<any>;
|
|
1431
|
+
setCloseWhenFree(closeWhenFree: boolean): boolean;
|
|
1326
1432
|
setCookies(cookies: CookieItem[]): Promise<boolean>;
|
|
1327
1433
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
|
|
1328
1434
|
setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
|
|
@@ -1348,6 +1454,8 @@ declare class PuppeteerElement implements LsdElement {
|
|
|
1348
1454
|
constructor($ele: ElementHandle, frame: Frame$1);
|
|
1349
1455
|
attribute(attributeName: string): Promise<string>;
|
|
1350
1456
|
attributeNames(): Promise<string[]>;
|
|
1457
|
+
dataset(): Promise<Record<string, string>>;
|
|
1458
|
+
evaluate(func: Function, args?: any[]): Promise<any>;
|
|
1351
1459
|
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
|
|
1352
1460
|
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
|
|
1353
1461
|
hasAttribute(attributeName: string): Promise<boolean>;
|
|
@@ -1367,6 +1475,9 @@ declare class PuppeteerElement implements LsdElement {
|
|
|
1367
1475
|
_origElement(): AllElement;
|
|
1368
1476
|
}
|
|
1369
1477
|
|
|
1478
|
+
/**
|
|
1479
|
+
* CheerioPage does not support iframe: https://github.com/cheeriojs/cheerio/issues/602
|
|
1480
|
+
*/
|
|
1370
1481
|
declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
1371
1482
|
#private;
|
|
1372
1483
|
/**
|
|
@@ -1376,6 +1487,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1376
1487
|
*/
|
|
1377
1488
|
constructor(html?: string, isHtml?: boolean);
|
|
1378
1489
|
_origPage(): AllPage;
|
|
1490
|
+
addPreloadScript(): Promise<boolean>;
|
|
1491
|
+
addScriptTag(): Promise<AllElementHandle>;
|
|
1379
1492
|
apiContext(): LsdApiContext;
|
|
1380
1493
|
bringToFront(): Promise<boolean>;
|
|
1381
1494
|
browserContext(): LsdBrowserContext;
|
|
@@ -1385,9 +1498,11 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1385
1498
|
clearResponseInterceptions(): Promise<boolean>;
|
|
1386
1499
|
clearStateData(): Promise<boolean>;
|
|
1387
1500
|
close(): Promise<boolean>;
|
|
1501
|
+
closeWhenFree(): boolean;
|
|
1388
1502
|
content(): Promise<string>;
|
|
1389
1503
|
cookies(): Promise<CookieItem[]>;
|
|
1390
|
-
|
|
1504
|
+
evaluate(): Promise<any>;
|
|
1505
|
+
exposeFunction(): Promise<void>;
|
|
1391
1506
|
findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
|
|
1392
1507
|
findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
|
|
1393
1508
|
free(): Promise<boolean>;
|
|
@@ -1406,6 +1521,7 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
|
|
|
1406
1521
|
scrollBy(): Promise<boolean>;
|
|
1407
1522
|
scrollTo(): Promise<boolean>;
|
|
1408
1523
|
sendCDPMessage(): Promise<any>;
|
|
1524
|
+
setCloseWhenFree(): boolean;
|
|
1409
1525
|
setCookies(): Promise<boolean>;
|
|
1410
1526
|
setExtraHTTPHeaders(): Promise<boolean>;
|
|
1411
1527
|
setLocalStroage(): Promise<boolean>;
|
|
@@ -1430,6 +1546,8 @@ declare class CheerioElement implements LsdElement {
|
|
|
1430
1546
|
constructor(node: CheerioNode);
|
|
1431
1547
|
attribute(attributeName: string): Promise<string>;
|
|
1432
1548
|
attributeNames(): Promise<string[]>;
|
|
1549
|
+
dataset(): Promise<Record<string, string>>;
|
|
1550
|
+
evaluate(): Promise<any>;
|
|
1433
1551
|
findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
|
|
1434
1552
|
findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
|
|
1435
1553
|
hasAttribute(attributeName: string): Promise<boolean>;
|
|
@@ -1452,12 +1570,11 @@ declare class CheerioElement implements LsdElement {
|
|
|
1452
1570
|
declare class LsdBrowserController implements LsdBrowserController$1 {
|
|
1453
1571
|
#private;
|
|
1454
1572
|
constructor();
|
|
1455
|
-
|
|
1456
|
-
setPlaywrightBrowserType(browserType: LsdBrowserType, playwrightBrowserType: BrowserType | null): boolean;
|
|
1573
|
+
setBrowserPlugin(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, plugin: any): boolean;
|
|
1457
1574
|
launch(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdLaunchOptions): Promise<LsdBrowser>;
|
|
1458
1575
|
connect(browserControllerType: BrowserControllerType, browserType: LsdBrowserType, options: LsdConnectOptions): Promise<LsdBrowser>;
|
|
1459
1576
|
newApiContext(options?: LsdApiContextOptions): Promise<LsdApiContext>;
|
|
1460
1577
|
}
|
|
1461
1578
|
declare const controller: LsdBrowserController;
|
|
1462
1579
|
|
|
1463
|
-
export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, 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 ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
|
|
1580
|
+
export { type AllApiRequestContext, type AllBrowser, type AllBrowserContext, type AllElement, type AllElementHandle, type AllFrame, type AllPage, type AllResponse, type BrowserContextCreationMethod, type BrowserContextRequirements, type BrowserContextStatus, type BrowserControllerType, type BrowserCreationMethod, type BrowserLaunchMethod, type BrowserStateData, CheerioElement, type CheerioNode, CheerioPage, type ClientCertificate, type CookieItem, type FrameAddScriptTagOptions, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdApiContext, type LsdApiContextOptions, type LsdApiResponse, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController$1 as LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdFetchOptions, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPatchright, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, type PatchrightBrowserTypes, PlaywrightBrowser, PlaywrightBrowserContext, type PlaywrightBrowserTypes, PlaywrightElement, PlaywrightPage, type ProxyInController, 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 ResponsePageData, type ScreenshotOptions, type SelectOptions, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, controller, setControllerLogFun };
|