@koalarx/scrapping 2.0.4 → 2.0.5

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.
Files changed (3) hide show
  1. package/Dom.d.ts +1 -1
  2. package/Dom.js +6 -15
  3. package/package.json +1 -1
package/Dom.d.ts CHANGED
@@ -18,6 +18,6 @@ export declare class DOM {
18
18
  getText(selector: string): Promise<string>;
19
19
  getDatatable<T = any>(selector: string, options?: GetDatatableOptions): Promise<T[]>;
20
20
  waitNavigation(): Promise<void>;
21
- waitIsVisible(selector: string, limitTime?: number): Promise<void>;
21
+ waitIsVisible(selector: string, limitTime?: number): Promise<boolean>;
22
22
  getDownloadedFiles(): Promise<Buffer<ArrayBufferLike>[]>;
23
23
  }
package/Dom.js CHANGED
@@ -107,21 +107,12 @@ class DOM {
107
107
  .catch(() => null);
108
108
  }
109
109
  async waitIsVisible(selector, limitTime = 10000) {
110
- let currentTime = 0;
111
- let intervalTime = 500;
112
- let element = null;
113
- do {
114
- element = await this._page
115
- .locator(selector)
116
- .wait()
117
- .catch(() => null);
118
- if (element) {
119
- break;
120
- }
121
- await (0, utils_1.delay)(intervalTime);
122
- currentTime += intervalTime;
123
- } while (!element && currentTime < limitTime);
124
- await this._page.locator(selector).scroll();
110
+ return this._page
111
+ .locator(selector)
112
+ .setTimeout(limitTime)
113
+ .scroll()
114
+ .then(() => true)
115
+ .catch(() => false);
125
116
  }
126
117
  async getDownloadedFiles() {
127
118
  const downloadPath = this._options?.downloadFolderPath ?? './downloads';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.4",
2
+ "version": "2.0.5",
3
3
  "name": "@koalarx/scrapping",
4
4
  "type": "module",
5
5
  "scripts": {