automation_model 1.0.54 → 1.0.56
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 -5
- package/package.json +1 -1
package/bin/stable_browser.js
CHANGED
|
@@ -66,7 +66,7 @@ class StableBrowser {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
async _locate(selectors, info, _params, timeout =
|
|
69
|
+
async _locate(selectors, info, _params, timeout = 30000) {
|
|
70
70
|
let locatorsByPriority = [];
|
|
71
71
|
let startTime = performance.now();
|
|
72
72
|
let locatorsCount = 0;
|
|
@@ -198,7 +198,12 @@ class StableBrowser {
|
|
|
198
198
|
}
|
|
199
199
|
let element = await this._locate(selector, info, _params);
|
|
200
200
|
await this._screenShot(options);
|
|
201
|
-
|
|
201
|
+
try {
|
|
202
|
+
return await element.innerText();
|
|
203
|
+
} catch (e) {
|
|
204
|
+
this.logger.info("no innerText will use textContent");
|
|
205
|
+
return await element.textContent();
|
|
206
|
+
}
|
|
202
207
|
}
|
|
203
208
|
async containsPattern(selector, pattern, text, _params = null, options = {}) {
|
|
204
209
|
const info = {};
|
|
@@ -366,13 +371,13 @@ class StableBrowser {
|
|
|
366
371
|
let timeout = 10000;
|
|
367
372
|
if (!configuration) {
|
|
368
373
|
try {
|
|
369
|
-
if (fs.existsSync("
|
|
370
|
-
configuration = JSON.parse(fs.readFileSync("
|
|
374
|
+
if (fs.existsSync("ai_config.json")) {
|
|
375
|
+
configuration = JSON.parse(fs.readFileSync("ai_config.json"));
|
|
371
376
|
} else {
|
|
372
377
|
configuration = {};
|
|
373
378
|
}
|
|
374
379
|
} catch (e) {
|
|
375
|
-
this.logger.error("unable to read
|
|
380
|
+
this.logger.error("unable to read ai_config.json");
|
|
376
381
|
}
|
|
377
382
|
}
|
|
378
383
|
if (configuration.page_timeout) {
|