@letsscrapedata/controller 0.0.1 → 0.0.2

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.
@@ -351,9 +351,7 @@ interface LsdElement {
351
351
  press(key: KeyInput, options: KeyPressOptions): Promise<boolean>;
352
352
  select(options: SelectOptions): Promise<boolean>;
353
353
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
354
- scrollBy(x: number, y: number): Promise<boolean>;
355
354
  scrollIntoView(): Promise<boolean>;
356
- scrollTo(x: number, y: number): Promise<boolean>;
357
355
  }
358
356
  interface ViewportSize {
359
357
  height: number;
@@ -402,9 +400,14 @@ interface RequestInterceptionOption {
402
400
  * Requests that match all conditions will be intercepted; all requests will be intercepted if no condition.
403
401
  */
404
402
  requestMatch?: RequestMatch;
403
+ /**
404
+ * * abort: Aborts the HTTP request
405
+ * * fulfill: Fulfills a request with the value of "fulfill"
406
+ */
405
407
  action: RequestInterceptionAction;
406
408
  /**
407
409
  * required when action is "fulfill"
410
+ * @default `<html><body><h1>${request.url()}</h1></body></html>`
408
411
  */
409
412
  fulfill?: string;
410
413
  }
@@ -432,7 +435,7 @@ interface ResponseInterceptionItem {
432
435
  /**
433
436
  * request.url()
434
437
  */
435
- rquestUrl: string;
438
+ requestUrl: string;
436
439
  /**
437
440
  * request.postData()
438
441
  */
@@ -440,7 +443,7 @@ interface ResponseInterceptionItem {
440
443
  /**
441
444
  * response.text()
442
445
  */
443
- resposeData: string;
446
+ responseData: string;
444
447
  }
445
448
  interface ResponseInterceptionOption {
446
449
  requestMatch?: RequestMatch;
@@ -448,7 +451,7 @@ interface ResponseInterceptionOption {
448
451
  /**
449
452
  * the ResponseInterceptionData will be pushed into this array if Array.isArray(cacheArray)
450
453
  */
451
- cacheArray?: Array<any>;
454
+ responseItems?: ResponseInterceptionItem[];
452
455
  /**
453
456
  * handler will be called if handler is a function
454
457
  */
@@ -740,6 +743,8 @@ interface LsdPage extends EventEmitter {
740
743
  pageWidth(): Promise<number>;
741
744
  pdf(options?: PDFOptions): Promise<boolean>;
742
745
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
746
+ scrollBy(x: number, y: number): Promise<boolean>;
747
+ scrollTo(x: number, y: number): Promise<boolean>;
743
748
  setCookies(cookies: CookieItem[]): Promise<boolean>;
744
749
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
745
750
  /**
@@ -916,6 +921,8 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
916
921
  pageWidth(): Promise<number>;
917
922
  pdf(options?: PDFOptions | undefined): Promise<boolean>;
918
923
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
924
+ scrollBy(x: number, y: number): Promise<boolean>;
925
+ scrollTo(x: number, y: number): Promise<boolean>;
919
926
  setCookies(cookies: CookieItem[]): Promise<boolean>;
920
927
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
921
928
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -952,9 +959,7 @@ declare class PlaywrightElement implements LsdElement {
952
959
  press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
953
960
  select(options: SelectOptions): Promise<boolean>;
954
961
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
955
- scrollBy(x: number, y: number): Promise<boolean>;
956
962
  scrollIntoView(): Promise<boolean>;
957
- scrollTo(x: number, y: number): Promise<boolean>;
958
963
  }
959
964
 
960
965
  declare class PuppeteerBrowser extends EventEmitter implements LsdBrowser {
@@ -1020,6 +1025,8 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1020
1025
  pageWidth(): Promise<number>;
1021
1026
  pdf(options?: PDFOptions | undefined): Promise<boolean>;
1022
1027
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1028
+ scrollBy(x: number, y: number): Promise<boolean>;
1029
+ scrollTo(x: number, y: number): Promise<boolean>;
1023
1030
  setCookies(cookies: CookieItem[]): Promise<boolean>;
1024
1031
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1025
1032
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -1056,9 +1063,7 @@ declare class PuppeteerElement implements LsdElement {
1056
1063
  press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
1057
1064
  select(options: SelectOptions): Promise<boolean>;
1058
1065
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1059
- scrollBy(x: number, y: number): Promise<boolean>;
1060
1066
  scrollIntoView(): Promise<boolean>;
1061
- scrollTo(x: number, y: number): Promise<boolean>;
1062
1067
  }
1063
1068
 
1064
1069
  declare class CheerioPage extends EventEmitter implements LsdPage {
@@ -1089,6 +1094,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
1089
1094
  pageWidth(): Promise<number>;
1090
1095
  pdf(): Promise<boolean>;
1091
1096
  screenshot(): Promise<Buffer>;
1097
+ scrollBy(): Promise<boolean>;
1098
+ scrollTo(): Promise<boolean>;
1092
1099
  setCookies(): Promise<boolean>;
1093
1100
  setExtraHTTPHeaders(): Promise<boolean>;
1094
1101
  setLocalStroage(): Promise<boolean>;
@@ -1111,8 +1118,8 @@ declare class CheerioElement implements LsdElement {
1111
1118
  constructor(node: CheerioNode);
1112
1119
  attribute(attributeName: string): Promise<string>;
1113
1120
  attributeNames(): Promise<string[]>;
1114
- findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
1115
- findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
1121
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
1122
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
1116
1123
  hasAttribute(attributeName: string): Promise<boolean>;
1117
1124
  innerHtml(): Promise<string>;
1118
1125
  innerText(): Promise<string>;
@@ -1125,9 +1132,7 @@ declare class CheerioElement implements LsdElement {
1125
1132
  press(): Promise<boolean>;
1126
1133
  select(): Promise<boolean>;
1127
1134
  screenshot(): Promise<Buffer>;
1128
- scrollBy(): Promise<boolean>;
1129
1135
  scrollIntoView(): Promise<boolean>;
1130
- scrollTo(): Promise<boolean>;
1131
1136
  }
1132
1137
 
1133
1138
  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 };
package/dist/index.d.ts CHANGED
@@ -351,9 +351,7 @@ interface LsdElement {
351
351
  press(key: KeyInput, options: KeyPressOptions): Promise<boolean>;
352
352
  select(options: SelectOptions): Promise<boolean>;
353
353
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
354
- scrollBy(x: number, y: number): Promise<boolean>;
355
354
  scrollIntoView(): Promise<boolean>;
356
- scrollTo(x: number, y: number): Promise<boolean>;
357
355
  }
358
356
  interface ViewportSize {
359
357
  height: number;
@@ -402,9 +400,14 @@ interface RequestInterceptionOption {
402
400
  * Requests that match all conditions will be intercepted; all requests will be intercepted if no condition.
403
401
  */
404
402
  requestMatch?: RequestMatch;
403
+ /**
404
+ * * abort: Aborts the HTTP request
405
+ * * fulfill: Fulfills a request with the value of "fulfill"
406
+ */
405
407
  action: RequestInterceptionAction;
406
408
  /**
407
409
  * required when action is "fulfill"
410
+ * @default `<html><body><h1>${request.url()}</h1></body></html>`
408
411
  */
409
412
  fulfill?: string;
410
413
  }
@@ -432,7 +435,7 @@ interface ResponseInterceptionItem {
432
435
  /**
433
436
  * request.url()
434
437
  */
435
- rquestUrl: string;
438
+ requestUrl: string;
436
439
  /**
437
440
  * request.postData()
438
441
  */
@@ -440,7 +443,7 @@ interface ResponseInterceptionItem {
440
443
  /**
441
444
  * response.text()
442
445
  */
443
- resposeData: string;
446
+ responseData: string;
444
447
  }
445
448
  interface ResponseInterceptionOption {
446
449
  requestMatch?: RequestMatch;
@@ -448,7 +451,7 @@ interface ResponseInterceptionOption {
448
451
  /**
449
452
  * the ResponseInterceptionData will be pushed into this array if Array.isArray(cacheArray)
450
453
  */
451
- cacheArray?: Array<any>;
454
+ responseItems?: ResponseInterceptionItem[];
452
455
  /**
453
456
  * handler will be called if handler is a function
454
457
  */
@@ -740,6 +743,8 @@ interface LsdPage extends EventEmitter {
740
743
  pageWidth(): Promise<number>;
741
744
  pdf(options?: PDFOptions): Promise<boolean>;
742
745
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
746
+ scrollBy(x: number, y: number): Promise<boolean>;
747
+ scrollTo(x: number, y: number): Promise<boolean>;
743
748
  setCookies(cookies: CookieItem[]): Promise<boolean>;
744
749
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
745
750
  /**
@@ -916,6 +921,8 @@ declare class PlaywrightPage extends EventEmitter implements LsdPage {
916
921
  pageWidth(): Promise<number>;
917
922
  pdf(options?: PDFOptions | undefined): Promise<boolean>;
918
923
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
924
+ scrollBy(x: number, y: number): Promise<boolean>;
925
+ scrollTo(x: number, y: number): Promise<boolean>;
919
926
  setCookies(cookies: CookieItem[]): Promise<boolean>;
920
927
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
921
928
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -952,9 +959,7 @@ declare class PlaywrightElement implements LsdElement {
952
959
  press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
953
960
  select(options: SelectOptions): Promise<boolean>;
954
961
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
955
- scrollBy(x: number, y: number): Promise<boolean>;
956
962
  scrollIntoView(): Promise<boolean>;
957
- scrollTo(x: number, y: number): Promise<boolean>;
958
963
  }
959
964
 
960
965
  declare class PuppeteerBrowser extends EventEmitter implements LsdBrowser {
@@ -1020,6 +1025,8 @@ declare class PuppeteerPage extends EventEmitter implements LsdPage {
1020
1025
  pageWidth(): Promise<number>;
1021
1026
  pdf(options?: PDFOptions | undefined): Promise<boolean>;
1022
1027
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1028
+ scrollBy(x: number, y: number): Promise<boolean>;
1029
+ scrollTo(x: number, y: number): Promise<boolean>;
1023
1030
  setCookies(cookies: CookieItem[]): Promise<boolean>;
1024
1031
  setExtraHTTPHeaders(headers: Record<string, string>): Promise<boolean>;
1025
1032
  setLocalStroage(localStorageItems: LocalStorageItem[]): Promise<boolean>;
@@ -1056,9 +1063,7 @@ declare class PuppeteerElement implements LsdElement {
1056
1063
  press(key: KeyInput, options?: KeyPressOptions): Promise<boolean>;
1057
1064
  select(options: SelectOptions): Promise<boolean>;
1058
1065
  screenshot(options?: ScreenshotOptions): Promise<Buffer>;
1059
- scrollBy(x: number, y: number): Promise<boolean>;
1060
1066
  scrollIntoView(): Promise<boolean>;
1061
- scrollTo(x: number, y: number): Promise<boolean>;
1062
1067
  }
1063
1068
 
1064
1069
  declare class CheerioPage extends EventEmitter implements LsdPage {
@@ -1089,6 +1094,8 @@ declare class CheerioPage extends EventEmitter implements LsdPage {
1089
1094
  pageWidth(): Promise<number>;
1090
1095
  pdf(): Promise<boolean>;
1091
1096
  screenshot(): Promise<Buffer>;
1097
+ scrollBy(): Promise<boolean>;
1098
+ scrollTo(): Promise<boolean>;
1092
1099
  setCookies(): Promise<boolean>;
1093
1100
  setExtraHTTPHeaders(): Promise<boolean>;
1094
1101
  setLocalStroage(): Promise<boolean>;
@@ -1111,8 +1118,8 @@ declare class CheerioElement implements LsdElement {
1111
1118
  constructor(node: CheerioNode);
1112
1119
  attribute(attributeName: string): Promise<string>;
1113
1120
  attributeNames(): Promise<string[]>;
1114
- findElement(selectorOrXpath: string | string[]): Promise<LsdElement | null>;
1115
- findElements(selectorOrXpath: string | string[]): Promise<LsdElement[]>;
1121
+ findElement(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement | null>;
1122
+ findElements(selectorOrXpath: string | string[], iframeOptions?: IframeOption[], absolute?: boolean): Promise<LsdElement[]>;
1116
1123
  hasAttribute(attributeName: string): Promise<boolean>;
1117
1124
  innerHtml(): Promise<string>;
1118
1125
  innerText(): Promise<string>;
@@ -1125,9 +1132,7 @@ declare class CheerioElement implements LsdElement {
1125
1132
  press(): Promise<boolean>;
1126
1133
  select(): Promise<boolean>;
1127
1134
  screenshot(): Promise<Buffer>;
1128
- scrollBy(): Promise<boolean>;
1129
1135
  scrollIntoView(): Promise<boolean>;
1130
- scrollTo(): Promise<boolean>;
1131
1136
  }
1132
1137
 
1133
1138
  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 };