@letsscrapedata/controller 0.0.54 → 0.0.55

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 CHANGED
@@ -124,6 +124,9 @@ var PlaywrightElement = class _PlaywrightElement {
124
124
  const names = await this.#locator.evaluate((node) => node.getAttributeNames());
125
125
  return names;
126
126
  }
127
+ async boundingBox() {
128
+ return await this.#locator.boundingBox();
129
+ }
127
130
  async dataset() {
128
131
  try {
129
132
  const dataset = await this.#locator.evaluate((node) => node.dataset);
@@ -899,6 +902,41 @@ var PlaywrightPage = class extends import_node_events.default {
899
902
  const width = await this.pageWidth();
900
903
  return await this.setViewportSize({ height, width });
901
904
  }
905
+ async mouseClick(x, y, options) {
906
+ if (!this.#page) {
907
+ throw new Error("No valid page");
908
+ }
909
+ await this.#page.mouse.click(x, y, options);
910
+ return true;
911
+ }
912
+ async mouseDown() {
913
+ if (!this.#page) {
914
+ throw new Error("No valid page");
915
+ }
916
+ await this.#page.mouse.down();
917
+ return true;
918
+ }
919
+ async mouseMove(x, y) {
920
+ if (!this.#page) {
921
+ throw new Error("No valid page");
922
+ }
923
+ await this.#page.mouse.move(x, y);
924
+ return true;
925
+ }
926
+ async mouseUp() {
927
+ if (!this.#page) {
928
+ throw new Error("No valid page");
929
+ }
930
+ await this.#page.mouse.up();
931
+ return true;
932
+ }
933
+ async mouseWheel(deltaX = 0, deltaY = 0) {
934
+ if (!this.#page) {
935
+ throw new Error("No valid page");
936
+ }
937
+ await this.#page.mouse.wheel(deltaX, deltaY);
938
+ return true;
939
+ }
902
940
  async pageHeight() {
903
941
  if (!this.#page) {
904
942
  throw new Error("No valid page");
@@ -1887,6 +1925,9 @@ var PuppeteerElement = class _PuppeteerElement {
1887
1925
  const names = await this.#frame.evaluate((ele) => ele.getAttributeNames(), this.#$ele);
1888
1926
  return names;
1889
1927
  }
1928
+ async boundingBox() {
1929
+ return await this.#$ele.boundingBox();
1930
+ }
1890
1931
  async dataset() {
1891
1932
  try {
1892
1933
  const attributeNames = await this.attributeNames();
@@ -2631,6 +2672,41 @@ var PuppeteerPage = class extends import_node_events4.default {
2631
2672
  const width = await this.pageWidth();
2632
2673
  return await this.setViewportSize({ height, width });
2633
2674
  }
2675
+ async mouseClick(x, y, options) {
2676
+ if (!this.#page) {
2677
+ throw new Error("No valid page");
2678
+ }
2679
+ await this.#page.mouse.click(x, y, options);
2680
+ return true;
2681
+ }
2682
+ async mouseDown() {
2683
+ if (!this.#page) {
2684
+ throw new Error("No valid page");
2685
+ }
2686
+ await this.#page.mouse.down();
2687
+ return true;
2688
+ }
2689
+ async mouseMove(x, y) {
2690
+ if (!this.#page) {
2691
+ throw new Error("No valid page");
2692
+ }
2693
+ await this.#page.mouse.move(x, y);
2694
+ return true;
2695
+ }
2696
+ async mouseUp() {
2697
+ if (!this.#page) {
2698
+ throw new Error("No valid page");
2699
+ }
2700
+ await this.#page.mouse.up();
2701
+ return true;
2702
+ }
2703
+ async mouseWheel(deltaX = 0, deltaY = 0) {
2704
+ if (!this.#page) {
2705
+ throw new Error("No valid page");
2706
+ }
2707
+ await this.#page.mouse.wheel({ deltaX, deltaY });
2708
+ return true;
2709
+ }
2634
2710
  async pageHeight() {
2635
2711
  if (!this.#page) {
2636
2712
  throw new Error("No valid page");
@@ -3656,6 +3732,9 @@ var CheerioElement = class _CheerioElement {
3656
3732
  const text = this.#node.text();
3657
3733
  return text ? text : "";
3658
3734
  }
3735
+ boundingBox() {
3736
+ throw new Error("Not supported in CheerioElement.");
3737
+ }
3659
3738
  async click() {
3660
3739
  throw new Error("Not supported in CheerioElement.");
3661
3740
  }
@@ -3825,6 +3904,21 @@ var CheerioPage = class extends import_node_events7.default {
3825
3904
  async maximizeViewport() {
3826
3905
  throw new Error("Not supported in CheerioPage.");
3827
3906
  }
3907
+ async mouseClick() {
3908
+ throw new Error("Not supported in CheerioPage.");
3909
+ }
3910
+ async mouseDown() {
3911
+ throw new Error("Not supported in CheerioPage.");
3912
+ }
3913
+ async mouseMove() {
3914
+ throw new Error("Not supported in CheerioPage.");
3915
+ }
3916
+ async mouseUp() {
3917
+ throw new Error("Not supported in CheerioPage.");
3918
+ }
3919
+ async mouseWheel() {
3920
+ throw new Error("Not supported in CheerioPage.");
3921
+ }
3828
3922
  async pageHeight() {
3829
3923
  throw new Error("Not supported in CheerioPage.");
3830
3924
  }
@@ -3946,6 +4040,9 @@ var PatchrightElement = class _PatchrightElement {
3946
4040
  const names = await this.#locator.evaluate((node) => node.getAttributeNames());
3947
4041
  return names;
3948
4042
  }
4043
+ async boundingBox() {
4044
+ return await this.#locator.boundingBox();
4045
+ }
3949
4046
  async dataset() {
3950
4047
  try {
3951
4048
  const dataset = await this.#locator.evaluate((node) => node.dataset);
@@ -4721,6 +4818,41 @@ var PatchrightPage = class extends import_node_events8.default {
4721
4818
  const width = await this.pageWidth();
4722
4819
  return await this.setViewportSize({ height, width });
4723
4820
  }
4821
+ async mouseClick(x, y, options) {
4822
+ if (!this.#page) {
4823
+ throw new Error("No valid page");
4824
+ }
4825
+ await this.#page.mouse.click(x, y, options);
4826
+ return true;
4827
+ }
4828
+ async mouseDown() {
4829
+ if (!this.#page) {
4830
+ throw new Error("No valid page");
4831
+ }
4832
+ await this.#page.mouse.down();
4833
+ return true;
4834
+ }
4835
+ async mouseMove(x, y) {
4836
+ if (!this.#page) {
4837
+ throw new Error("No valid page");
4838
+ }
4839
+ await this.#page.mouse.move(x, y);
4840
+ return true;
4841
+ }
4842
+ async mouseUp() {
4843
+ if (!this.#page) {
4844
+ throw new Error("No valid page");
4845
+ }
4846
+ await this.#page.mouse.up();
4847
+ return true;
4848
+ }
4849
+ async mouseWheel(deltaX = 0, deltaY = 0) {
4850
+ if (!this.#page) {
4851
+ throw new Error("No valid page");
4852
+ }
4853
+ await this.#page.mouse.wheel(deltaX, deltaY);
4854
+ return true;
4855
+ }
4724
4856
  async pageHeight() {
4725
4857
  if (!this.#page) {
4726
4858
  throw new Error("No valid page");
package/dist/index.d.cts CHANGED
@@ -372,6 +372,24 @@ interface MouseClickOptions {
372
372
  */
373
373
  clickType?: MouseClickType;
374
374
  }
375
+ interface PageMouseClickOptions {
376
+ /**
377
+ * Which button will be pressed.
378
+ * @default left
379
+ */
380
+ button?: "left" | "right" | "middle";
381
+ /**
382
+ * Number of clicks to perform.
383
+ * * puppeteer: count (clickCount deprecated)
384
+ * @default 1
385
+ */
386
+ clickCount?: 1 | 2 | 3;
387
+ /**
388
+ * Time to wait between mousedown and mouseup in milliseconds.
389
+ * @default 0
390
+ */
391
+ delay?: number;
392
+ }
375
393
  interface SelectOptions {
376
394
  /**
377
395
  * Which attribute of select option to match
@@ -455,6 +473,15 @@ interface LsdElement {
455
473
  * @returns the attribute names of the element
456
474
  */
457
475
  attributeNames(): Promise<string[]>;
476
+ /**
477
+ * This method returns the bounding box of the element (relative to the main frame), or null if the element is not part of the layout (example: display: none).
478
+ */
479
+ boundingBox(): Promise<{
480
+ x: number;
481
+ y: number;
482
+ width: number;
483
+ height: number;
484
+ } | null>;
458
485
  dataset(): Promise<Record<string, string>>;
459
486
  /**
460
487
  * In order to be compatible with various browser controllers, if you need to use this function, please follow the following conventions:
@@ -853,7 +880,7 @@ interface ScreenshotOptions {
853
880
  */
854
881
  path?: string;
855
882
  /**
856
- * @defaultValue `'png'`
883
+ * @defaultValue `'png'
857
884
  */
858
885
  type?: 'png' | 'jpeg';
859
886
  }
@@ -991,6 +1018,11 @@ interface LsdPage extends EventEmitter {
991
1018
  localStroage(): Promise<LocalStorageOrigin[]>;
992
1019
  mainFrame(): AllFrame;
993
1020
  maximizeViewport(): Promise<boolean>;
1021
+ mouseClick(x: number, y: number, options?: PageMouseClickOptions): Promise<boolean>;
1022
+ mouseDown(): Promise<boolean>;
1023
+ mouseMove(x: number, y: number): Promise<boolean>;
1024
+ mouseUp(): Promise<boolean>;
1025
+ mouseWheel(deltaX?: number, delterY?: number): Promise<boolean>;
994
1026
  pageHeight(): Promise<number>;
995
1027
  pageInfo(): PageInfo;
996
1028
  pageWidth(): Promise<number>;
@@ -1285,6 +1317,11 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
1285
1317
  load(): boolean;
1286
1318
  mainFrame(): AllFrame;
1287
1319
  maximizeViewport(): Promise<boolean>;
1320
+ mouseClick(x: number, y: number, options?: PageMouseClickOptions): Promise<boolean>;
1321
+ mouseDown(): Promise<boolean>;
1322
+ mouseMove(x: number, y: number): Promise<boolean>;
1323
+ mouseUp(): Promise<boolean>;
1324
+ mouseWheel(deltaX?: number, deltaY?: number): Promise<boolean>;
1288
1325
  pageHeight(): Promise<number>;
1289
1326
  pageInfo(): PageInfo;
1290
1327
  pageWidth(): Promise<number>;
@@ -1320,6 +1357,12 @@ declare class PlaywrightElement implements LsdElement {
1320
1357
  constructor(locator: Locator, frame: Frame | FrameLocator);
1321
1358
  attribute(attributeName: string): Promise<string>;
1322
1359
  attributeNames(): Promise<string[]>;
1360
+ boundingBox(): Promise<{
1361
+ x: number;
1362
+ y: number;
1363
+ width: number;
1364
+ height: number;
1365
+ } | null>;
1323
1366
  dataset(): Promise<Record<string, string>>;
1324
1367
  evaluate(func: Function, args?: any[]): Promise<any>;
1325
1368
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
@@ -1422,6 +1465,11 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1422
1465
  load(): boolean;
1423
1466
  mainFrame(): AllFrame;
1424
1467
  maximizeViewport(): Promise<boolean>;
1468
+ mouseClick(x: number, y: number, options?: PageMouseClickOptions): Promise<boolean>;
1469
+ mouseDown(): Promise<boolean>;
1470
+ mouseMove(x: number, y: number): Promise<boolean>;
1471
+ mouseUp(): Promise<boolean>;
1472
+ mouseWheel(deltaX?: number, deltaY?: number): Promise<boolean>;
1425
1473
  pageHeight(): Promise<number>;
1426
1474
  pageInfo(): PageInfo;
1427
1475
  pageWidth(): Promise<number>;
@@ -1457,6 +1505,12 @@ declare class PuppeteerElement implements LsdElement {
1457
1505
  constructor($ele: ElementHandle, frame: Frame$1);
1458
1506
  attribute(attributeName: string): Promise<string>;
1459
1507
  attributeNames(): Promise<string[]>;
1508
+ boundingBox(): Promise<{
1509
+ x: number;
1510
+ y: number;
1511
+ width: number;
1512
+ height: number;
1513
+ } | null>;
1460
1514
  dataset(): Promise<Record<string, string>>;
1461
1515
  evaluate(func: Function, args?: any[]): Promise<any>;
1462
1516
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
@@ -1516,6 +1570,11 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
1516
1570
  localStroage(): Promise<LocalStorageOrigin[]>;
1517
1571
  mainFrame(): AllFrame;
1518
1572
  maximizeViewport(): Promise<boolean>;
1573
+ mouseClick(): Promise<boolean>;
1574
+ mouseDown(): Promise<boolean>;
1575
+ mouseMove(): Promise<boolean>;
1576
+ mouseUp(): Promise<boolean>;
1577
+ mouseWheel(): Promise<boolean>;
1519
1578
  pageHeight(): Promise<number>;
1520
1579
  pageInfo(): PageInfo;
1521
1580
  pageWidth(): Promise<number>;
@@ -1559,6 +1618,12 @@ declare class CheerioElement implements LsdElement {
1559
1618
  innerText(): Promise<string>;
1560
1619
  outerHtml(): Promise<string>;
1561
1620
  textContent(): Promise<string>;
1621
+ boundingBox(): Promise<{
1622
+ x: number;
1623
+ y: number;
1624
+ width: number;
1625
+ height: number;
1626
+ } | null>;
1562
1627
  click(): Promise<boolean>;
1563
1628
  focus(): Promise<boolean>;
1564
1629
  hover(): Promise<boolean>;
@@ -1581,4 +1646,4 @@ declare class LsdBrowserController implements LsdBrowserController$1 {
1581
1646
  }
1582
1647
  declare const controller: LsdBrowserController;
1583
1648
 
1584
- 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 };
1649
+ 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 PageMouseClickOptions, 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 };
package/dist/index.d.ts CHANGED
@@ -372,6 +372,24 @@ interface MouseClickOptions {
372
372
  */
373
373
  clickType?: MouseClickType;
374
374
  }
375
+ interface PageMouseClickOptions {
376
+ /**
377
+ * Which button will be pressed.
378
+ * @default left
379
+ */
380
+ button?: "left" | "right" | "middle";
381
+ /**
382
+ * Number of clicks to perform.
383
+ * * puppeteer: count (clickCount deprecated)
384
+ * @default 1
385
+ */
386
+ clickCount?: 1 | 2 | 3;
387
+ /**
388
+ * Time to wait between mousedown and mouseup in milliseconds.
389
+ * @default 0
390
+ */
391
+ delay?: number;
392
+ }
375
393
  interface SelectOptions {
376
394
  /**
377
395
  * Which attribute of select option to match
@@ -455,6 +473,15 @@ interface LsdElement {
455
473
  * @returns the attribute names of the element
456
474
  */
457
475
  attributeNames(): Promise<string[]>;
476
+ /**
477
+ * This method returns the bounding box of the element (relative to the main frame), or null if the element is not part of the layout (example: display: none).
478
+ */
479
+ boundingBox(): Promise<{
480
+ x: number;
481
+ y: number;
482
+ width: number;
483
+ height: number;
484
+ } | null>;
458
485
  dataset(): Promise<Record<string, string>>;
459
486
  /**
460
487
  * In order to be compatible with various browser controllers, if you need to use this function, please follow the following conventions:
@@ -853,7 +880,7 @@ interface ScreenshotOptions {
853
880
  */
854
881
  path?: string;
855
882
  /**
856
- * @defaultValue `'png'`
883
+ * @defaultValue `'png'
857
884
  */
858
885
  type?: 'png' | 'jpeg';
859
886
  }
@@ -991,6 +1018,11 @@ interface LsdPage extends EventEmitter {
991
1018
  localStroage(): Promise<LocalStorageOrigin[]>;
992
1019
  mainFrame(): AllFrame;
993
1020
  maximizeViewport(): Promise<boolean>;
1021
+ mouseClick(x: number, y: number, options?: PageMouseClickOptions): Promise<boolean>;
1022
+ mouseDown(): Promise<boolean>;
1023
+ mouseMove(x: number, y: number): Promise<boolean>;
1024
+ mouseUp(): Promise<boolean>;
1025
+ mouseWheel(deltaX?: number, delterY?: number): Promise<boolean>;
994
1026
  pageHeight(): Promise<number>;
995
1027
  pageInfo(): PageInfo;
996
1028
  pageWidth(): Promise<number>;
@@ -1285,6 +1317,11 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
1285
1317
  load(): boolean;
1286
1318
  mainFrame(): AllFrame;
1287
1319
  maximizeViewport(): Promise<boolean>;
1320
+ mouseClick(x: number, y: number, options?: PageMouseClickOptions): Promise<boolean>;
1321
+ mouseDown(): Promise<boolean>;
1322
+ mouseMove(x: number, y: number): Promise<boolean>;
1323
+ mouseUp(): Promise<boolean>;
1324
+ mouseWheel(deltaX?: number, deltaY?: number): Promise<boolean>;
1288
1325
  pageHeight(): Promise<number>;
1289
1326
  pageInfo(): PageInfo;
1290
1327
  pageWidth(): Promise<number>;
@@ -1320,6 +1357,12 @@ declare class PlaywrightElement implements LsdElement {
1320
1357
  constructor(locator: Locator, frame: Frame | FrameLocator);
1321
1358
  attribute(attributeName: string): Promise<string>;
1322
1359
  attributeNames(): Promise<string[]>;
1360
+ boundingBox(): Promise<{
1361
+ x: number;
1362
+ y: number;
1363
+ width: number;
1364
+ height: number;
1365
+ } | null>;
1323
1366
  dataset(): Promise<Record<string, string>>;
1324
1367
  evaluate(func: Function, args?: any[]): Promise<any>;
1325
1368
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
@@ -1422,6 +1465,11 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1422
1465
  load(): boolean;
1423
1466
  mainFrame(): AllFrame;
1424
1467
  maximizeViewport(): Promise<boolean>;
1468
+ mouseClick(x: number, y: number, options?: PageMouseClickOptions): Promise<boolean>;
1469
+ mouseDown(): Promise<boolean>;
1470
+ mouseMove(x: number, y: number): Promise<boolean>;
1471
+ mouseUp(): Promise<boolean>;
1472
+ mouseWheel(deltaX?: number, deltaY?: number): Promise<boolean>;
1425
1473
  pageHeight(): Promise<number>;
1426
1474
  pageInfo(): PageInfo;
1427
1475
  pageWidth(): Promise<number>;
@@ -1457,6 +1505,12 @@ declare class PuppeteerElement implements LsdElement {
1457
1505
  constructor($ele: ElementHandle, frame: Frame$1);
1458
1506
  attribute(attributeName: string): Promise<string>;
1459
1507
  attributeNames(): Promise<string[]>;
1508
+ boundingBox(): Promise<{
1509
+ x: number;
1510
+ y: number;
1511
+ width: number;
1512
+ height: number;
1513
+ } | null>;
1460
1514
  dataset(): Promise<Record<string, string>>;
1461
1515
  evaluate(func: Function, args?: any[]): Promise<any>;
1462
1516
  findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
@@ -1516,6 +1570,11 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
1516
1570
  localStroage(): Promise<LocalStorageOrigin[]>;
1517
1571
  mainFrame(): AllFrame;
1518
1572
  maximizeViewport(): Promise<boolean>;
1573
+ mouseClick(): Promise<boolean>;
1574
+ mouseDown(): Promise<boolean>;
1575
+ mouseMove(): Promise<boolean>;
1576
+ mouseUp(): Promise<boolean>;
1577
+ mouseWheel(): Promise<boolean>;
1519
1578
  pageHeight(): Promise<number>;
1520
1579
  pageInfo(): PageInfo;
1521
1580
  pageWidth(): Promise<number>;
@@ -1559,6 +1618,12 @@ declare class CheerioElement implements LsdElement {
1559
1618
  innerText(): Promise<string>;
1560
1619
  outerHtml(): Promise<string>;
1561
1620
  textContent(): Promise<string>;
1621
+ boundingBox(): Promise<{
1622
+ x: number;
1623
+ y: number;
1624
+ width: number;
1625
+ height: number;
1626
+ } | null>;
1562
1627
  click(): Promise<boolean>;
1563
1628
  focus(): Promise<boolean>;
1564
1629
  hover(): Promise<boolean>;
@@ -1581,4 +1646,4 @@ declare class LsdBrowserController implements LsdBrowserController$1 {
1581
1646
  }
1582
1647
  declare const controller: LsdBrowserController;
1583
1648
 
1584
- 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 };
1649
+ 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 PageMouseClickOptions, 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 };
package/dist/index.js CHANGED
@@ -77,6 +77,9 @@ var PlaywrightElement = class _PlaywrightElement {
77
77
  const names = await this.#locator.evaluate((node) => node.getAttributeNames());
78
78
  return names;
79
79
  }
80
+ async boundingBox() {
81
+ return await this.#locator.boundingBox();
82
+ }
80
83
  async dataset() {
81
84
  try {
82
85
  const dataset = await this.#locator.evaluate((node) => node.dataset);
@@ -852,6 +855,41 @@ var PlaywrightPage = class extends EventEmitter {
852
855
  const width = await this.pageWidth();
853
856
  return await this.setViewportSize({ height, width });
854
857
  }
858
+ async mouseClick(x, y, options) {
859
+ if (!this.#page) {
860
+ throw new Error("No valid page");
861
+ }
862
+ await this.#page.mouse.click(x, y, options);
863
+ return true;
864
+ }
865
+ async mouseDown() {
866
+ if (!this.#page) {
867
+ throw new Error("No valid page");
868
+ }
869
+ await this.#page.mouse.down();
870
+ return true;
871
+ }
872
+ async mouseMove(x, y) {
873
+ if (!this.#page) {
874
+ throw new Error("No valid page");
875
+ }
876
+ await this.#page.mouse.move(x, y);
877
+ return true;
878
+ }
879
+ async mouseUp() {
880
+ if (!this.#page) {
881
+ throw new Error("No valid page");
882
+ }
883
+ await this.#page.mouse.up();
884
+ return true;
885
+ }
886
+ async mouseWheel(deltaX = 0, deltaY = 0) {
887
+ if (!this.#page) {
888
+ throw new Error("No valid page");
889
+ }
890
+ await this.#page.mouse.wheel(deltaX, deltaY);
891
+ return true;
892
+ }
855
893
  async pageHeight() {
856
894
  if (!this.#page) {
857
895
  throw new Error("No valid page");
@@ -1840,6 +1878,9 @@ var PuppeteerElement = class _PuppeteerElement {
1840
1878
  const names = await this.#frame.evaluate((ele) => ele.getAttributeNames(), this.#$ele);
1841
1879
  return names;
1842
1880
  }
1881
+ async boundingBox() {
1882
+ return await this.#$ele.boundingBox();
1883
+ }
1843
1884
  async dataset() {
1844
1885
  try {
1845
1886
  const attributeNames = await this.attributeNames();
@@ -2584,6 +2625,41 @@ var PuppeteerPage = class extends EventEmitter4 {
2584
2625
  const width = await this.pageWidth();
2585
2626
  return await this.setViewportSize({ height, width });
2586
2627
  }
2628
+ async mouseClick(x, y, options) {
2629
+ if (!this.#page) {
2630
+ throw new Error("No valid page");
2631
+ }
2632
+ await this.#page.mouse.click(x, y, options);
2633
+ return true;
2634
+ }
2635
+ async mouseDown() {
2636
+ if (!this.#page) {
2637
+ throw new Error("No valid page");
2638
+ }
2639
+ await this.#page.mouse.down();
2640
+ return true;
2641
+ }
2642
+ async mouseMove(x, y) {
2643
+ if (!this.#page) {
2644
+ throw new Error("No valid page");
2645
+ }
2646
+ await this.#page.mouse.move(x, y);
2647
+ return true;
2648
+ }
2649
+ async mouseUp() {
2650
+ if (!this.#page) {
2651
+ throw new Error("No valid page");
2652
+ }
2653
+ await this.#page.mouse.up();
2654
+ return true;
2655
+ }
2656
+ async mouseWheel(deltaX = 0, deltaY = 0) {
2657
+ if (!this.#page) {
2658
+ throw new Error("No valid page");
2659
+ }
2660
+ await this.#page.mouse.wheel({ deltaX, deltaY });
2661
+ return true;
2662
+ }
2587
2663
  async pageHeight() {
2588
2664
  if (!this.#page) {
2589
2665
  throw new Error("No valid page");
@@ -3609,6 +3685,9 @@ var CheerioElement = class _CheerioElement {
3609
3685
  const text = this.#node.text();
3610
3686
  return text ? text : "";
3611
3687
  }
3688
+ boundingBox() {
3689
+ throw new Error("Not supported in CheerioElement.");
3690
+ }
3612
3691
  async click() {
3613
3692
  throw new Error("Not supported in CheerioElement.");
3614
3693
  }
@@ -3778,6 +3857,21 @@ var CheerioPage = class extends EventEmitter7 {
3778
3857
  async maximizeViewport() {
3779
3858
  throw new Error("Not supported in CheerioPage.");
3780
3859
  }
3860
+ async mouseClick() {
3861
+ throw new Error("Not supported in CheerioPage.");
3862
+ }
3863
+ async mouseDown() {
3864
+ throw new Error("Not supported in CheerioPage.");
3865
+ }
3866
+ async mouseMove() {
3867
+ throw new Error("Not supported in CheerioPage.");
3868
+ }
3869
+ async mouseUp() {
3870
+ throw new Error("Not supported in CheerioPage.");
3871
+ }
3872
+ async mouseWheel() {
3873
+ throw new Error("Not supported in CheerioPage.");
3874
+ }
3781
3875
  async pageHeight() {
3782
3876
  throw new Error("Not supported in CheerioPage.");
3783
3877
  }
@@ -3899,6 +3993,9 @@ var PatchrightElement = class _PatchrightElement {
3899
3993
  const names = await this.#locator.evaluate((node) => node.getAttributeNames());
3900
3994
  return names;
3901
3995
  }
3996
+ async boundingBox() {
3997
+ return await this.#locator.boundingBox();
3998
+ }
3902
3999
  async dataset() {
3903
4000
  try {
3904
4001
  const dataset = await this.#locator.evaluate((node) => node.dataset);
@@ -4674,6 +4771,41 @@ var PatchrightPage = class extends EventEmitter8 {
4674
4771
  const width = await this.pageWidth();
4675
4772
  return await this.setViewportSize({ height, width });
4676
4773
  }
4774
+ async mouseClick(x, y, options) {
4775
+ if (!this.#page) {
4776
+ throw new Error("No valid page");
4777
+ }
4778
+ await this.#page.mouse.click(x, y, options);
4779
+ return true;
4780
+ }
4781
+ async mouseDown() {
4782
+ if (!this.#page) {
4783
+ throw new Error("No valid page");
4784
+ }
4785
+ await this.#page.mouse.down();
4786
+ return true;
4787
+ }
4788
+ async mouseMove(x, y) {
4789
+ if (!this.#page) {
4790
+ throw new Error("No valid page");
4791
+ }
4792
+ await this.#page.mouse.move(x, y);
4793
+ return true;
4794
+ }
4795
+ async mouseUp() {
4796
+ if (!this.#page) {
4797
+ throw new Error("No valid page");
4798
+ }
4799
+ await this.#page.mouse.up();
4800
+ return true;
4801
+ }
4802
+ async mouseWheel(deltaX = 0, deltaY = 0) {
4803
+ if (!this.#page) {
4804
+ throw new Error("No valid page");
4805
+ }
4806
+ await this.#page.mouse.wheel(deltaX, deltaY);
4807
+ return true;
4808
+ }
4677
4809
  async pageHeight() {
4678
4810
  if (!this.#page) {
4679
4811
  throw new Error("No valid page");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsscrapedata/controller",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "description": "Unified browser / HTML controller interfaces that support playwright, puppeteer and cheerio",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",