automation_model 1.0.30 → 1.0.32
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 +21 -1
- package/package.json +1 -1
package/bin/stable_browser.js
CHANGED
|
@@ -97,7 +97,7 @@ class StableBrowser {
|
|
|
97
97
|
}
|
|
98
98
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
99
99
|
}
|
|
100
|
-
this.logger.
|
|
100
|
+
this.logger.debug("unable to locate unique element, total elements found " + locatorsCount);
|
|
101
101
|
info.log.push("failed to locate unique element, total elements found " + locatorsCount);
|
|
102
102
|
for (let i = 0; i < locatorsByPriority.length; i++) {
|
|
103
103
|
let locators = locatorsByPriority[i];
|
|
@@ -182,6 +182,26 @@ class StableBrowser {
|
|
|
182
182
|
throw e;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
+
async containsText(selector, text, _params = null, options = {}) {
|
|
186
|
+
const info = {};
|
|
187
|
+
info.log = [];
|
|
188
|
+
info.operation = "containsText";
|
|
189
|
+
info.selector = selector;
|
|
190
|
+
info.value = text;
|
|
191
|
+
try {
|
|
192
|
+
let element = await this._locate(selector, info, _params);
|
|
193
|
+
await this._screenShot(options);
|
|
194
|
+
await element.toContainText(text, { timeout: 10000 });
|
|
195
|
+
//fill(value, { timeout: 10000 });
|
|
196
|
+
//await element.dispatchEvent("change");
|
|
197
|
+
return info;
|
|
198
|
+
} catch (e) {
|
|
199
|
+
this.logger.error("verify element contains text failed " + JSON.stringify(info));
|
|
200
|
+
Object.assign(e, { info: info });
|
|
201
|
+
await this._screenShot(options);
|
|
202
|
+
throw e;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
185
205
|
async _screenShot(options = {}) {
|
|
186
206
|
if (options.screenshot) {
|
|
187
207
|
await this.page.screenshot({ path: options.screenshotPath });
|