@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.
- package/Dom.d.ts +1 -1
- package/Dom.js +6 -15
- 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<
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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