@letsscrapedata/controller 0.0.55 → 0.0.57

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.d.cts CHANGED
@@ -6,7 +6,7 @@ import { Serializable } from 'node:child_process';
6
6
  import { LogFunction } from '@letsscrapedata/utils';
7
7
  import { Serializable as Serializable$1 } from 'child_process';
8
8
 
9
- type BrowserControllerType = "playwright" | "puppeteer" | "patchright";
9
+ type BrowserControllerType = "playwright" | "puppeteer" | "patchright" | "camoufox";
10
10
  type AllBrowser = Browser | Browser$1 | Browser$2;
11
11
  type AllBrowserContext = BrowserContext | BrowserContext$1 | BrowserContext$2;
12
12
  type AllElement = Locator | ElementHandle | Locator$1;
@@ -491,8 +491,9 @@ interface LsdElement {
491
491
  * * When there are one or more parameters: element.evaluate(([arg1, arg2]=>statements, [val1, val2])
492
492
  * @param func
493
493
  * @param args
494
+ * @param isolated default true; whether to run in isolated context; only valid for patchwright and camoufox
494
495
  */
495
- evaluate(func: Function, args?: any[]): Promise<Serializable>;
496
+ evaluate(func: Function | string, args?: any[], isolated?: boolean): Promise<Serializable>;
496
497
  /**
497
498
  * @returns the first element matching the given CSS selector or XPath
498
499
  * @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
@@ -973,7 +974,15 @@ interface LsdPage extends EventEmitter {
973
974
  */
974
975
  content(iframeOptions?: IframeOption[]): Promise<string>;
975
976
  cookies(): Promise<CookieItem[]>;
976
- evaluate(func: Function, args?: any[]): Promise<any>;
977
+ /**
978
+ * In order to be compatible with various browser controllers, if you need to use this function, please follow the following conventions:
979
+ * * When there is only one parameter: element.evaluate(arg=>statements, val)
980
+ * * When there are one or more parameters: element.evaluate(([arg1, arg2]=>statements, [val1, val2])
981
+ * @param func
982
+ * @param args
983
+ * @param isolated default true; whether to run in isolated context; only valid for patchwright and camoufox
984
+ */
985
+ evaluate(func: Function | string, args?: any[]): Promise<any>;
977
986
  /**
978
987
  * The method adds a function called `name` on the page's `window` object.
979
988
  * When called, the function executes `callbackFunction` in node.js and
@@ -1305,7 +1314,7 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
1305
1314
  content(iframeOptions?: IframeOption[]): Promise<string>;
1306
1315
  cookies(): Promise<CookieItem[]>;
1307
1316
  documentHeight(): Promise<number>;
1308
- evaluate(func: Function, args?: any[]): Promise<any>;
1317
+ evaluate(func: Function | string, args?: any[]): Promise<any>;
1309
1318
  exposeFunction(name: string, callbackFunction: Function): Promise<void>;
1310
1319
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
1311
1320
  findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
@@ -1453,7 +1462,7 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1453
1462
  content(iframeOptions?: IframeOption[]): Promise<string>;
1454
1463
  cookies(): Promise<CookieItem[]>;
1455
1464
  documentHeight(): Promise<number>;
1456
- evaluate(func: Function, args?: any[]): Promise<any>;
1465
+ evaluate(func: Function | string, args?: any[]): Promise<any>;
1457
1466
  exposeFunction(name: string, callbackFunction: Function): Promise<void>;
1458
1467
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
1459
1468
  findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { Serializable } from 'node:child_process';
6
6
  import { LogFunction } from '@letsscrapedata/utils';
7
7
  import { Serializable as Serializable$1 } from 'child_process';
8
8
 
9
- type BrowserControllerType = "playwright" | "puppeteer" | "patchright";
9
+ type BrowserControllerType = "playwright" | "puppeteer" | "patchright" | "camoufox";
10
10
  type AllBrowser = Browser | Browser$1 | Browser$2;
11
11
  type AllBrowserContext = BrowserContext | BrowserContext$1 | BrowserContext$2;
12
12
  type AllElement = Locator | ElementHandle | Locator$1;
@@ -491,8 +491,9 @@ interface LsdElement {
491
491
  * * When there are one or more parameters: element.evaluate(([arg1, arg2]=>statements, [val1, val2])
492
492
  * @param func
493
493
  * @param args
494
+ * @param isolated default true; whether to run in isolated context; only valid for patchwright and camoufox
494
495
  */
495
- evaluate(func: Function, args?: any[]): Promise<Serializable>;
496
+ evaluate(func: Function | string, args?: any[], isolated?: boolean): Promise<Serializable>;
496
497
  /**
497
498
  * @returns the first element matching the given CSS selector or XPath
498
499
  * @param selectorOrXpath CSS selector or XPath; if this parameter is an array, each selectorOrXpath in the array will be tried until elements are selected
@@ -973,7 +974,15 @@ interface LsdPage extends EventEmitter {
973
974
  */
974
975
  content(iframeOptions?: IframeOption[]): Promise<string>;
975
976
  cookies(): Promise<CookieItem[]>;
976
- evaluate(func: Function, args?: any[]): Promise<any>;
977
+ /**
978
+ * In order to be compatible with various browser controllers, if you need to use this function, please follow the following conventions:
979
+ * * When there is only one parameter: element.evaluate(arg=>statements, val)
980
+ * * When there are one or more parameters: element.evaluate(([arg1, arg2]=>statements, [val1, val2])
981
+ * @param func
982
+ * @param args
983
+ * @param isolated default true; whether to run in isolated context; only valid for patchwright and camoufox
984
+ */
985
+ evaluate(func: Function | string, args?: any[]): Promise<any>;
977
986
  /**
978
987
  * The method adds a function called `name` on the page's `window` object.
979
988
  * When called, the function executes `callbackFunction` in node.js and
@@ -1305,7 +1314,7 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
1305
1314
  content(iframeOptions?: IframeOption[]): Promise<string>;
1306
1315
  cookies(): Promise<CookieItem[]>;
1307
1316
  documentHeight(): Promise<number>;
1308
- evaluate(func: Function, args?: any[]): Promise<any>;
1317
+ evaluate(func: Function | string, args?: any[]): Promise<any>;
1309
1318
  exposeFunction(name: string, callbackFunction: Function): Promise<void>;
1310
1319
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
1311
1320
  findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;
@@ -1453,7 +1462,7 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1453
1462
  content(iframeOptions?: IframeOption[]): Promise<string>;
1454
1463
  cookies(): Promise<CookieItem[]>;
1455
1464
  documentHeight(): Promise<number>;
1456
- evaluate(func: Function, args?: any[]): Promise<any>;
1465
+ evaluate(func: Function | string, args?: any[]): Promise<any>;
1457
1466
  exposeFunction(name: string, callbackFunction: Function): Promise<void>;
1458
1467
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement | null>;
1459
1468
  findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[]): Promise<LsdElement[]>;