automation_model 1.0.36 → 1.0.38
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/bin/stable_browser.js +10 -4
- package/package.json +1 -1
package/bin/stable_browser.js
CHANGED
|
@@ -165,7 +165,7 @@ class StableBrowser {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
async fill(selector, value, _params = null, options = {}) {
|
|
168
|
+
async fill(selector, value, enter = false, _params = null, options = {}) {
|
|
169
169
|
const info = {};
|
|
170
170
|
info.log = [];
|
|
171
171
|
info.operation = "fill";
|
|
@@ -176,6 +176,9 @@ class StableBrowser {
|
|
|
176
176
|
await this._screenShot(options);
|
|
177
177
|
await element.fill(value, { timeout: 10000 });
|
|
178
178
|
await element.dispatchEvent("change");
|
|
179
|
+
if (enter) {
|
|
180
|
+
await this.page.keyboard.press("Enter");
|
|
181
|
+
}
|
|
179
182
|
await this.waitForPageLoad();
|
|
180
183
|
return info;
|
|
181
184
|
} catch (e) {
|
|
@@ -234,11 +237,14 @@ class StableBrowser {
|
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
239
|
async waitForPageLoad(options = {}) {
|
|
240
|
+
const waitOptions = {
|
|
241
|
+
timeout: 10000,
|
|
242
|
+
};
|
|
237
243
|
try {
|
|
238
244
|
await Promise.all([
|
|
239
|
-
this.page.waitForLoadState("networkidle"),
|
|
240
|
-
this.page.waitForLoadState("load"),
|
|
241
|
-
this.page.waitForLoadState("domcontentloaded"),
|
|
245
|
+
this.page.waitForLoadState("networkidle", waitOptions),
|
|
246
|
+
this.page.waitForLoadState("load", waitOptions),
|
|
247
|
+
this.page.waitForLoadState("domcontentloaded", waitOptions),
|
|
242
248
|
]);
|
|
243
249
|
} catch (e) {
|
|
244
250
|
console.log("waitForPageLoad error, ignored");
|