automation_model 1.0.506-dev → 1.0.506-stage
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/lib/api.d.ts +2 -1
- package/lib/api.js +98 -98
- package/lib/api.js.map +1 -1
- package/lib/auto_page.d.ts +2 -1
- package/lib/auto_page.js +19 -2
- package/lib/auto_page.js.map +1 -1
- package/lib/browser_manager.d.ts +6 -3
- package/lib/browser_manager.js +90 -32
- package/lib/browser_manager.js.map +1 -1
- package/lib/command_common.d.ts +1 -0
- package/lib/command_common.js +32 -4
- package/lib/command_common.js.map +1 -1
- package/lib/error-messages.js +8 -2
- package/lib/error-messages.js.map +1 -1
- package/lib/generation_scripts.d.ts +4 -0
- package/lib/generation_scripts.js +2 -0
- package/lib/generation_scripts.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/init_browser.d.ts +2 -1
- package/lib/init_browser.js +20 -6
- package/lib/init_browser.js.map +1 -1
- package/lib/locate_element.js +15 -13
- package/lib/locate_element.js.map +1 -1
- package/lib/locator.d.ts +36 -0
- package/lib/locator.js +165 -0
- package/lib/locator.js.map +1 -1
- package/lib/locator_log.d.ts +26 -0
- package/lib/locator_log.js +69 -0
- package/lib/locator_log.js.map +1 -0
- package/lib/network.js +16 -3
- package/lib/network.js.map +1 -1
- package/lib/stable_browser.d.ts +51 -13
- package/lib/stable_browser.js +498 -432
- package/lib/stable_browser.js.map +1 -1
- package/lib/table.d.ts +13 -0
- package/lib/table.js +187 -0
- package/lib/table.js.map +1 -0
- package/lib/test_context.d.ts +1 -0
- package/lib/test_context.js +1 -0
- package/lib/test_context.js.map +1 -1
- package/lib/utils.d.ts +13 -1
- package/lib/utils.js +298 -3
- package/lib/utils.js.map +1 -1
- package/package.json +6 -5
- /package/lib/{axe → scripts}/axe.mini.js +0 -0
package/lib/stable_browser.js
CHANGED
|
@@ -10,15 +10,17 @@ import { getDateTimeValue } from "./date_time.js";
|
|
|
10
10
|
import drawRectangle from "./drawRect.js";
|
|
11
11
|
//import { closeUnexpectedPopups } from "./popups.js";
|
|
12
12
|
import { getTableCells, getTableData } from "./table_analyze.js";
|
|
13
|
-
import { maskValue, replaceWithLocalTestData } from "./utils.js";
|
|
13
|
+
import { _convertToRegexQuery, _copyContext, _fixLocatorUsingParams, _fixUsingParams, _getServerUrl, KEYBOARD_EVENTS, maskValue, replaceWithLocalTestData, scrollPageToLoadLazyElements, unEscapeString, } from "./utils.js";
|
|
14
14
|
import csv from "csv-parser";
|
|
15
15
|
import { Readable } from "node:stream";
|
|
16
16
|
import readline from "readline";
|
|
17
17
|
import { getContext } from "./init_browser.js";
|
|
18
18
|
import { locate_element } from "./locate_element.js";
|
|
19
|
-
import {
|
|
19
|
+
import { randomUUID } from "crypto";
|
|
20
|
+
import { _commandError, _commandFinally, _preCommand, _validateSelectors, _screenshot, _reportToWorld, } from "./command_common.js";
|
|
20
21
|
import { registerDownloadEvent, registerNetworkEvents } from "./network.js";
|
|
21
|
-
|
|
22
|
+
import { LocatorLog } from "./locator_log.js";
|
|
23
|
+
export const Types = {
|
|
22
24
|
CLICK: "click_element",
|
|
23
25
|
NAVIGATE: "navigate",
|
|
24
26
|
FILL: "fill_element",
|
|
@@ -29,6 +31,8 @@ const Types = {
|
|
|
29
31
|
GET_PAGE_STATUS: "get_page_status",
|
|
30
32
|
CLICK_ROW_ACTION: "click_row_action",
|
|
31
33
|
VERIFY_ELEMENT_CONTAINS_TEXT: "verify_element_contains_text",
|
|
34
|
+
VERIFY_PAGE_CONTAINS_TEXT: "verify_page_contains_text",
|
|
35
|
+
VERIFY_PAGE_CONTAINS_NO_TEXT: "verify_page_contains_no_text",
|
|
32
36
|
ANALYZE_TABLE: "analyze_table",
|
|
33
37
|
SELECT: "select_combobox",
|
|
34
38
|
VERIFY_PAGE_PATH: "verify_page_path",
|
|
@@ -44,6 +48,9 @@ const Types = {
|
|
|
44
48
|
VERIFY_VISUAL: "verify_visual",
|
|
45
49
|
LOAD_DATA: "load_data",
|
|
46
50
|
SET_INPUT: "set_input",
|
|
51
|
+
WAIT_FOR_TEXT_TO_DISAPPEAR: "wait_for_text_to_disappear",
|
|
52
|
+
VERIFY_ATTRIBUTE: "verify_element_attribute",
|
|
53
|
+
VERIFY_TEXT_WITH_RELATION: "verify_text_with_relation",
|
|
47
54
|
};
|
|
48
55
|
export const apps = {};
|
|
49
56
|
class StableBrowser {
|
|
@@ -57,6 +64,7 @@ class StableBrowser {
|
|
|
57
64
|
networkLogger = null;
|
|
58
65
|
configuration = null;
|
|
59
66
|
appName = "main";
|
|
67
|
+
tags = null;
|
|
60
68
|
constructor(browser, page, logger = null, context = null, world = null) {
|
|
61
69
|
this.browser = browser;
|
|
62
70
|
this.page = page;
|
|
@@ -87,17 +95,17 @@ class StableBrowser {
|
|
|
87
95
|
catch (e) {
|
|
88
96
|
this.logger.error("unable to read ai_config.json");
|
|
89
97
|
}
|
|
90
|
-
context.pageLoading = { status: false };
|
|
91
|
-
context.pages = [this.page];
|
|
92
98
|
const logFolder = path.join(this.project_path, "logs", "web");
|
|
93
99
|
this.world = world;
|
|
100
|
+
context.pages = [this.page];
|
|
101
|
+
context.pageLoading = { status: false };
|
|
94
102
|
this.registerEventListeners(this.context);
|
|
95
103
|
registerNetworkEvents(this.world, this, this.context, this.page);
|
|
96
104
|
registerDownloadEvent(this.page, this.world, this.context);
|
|
97
105
|
}
|
|
98
106
|
registerEventListeners(context) {
|
|
99
107
|
this.registerConsoleLogListener(this.page, context);
|
|
100
|
-
this.registerRequestListener(this.page, context, this.webLogFile);
|
|
108
|
+
// this.registerRequestListener(this.page, context, this.webLogFile);
|
|
101
109
|
if (!context.pageLoading) {
|
|
102
110
|
context.pageLoading = { status: false };
|
|
103
111
|
}
|
|
@@ -142,9 +150,9 @@ class StableBrowser {
|
|
|
142
150
|
if (this.appName === appName) {
|
|
143
151
|
return;
|
|
144
152
|
}
|
|
145
|
-
let
|
|
153
|
+
let navigate = false;
|
|
146
154
|
if (!apps[appName]) {
|
|
147
|
-
let newContext = await getContext(null, this.context.headless ? this.context.headless : false, this, this.logger, appName, false, this);
|
|
155
|
+
let newContext = await getContext(null, this.context.headless ? this.context.headless : false, this, this.logger, appName, false, this, -1, this.context.reportFolder);
|
|
148
156
|
newContextCreated = true;
|
|
149
157
|
apps[appName] = {
|
|
150
158
|
context: newContext,
|
|
@@ -153,32 +161,15 @@ class StableBrowser {
|
|
|
153
161
|
};
|
|
154
162
|
}
|
|
155
163
|
const tempContext = {};
|
|
156
|
-
|
|
157
|
-
|
|
164
|
+
_copyContext(this, tempContext);
|
|
165
|
+
_copyContext(apps[appName], this);
|
|
158
166
|
apps[this.appName] = tempContext;
|
|
159
167
|
this.appName = appName;
|
|
160
|
-
if (
|
|
161
|
-
this.registerEventListeners(this.context);
|
|
168
|
+
if (navigate) {
|
|
162
169
|
await this.goto(this.context.environment.baseUrl);
|
|
163
170
|
await this.waitForPageLoad();
|
|
164
171
|
}
|
|
165
172
|
}
|
|
166
|
-
_copyContext(from, to) {
|
|
167
|
-
to.browser = from.browser;
|
|
168
|
-
to.page = from.page;
|
|
169
|
-
to.context = from.context;
|
|
170
|
-
}
|
|
171
|
-
getWebLogFile(logFolder) {
|
|
172
|
-
if (!fs.existsSync(logFolder)) {
|
|
173
|
-
fs.mkdirSync(logFolder, { recursive: true });
|
|
174
|
-
}
|
|
175
|
-
let nextIndex = 1;
|
|
176
|
-
while (fs.existsSync(path.join(logFolder, nextIndex.toString() + ".json"))) {
|
|
177
|
-
nextIndex++;
|
|
178
|
-
}
|
|
179
|
-
const fileName = nextIndex + ".json";
|
|
180
|
-
return path.join(logFolder, fileName);
|
|
181
|
-
}
|
|
182
173
|
registerConsoleLogListener(page, context) {
|
|
183
174
|
if (!this.context.webLogger) {
|
|
184
175
|
this.context.webLogger = [];
|
|
@@ -228,7 +219,7 @@ class StableBrowser {
|
|
|
228
219
|
this.world?.attach(JSON.stringify(obj), { mediaType: "application/json+network" });
|
|
229
220
|
}
|
|
230
221
|
catch (error) {
|
|
231
|
-
console.error("Error in request listener", error);
|
|
222
|
+
// console.error("Error in request listener", error);
|
|
232
223
|
context.networkLogger.push({
|
|
233
224
|
error: "not able to listen",
|
|
234
225
|
message: error.message,
|
|
@@ -242,55 +233,48 @@ class StableBrowser {
|
|
|
242
233
|
// async closeUnexpectedPopups() {
|
|
243
234
|
// await closeUnexpectedPopups(this.page);
|
|
244
235
|
// }
|
|
245
|
-
async goto(url) {
|
|
236
|
+
async goto(url, world = null) {
|
|
246
237
|
if (!url.startsWith("http")) {
|
|
247
238
|
url = "https://" + url;
|
|
248
239
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
240
|
+
const state = {
|
|
241
|
+
value: url,
|
|
242
|
+
world: world,
|
|
243
|
+
type: Types.NAVIGATE,
|
|
244
|
+
text: `Navigate Page to: ${url}`,
|
|
245
|
+
operation: "goto",
|
|
246
|
+
log: "***** navigate page to " + url + " *****\n",
|
|
247
|
+
info: {},
|
|
248
|
+
locate: false,
|
|
249
|
+
scroll: false,
|
|
250
|
+
screenshot: false,
|
|
251
|
+
highlight: false,
|
|
252
|
+
};
|
|
253
|
+
try {
|
|
254
|
+
await _preCommand(state, this);
|
|
255
|
+
await this.page.goto(url, {
|
|
256
|
+
timeout: 60000,
|
|
257
|
+
});
|
|
258
|
+
await _screenshot(state, this);
|
|
256
259
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// remove the _ prefix
|
|
261
|
-
regValue = key.substring(1);
|
|
262
|
-
}
|
|
263
|
-
text = text.replaceAll(new RegExp("{" + regValue + "}", "g"), _params[key]);
|
|
260
|
+
catch (error) {
|
|
261
|
+
console.error("Error on goto", error);
|
|
262
|
+
_commandError(state, error, this);
|
|
264
263
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
_fixLocatorUsingParams(locator, _params) {
|
|
268
|
-
// check if not null
|
|
269
|
-
if (!locator) {
|
|
270
|
-
return locator;
|
|
264
|
+
finally {
|
|
265
|
+
_commandFinally(state, this);
|
|
271
266
|
}
|
|
272
|
-
// clone the locator
|
|
273
|
-
locator = JSON.parse(JSON.stringify(locator));
|
|
274
|
-
this.scanAndManipulate(locator, _params);
|
|
275
|
-
return locator;
|
|
276
|
-
}
|
|
277
|
-
_isObject(value) {
|
|
278
|
-
return value && typeof value === "object" && value.constructor === Object;
|
|
279
267
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this.scanAndManipulate(currentObj[key], _params);
|
|
268
|
+
async _getLocator(locator, scope, _params) {
|
|
269
|
+
locator = _fixLocatorUsingParams(locator, _params);
|
|
270
|
+
// locator = await this._replaceWithLocalData(locator);
|
|
271
|
+
for (let key in locator) {
|
|
272
|
+
if (typeof locator[key] !== "string")
|
|
273
|
+
continue;
|
|
274
|
+
if (locator[key].includes("{{") && locator[key].includes("}}")) {
|
|
275
|
+
locator[key] = await this._replaceWithLocalData(locator[key], this.world);
|
|
289
276
|
}
|
|
290
277
|
}
|
|
291
|
-
}
|
|
292
|
-
_getLocator(locator, scope, _params) {
|
|
293
|
-
locator = this._fixLocatorUsingParams(locator, _params);
|
|
294
278
|
let locatorReturn;
|
|
295
279
|
if (locator.role) {
|
|
296
280
|
if (locator.role[1].nameReg) {
|
|
@@ -298,7 +282,7 @@ class StableBrowser {
|
|
|
298
282
|
delete locator.role[1].nameReg;
|
|
299
283
|
}
|
|
300
284
|
// if (locator.role[1].name) {
|
|
301
|
-
// locator.role[1].name =
|
|
285
|
+
// locator.role[1].name = _fixUsingParams(locator.role[1].name, _params);
|
|
302
286
|
// }
|
|
303
287
|
locatorReturn = scope.getByRole(locator.role[0], locator.role[1]);
|
|
304
288
|
}
|
|
@@ -341,143 +325,69 @@ class StableBrowser {
|
|
|
341
325
|
if (css && css.locator) {
|
|
342
326
|
css = css.locator;
|
|
343
327
|
}
|
|
344
|
-
let result = await this._locateElementByText(scope,
|
|
328
|
+
let result = await this._locateElementByText(scope, _fixUsingParams(text, _params), "*:not(script, style, head)", false, false, true, _params);
|
|
345
329
|
if (result.elementCount === 0) {
|
|
346
330
|
return;
|
|
347
331
|
}
|
|
348
|
-
let textElementCss = "[data-blinq-id
|
|
332
|
+
let textElementCss = "[data-blinq-id-" + result.randomToken + "]";
|
|
349
333
|
// css climb to parent element
|
|
350
334
|
const climbArray = [];
|
|
351
335
|
for (let i = 0; i < climb; i++) {
|
|
352
336
|
climbArray.push("..");
|
|
353
337
|
}
|
|
354
338
|
let climbXpath = "xpath=" + climbArray.join("/");
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
339
|
+
let resultCss = textElementCss + " >> " + climbXpath;
|
|
340
|
+
if (css) {
|
|
341
|
+
resultCss = resultCss + " >> " + css;
|
|
342
|
+
}
|
|
343
|
+
return resultCss;
|
|
344
|
+
}
|
|
345
|
+
async _locateElementByText(scope, text1, tag1, regex1 = false, partial1, ignoreCase = true, _params) {
|
|
346
|
+
const query = _convertToRegexQuery(text1, regex1, !partial1, ignoreCase);
|
|
347
|
+
const locator = scope.locator(query);
|
|
348
|
+
const count = await locator.count();
|
|
349
|
+
if (!tag1) {
|
|
350
|
+
tag1 = "*";
|
|
351
|
+
}
|
|
352
|
+
const randomToken = Math.random().toString(36).substring(7);
|
|
353
|
+
let tagCount = 0;
|
|
354
|
+
for (let i = 0; i < count; i++) {
|
|
355
|
+
const element = locator.nth(i);
|
|
356
|
+
// check if the tag matches
|
|
357
|
+
if (!(await element.evaluate((el, [tag, randomToken]) => {
|
|
358
|
+
if (!tag.startsWith("*")) {
|
|
359
|
+
if (el.tagName.toLowerCase() !== tag) {
|
|
360
|
+
return false;
|
|
365
361
|
}
|
|
366
|
-
currentNode = currentNode.parentNode;
|
|
367
|
-
}
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
document.isParent = isParent;
|
|
371
|
-
function getRegex(str) {
|
|
372
|
-
const match = str.match(/^\/(.*?)\/([gimuy]*)$/);
|
|
373
|
-
if (!match) {
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
let [_, pattern, flags] = match;
|
|
377
|
-
return new RegExp(pattern, flags);
|
|
378
|
-
}
|
|
379
|
-
document.getRegex = getRegex;
|
|
380
|
-
function collectAllShadowDomElements(element, result = []) {
|
|
381
|
-
// Check and add the element if it has a shadow root
|
|
382
|
-
if (element.shadowRoot) {
|
|
383
|
-
result.push(element);
|
|
384
|
-
// Also search within the shadow root
|
|
385
|
-
document.collectAllShadowDomElements(element.shadowRoot, result);
|
|
386
|
-
}
|
|
387
|
-
// Iterate over child nodes
|
|
388
|
-
element.childNodes.forEach((child) => {
|
|
389
|
-
// Recursively call the function for each child node
|
|
390
|
-
document.collectAllShadowDomElements(child, result);
|
|
391
|
-
});
|
|
392
|
-
return result;
|
|
393
|
-
}
|
|
394
|
-
document.collectAllShadowDomElements = collectAllShadowDomElements;
|
|
395
|
-
if (!tag) {
|
|
396
|
-
tag = "*:not(script, style, head)";
|
|
397
|
-
}
|
|
398
|
-
let regexpSearch = document.getRegex(text);
|
|
399
|
-
if (regexpSearch) {
|
|
400
|
-
regex = true;
|
|
401
|
-
}
|
|
402
|
-
let elements = Array.from(document.querySelectorAll(tag));
|
|
403
|
-
let shadowHosts = [];
|
|
404
|
-
document.collectAllShadowDomElements(document, shadowHosts);
|
|
405
|
-
for (let i = 0; i < shadowHosts.length; i++) {
|
|
406
|
-
let shadowElement = shadowHosts[i].shadowRoot;
|
|
407
|
-
if (!shadowElement) {
|
|
408
|
-
console.log("shadowElement is null, for host " + shadowHosts[i]);
|
|
409
|
-
continue;
|
|
410
362
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
let randomToken = null;
|
|
415
|
-
const foundElements = [];
|
|
416
|
-
if (regex) {
|
|
417
|
-
if (!regexpSearch) {
|
|
418
|
-
regexpSearch = new RegExp(text, "im");
|
|
419
|
-
}
|
|
420
|
-
for (let i = 0; i < elements.length; i++) {
|
|
421
|
-
const element = elements[i];
|
|
422
|
-
if ((element.innerText && regexpSearch.test(element.innerText)) ||
|
|
423
|
-
(element.value && regexpSearch.test(element.value))) {
|
|
424
|
-
foundElements.push(element);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
text = text.trim();
|
|
430
|
-
for (let i = 0; i < elements.length; i++) {
|
|
431
|
-
const element = elements[i];
|
|
432
|
-
if (partial) {
|
|
433
|
-
if ((element.innerText && element.innerText.toLowerCase().trim().includes(text.toLowerCase())) ||
|
|
434
|
-
(element.value && element.value.toLowerCase().includes(text.toLowerCase()))) {
|
|
435
|
-
foundElements.push(element);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
if ((element.innerText && element.innerText.trim() === text) ||
|
|
440
|
-
(element.value && element.value === text)) {
|
|
441
|
-
foundElements.push(element);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
let noChildElements = [];
|
|
447
|
-
for (let i = 0; i < foundElements.length; i++) {
|
|
448
|
-
let element = foundElements[i];
|
|
449
|
-
let hasChild = false;
|
|
450
|
-
for (let j = 0; j < foundElements.length; j++) {
|
|
451
|
-
if (i === j) {
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
if (isParent(element, foundElements[j])) {
|
|
455
|
-
hasChild = true;
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
if (!hasChild) {
|
|
460
|
-
noChildElements.push(element);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
let elementCount = 0;
|
|
464
|
-
if (noChildElements.length > 0) {
|
|
465
|
-
for (let i = 0; i < noChildElements.length; i++) {
|
|
466
|
-
if (randomToken === null) {
|
|
467
|
-
randomToken = Math.random().toString(36).substring(7);
|
|
468
|
-
}
|
|
469
|
-
let element = noChildElements[i];
|
|
470
|
-
element.setAttribute("data-blinq-id", "blinq-id-" + randomToken);
|
|
471
|
-
elementCount++;
|
|
363
|
+
if (!el.setAttribute) {
|
|
364
|
+
el = el.parentElement;
|
|
472
365
|
}
|
|
366
|
+
el.setAttribute("data-blinq-id-" + randomToken, "");
|
|
367
|
+
return true;
|
|
368
|
+
}, [tag1, randomToken]))) {
|
|
369
|
+
continue;
|
|
473
370
|
}
|
|
474
|
-
|
|
475
|
-
}
|
|
371
|
+
tagCount++;
|
|
372
|
+
}
|
|
373
|
+
return { elementCount: tagCount, randomToken };
|
|
476
374
|
}
|
|
477
375
|
async _collectLocatorInformation(selectorHierarchy, index = 0, scope, foundLocators, _params, info, visibleOnly = true) {
|
|
376
|
+
if (!info) {
|
|
377
|
+
info = {};
|
|
378
|
+
}
|
|
379
|
+
if (!info.failCause) {
|
|
380
|
+
info.failCause = {};
|
|
381
|
+
}
|
|
382
|
+
if (!info.log) {
|
|
383
|
+
info.log = "";
|
|
384
|
+
info.locatorLog = new LocatorLog(selectorHierarchy);
|
|
385
|
+
}
|
|
478
386
|
let locatorSearch = selectorHierarchy[index];
|
|
387
|
+
let originalLocatorSearch = "";
|
|
479
388
|
try {
|
|
480
|
-
|
|
389
|
+
originalLocatorSearch = _fixUsingParams(JSON.stringify(locatorSearch), _params);
|
|
390
|
+
locatorSearch = JSON.parse(originalLocatorSearch);
|
|
481
391
|
}
|
|
482
392
|
catch (e) {
|
|
483
393
|
console.error(e);
|
|
@@ -491,24 +401,24 @@ class StableBrowser {
|
|
|
491
401
|
info.failCause.lastError = "failed to locate element by text: " + locatorSearch.text;
|
|
492
402
|
return;
|
|
493
403
|
}
|
|
494
|
-
locator = this._getLocator({ css: locatorString }, scope, _params);
|
|
404
|
+
locator = await this._getLocator({ css: locatorString }, scope, _params);
|
|
495
405
|
}
|
|
496
406
|
else if (locatorSearch.text) {
|
|
497
|
-
let text =
|
|
498
|
-
let result = await this._locateElementByText(scope, text, locatorSearch.tag, false, locatorSearch.partial === true, _params);
|
|
407
|
+
let text = _fixUsingParams(locatorSearch.text, _params);
|
|
408
|
+
let result = await this._locateElementByText(scope, text, locatorSearch.tag, false, locatorSearch.partial === true, true, _params);
|
|
499
409
|
if (result.elementCount === 0) {
|
|
500
410
|
info.failCause.textNotFound = true;
|
|
501
411
|
info.failCause.lastError = "failed to locate element by text: " + text;
|
|
502
412
|
return;
|
|
503
413
|
}
|
|
504
|
-
locatorSearch.css = "[data-blinq-id
|
|
414
|
+
locatorSearch.css = "[data-blinq-id-" + result.randomToken + "]";
|
|
505
415
|
if (locatorSearch.childCss) {
|
|
506
416
|
locatorSearch.css = locatorSearch.css + " " + locatorSearch.childCss;
|
|
507
417
|
}
|
|
508
|
-
locator = this._getLocator(locatorSearch, scope, _params);
|
|
418
|
+
locator = await this._getLocator(locatorSearch, scope, _params);
|
|
509
419
|
}
|
|
510
420
|
else {
|
|
511
|
-
locator = this._getLocator(locatorSearch, scope, _params);
|
|
421
|
+
locator = await this._getLocator(locatorSearch, scope, _params);
|
|
512
422
|
}
|
|
513
423
|
// let cssHref = false;
|
|
514
424
|
// if (locatorSearch.css && locatorSearch.css.includes("href=")) {
|
|
@@ -521,10 +431,16 @@ class StableBrowser {
|
|
|
521
431
|
//info.log += "total elements found " + count + "\n";
|
|
522
432
|
//let visibleCount = 0;
|
|
523
433
|
let visibleLocator = null;
|
|
524
|
-
if (locatorSearch.index && locatorSearch.index < count) {
|
|
434
|
+
if (typeof locatorSearch.index === "number" && locatorSearch.index < count) {
|
|
525
435
|
foundLocators.push(locator.nth(locatorSearch.index));
|
|
436
|
+
if (info.locatorLog) {
|
|
437
|
+
info.locatorLog.setLocatorSearchStatus(originalLocatorSearch, "FOUND");
|
|
438
|
+
}
|
|
526
439
|
return;
|
|
527
440
|
}
|
|
441
|
+
if (info.locatorLog && count === 0) {
|
|
442
|
+
info.locatorLog.setLocatorSearchStatus(originalLocatorSearch, "NOT_FOUND");
|
|
443
|
+
}
|
|
528
444
|
for (let j = 0; j < count; j++) {
|
|
529
445
|
let visible = await locator.nth(j).isVisible();
|
|
530
446
|
const enabled = await locator.nth(j).isEnabled();
|
|
@@ -533,6 +449,9 @@ class StableBrowser {
|
|
|
533
449
|
}
|
|
534
450
|
if (visible && enabled) {
|
|
535
451
|
foundLocators.push(locator.nth(j));
|
|
452
|
+
if (info.locatorLog) {
|
|
453
|
+
info.locatorLog.setLocatorSearchStatus(originalLocatorSearch, "FOUND");
|
|
454
|
+
}
|
|
536
455
|
}
|
|
537
456
|
else {
|
|
538
457
|
info.failCause.visible = visible;
|
|
@@ -540,8 +459,14 @@ class StableBrowser {
|
|
|
540
459
|
if (!info.printMessages) {
|
|
541
460
|
info.printMessages = {};
|
|
542
461
|
}
|
|
462
|
+
if (info.locatorLog && !visible) {
|
|
463
|
+
info.locatorLog.setLocatorSearchStatus(originalLocatorSearch, "FOUND_NOT_VISIBLE");
|
|
464
|
+
}
|
|
465
|
+
if (info.locatorLog && !enabled) {
|
|
466
|
+
info.locatorLog.setLocatorSearchStatus(originalLocatorSearch, "FOUND_NOT_ENABLED");
|
|
467
|
+
}
|
|
543
468
|
if (!info.printMessages[j.toString()]) {
|
|
544
|
-
info.log += "element " + locator + " visible " + visible + " enabled " + enabled + "\n";
|
|
469
|
+
//info.log += "element " + locator + " visible " + visible + " enabled " + enabled + "\n";
|
|
545
470
|
info.printMessages[j.toString()] = true;
|
|
546
471
|
}
|
|
547
472
|
}
|
|
@@ -557,7 +482,7 @@ class StableBrowser {
|
|
|
557
482
|
if (!info) {
|
|
558
483
|
info = {};
|
|
559
484
|
}
|
|
560
|
-
info.log += "scan for popup handlers" + "\n";
|
|
485
|
+
//info.log += "scan for popup handlers" + "\n";
|
|
561
486
|
const handlerGroup = [];
|
|
562
487
|
for (let i = 0; i < this.configuration.popupHandlers.length; i++) {
|
|
563
488
|
handlerGroup.push(this.configuration.popupHandlers[i].locator);
|
|
@@ -584,9 +509,21 @@ class StableBrowser {
|
|
|
584
509
|
}
|
|
585
510
|
if (result.foundElements.length > 0) {
|
|
586
511
|
let dialogCloseLocator = result.foundElements[0].locator;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
512
|
+
try {
|
|
513
|
+
await scope?.evaluate(() => {
|
|
514
|
+
window.__isClosingPopups = true;
|
|
515
|
+
});
|
|
516
|
+
await dialogCloseLocator.click();
|
|
517
|
+
// wait for the dialog to close
|
|
518
|
+
await dialogCloseLocator.waitFor({ state: "hidden" });
|
|
519
|
+
}
|
|
520
|
+
catch (e) {
|
|
521
|
+
}
|
|
522
|
+
finally {
|
|
523
|
+
await scope?.evaluate(() => {
|
|
524
|
+
window.__isClosingPopups = false;
|
|
525
|
+
});
|
|
526
|
+
}
|
|
590
527
|
return { rerun: true };
|
|
591
528
|
}
|
|
592
529
|
}
|
|
@@ -616,6 +553,7 @@ class StableBrowser {
|
|
|
616
553
|
info.failCause = {};
|
|
617
554
|
info.log = "";
|
|
618
555
|
}
|
|
556
|
+
let startTime = Date.now();
|
|
619
557
|
let scope = this.page;
|
|
620
558
|
if (selectors.frame) {
|
|
621
559
|
return selectors.frame;
|
|
@@ -646,9 +584,11 @@ class StableBrowser {
|
|
|
646
584
|
}
|
|
647
585
|
return framescope;
|
|
648
586
|
};
|
|
587
|
+
let fLocator = null;
|
|
649
588
|
while (true) {
|
|
650
589
|
let frameFound = false;
|
|
651
590
|
if (selectors.nestFrmLoc) {
|
|
591
|
+
fLocator = selectors.nestFrmLoc;
|
|
652
592
|
scope = await findFrame(selectors.nestFrmLoc, scope);
|
|
653
593
|
frameFound = true;
|
|
654
594
|
break;
|
|
@@ -657,6 +597,7 @@ class StableBrowser {
|
|
|
657
597
|
for (let i = 0; i < selectors.frameLocators.length; i++) {
|
|
658
598
|
let frameLocator = selectors.frameLocators[i];
|
|
659
599
|
if (frameLocator.css) {
|
|
600
|
+
fLocator = frameLocator.css;
|
|
660
601
|
scope = scope.frameLocator(frameLocator.css);
|
|
661
602
|
frameFound = true;
|
|
662
603
|
break;
|
|
@@ -664,11 +605,15 @@ class StableBrowser {
|
|
|
664
605
|
}
|
|
665
606
|
}
|
|
666
607
|
if (!frameFound && selectors.iframe_src) {
|
|
608
|
+
fLocator = selectors.iframe_src;
|
|
667
609
|
scope = this.page.frame({ url: selectors.iframe_src });
|
|
668
610
|
}
|
|
669
611
|
if (!scope) {
|
|
670
|
-
info
|
|
671
|
-
|
|
612
|
+
if (info && info.locatorLog) {
|
|
613
|
+
info.locatorLog.setLocatorSearchStatus("frame-" + fLocator, "NOT_FOUND");
|
|
614
|
+
}
|
|
615
|
+
//info.log += "unable to locate iframe " + selectors.iframe_src + "\n";
|
|
616
|
+
if (Date.now() - startTime > timeout) {
|
|
672
617
|
info.failCause.iframeNotFound = true;
|
|
673
618
|
info.failCause.lastError = "unable to locate iframe " + selectors.iframe_src;
|
|
674
619
|
throw new Error("unable to locate iframe " + selectors.iframe_src);
|
|
@@ -676,6 +621,9 @@ class StableBrowser {
|
|
|
676
621
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
677
622
|
}
|
|
678
623
|
else {
|
|
624
|
+
if (info && info.locatorLog) {
|
|
625
|
+
info.locatorLog.setLocatorSearchStatus("frame-" + fLocator, "FOUND");
|
|
626
|
+
}
|
|
679
627
|
break;
|
|
680
628
|
}
|
|
681
629
|
}
|
|
@@ -697,11 +645,13 @@ class StableBrowser {
|
|
|
697
645
|
info = {};
|
|
698
646
|
info.failCause = {};
|
|
699
647
|
info.log = "";
|
|
648
|
+
info.locatorLog = new LocatorLog(selectors);
|
|
700
649
|
}
|
|
701
650
|
let highPriorityTimeout = 5000;
|
|
702
651
|
let visibleOnlyTimeout = 6000;
|
|
703
|
-
let startTime =
|
|
652
|
+
let startTime = Date.now();
|
|
704
653
|
let locatorsCount = 0;
|
|
654
|
+
let lazy_scroll = false;
|
|
705
655
|
//let arrayMode = Array.isArray(selectors);
|
|
706
656
|
let scope = await this._findFrameScope(selectors, timeout, info);
|
|
707
657
|
let selectorsLocators = null;
|
|
@@ -790,21 +740,31 @@ class StableBrowser {
|
|
|
790
740
|
return maxCountElement.locator;
|
|
791
741
|
}
|
|
792
742
|
}
|
|
793
|
-
if (
|
|
743
|
+
if (Date.now() - startTime > timeout) {
|
|
794
744
|
break;
|
|
795
745
|
}
|
|
796
|
-
if (
|
|
797
|
-
info.log += "high priority timeout, will try all elements" + "\n";
|
|
746
|
+
if (Date.now() - startTime > highPriorityTimeout) {
|
|
747
|
+
//info.log += "high priority timeout, will try all elements" + "\n";
|
|
798
748
|
highPriorityOnly = false;
|
|
749
|
+
if (this.configuration && this.configuration.load_all_lazy === true && !lazy_scroll) {
|
|
750
|
+
lazy_scroll = true;
|
|
751
|
+
await scrollPageToLoadLazyElements(this.page);
|
|
752
|
+
}
|
|
799
753
|
}
|
|
800
|
-
if (
|
|
801
|
-
info.log += "visible only timeout, will try all elements" + "\n";
|
|
754
|
+
if (Date.now() - startTime > visibleOnlyTimeout) {
|
|
755
|
+
//info.log += "visible only timeout, will try all elements" + "\n";
|
|
802
756
|
visibleOnly = false;
|
|
803
757
|
}
|
|
804
758
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
805
759
|
}
|
|
806
760
|
this.logger.debug("unable to locate unique element, total elements found " + locatorsCount);
|
|
807
|
-
info.
|
|
761
|
+
// if (info.locatorLog) {
|
|
762
|
+
// const lines = info.locatorLog.toString().split("\n");
|
|
763
|
+
// for (let line of lines) {
|
|
764
|
+
// this.logger.debug(line);
|
|
765
|
+
// }
|
|
766
|
+
// }
|
|
767
|
+
//info.log += "failed to locate unique element, total elements found " + locatorsCount + "\n";
|
|
808
768
|
info.failCause.locatorNotFound = true;
|
|
809
769
|
info.failCause.lastError = "failed to locate unique element";
|
|
810
770
|
throw new Error("failed to locate first element no elements found, " + info.log);
|
|
@@ -820,8 +780,9 @@ class StableBrowser {
|
|
|
820
780
|
await this._collectLocatorInformation(locatorsGroup, i, scope, foundLocators, _params, info, visibleOnly);
|
|
821
781
|
}
|
|
822
782
|
catch (e) {
|
|
823
|
-
this
|
|
824
|
-
this.logger.debug(
|
|
783
|
+
// this call can fail it the browser is navigating
|
|
784
|
+
// this.logger.debug("unable to use locator " + JSON.stringify(locatorsGroup[i]));
|
|
785
|
+
// this.logger.debug(e);
|
|
825
786
|
foundLocators = [];
|
|
826
787
|
try {
|
|
827
788
|
await this._collectLocatorInformation(locatorsGroup, i, this.page, foundLocators, _params, info, visibleOnly);
|
|
@@ -840,11 +801,27 @@ class StableBrowser {
|
|
|
840
801
|
}
|
|
841
802
|
if (foundLocators.length > 1) {
|
|
842
803
|
info.failCause.foundMultiple = true;
|
|
804
|
+
if (info.locatorLog) {
|
|
805
|
+
info.locatorLog.setLocatorSearchStatus(JSON.stringify(locatorsGroup[i]), "FOUND_NOT_UNIQUE");
|
|
806
|
+
}
|
|
843
807
|
}
|
|
844
808
|
}
|
|
845
809
|
return result;
|
|
846
810
|
}
|
|
847
811
|
async simpleClick(elementDescription, _params, options = {}, world = null) {
|
|
812
|
+
const state = {
|
|
813
|
+
locate: false,
|
|
814
|
+
scroll: false,
|
|
815
|
+
highlight: false,
|
|
816
|
+
_params,
|
|
817
|
+
options,
|
|
818
|
+
world,
|
|
819
|
+
type: Types.CLICK,
|
|
820
|
+
text: "Click element",
|
|
821
|
+
operation: "simpleClick",
|
|
822
|
+
log: "***** click on " + elementDescription + " *****\n",
|
|
823
|
+
};
|
|
824
|
+
_preCommand(state, this);
|
|
848
825
|
const startTime = Date.now();
|
|
849
826
|
let timeout = 30000;
|
|
850
827
|
if (options && options.timeout) {
|
|
@@ -869,13 +846,31 @@ class StableBrowser {
|
|
|
869
846
|
catch (e) {
|
|
870
847
|
if (performance.now() - startTime > timeout) {
|
|
871
848
|
// throw e;
|
|
872
|
-
|
|
849
|
+
try {
|
|
850
|
+
await _commandError(state, "timeout looking for " + elementDescription, this);
|
|
851
|
+
}
|
|
852
|
+
finally {
|
|
853
|
+
_commandFinally(state, this);
|
|
854
|
+
}
|
|
873
855
|
}
|
|
874
856
|
}
|
|
875
857
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
876
858
|
}
|
|
877
859
|
}
|
|
878
860
|
async simpleClickType(elementDescription, value, _params, options = {}, world = null) {
|
|
861
|
+
const state = {
|
|
862
|
+
locate: false,
|
|
863
|
+
scroll: false,
|
|
864
|
+
highlight: false,
|
|
865
|
+
_params,
|
|
866
|
+
options,
|
|
867
|
+
world,
|
|
868
|
+
type: Types.FILL,
|
|
869
|
+
text: "Fill element",
|
|
870
|
+
operation: "simpleClickType",
|
|
871
|
+
log: "***** click type on " + elementDescription + " *****\n",
|
|
872
|
+
};
|
|
873
|
+
_preCommand(state, this);
|
|
879
874
|
const startTime = Date.now();
|
|
880
875
|
let timeout = 30000;
|
|
881
876
|
if (options && options.timeout) {
|
|
@@ -900,7 +895,12 @@ class StableBrowser {
|
|
|
900
895
|
catch (e) {
|
|
901
896
|
if (performance.now() - startTime > timeout) {
|
|
902
897
|
// throw e;
|
|
903
|
-
|
|
898
|
+
try {
|
|
899
|
+
await _commandError(state, "timeout looking for " + elementDescription, this);
|
|
900
|
+
}
|
|
901
|
+
finally {
|
|
902
|
+
_commandFinally(state, this);
|
|
903
|
+
}
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
906
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
@@ -919,18 +919,18 @@ class StableBrowser {
|
|
|
919
919
|
};
|
|
920
920
|
try {
|
|
921
921
|
await _preCommand(state, this);
|
|
922
|
-
if (state.options && state.options.context) {
|
|
923
|
-
|
|
924
|
-
}
|
|
922
|
+
// if (state.options && state.options.context) {
|
|
923
|
+
// state.selectors.locators[0].text = state.options.context;
|
|
924
|
+
// }
|
|
925
925
|
try {
|
|
926
926
|
await state.element.click();
|
|
927
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
927
|
+
// await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
928
928
|
}
|
|
929
929
|
catch (e) {
|
|
930
930
|
// await this.closeUnexpectedPopups();
|
|
931
931
|
state.element = await this._locate(selectors, state.info, _params);
|
|
932
932
|
await state.element.dispatchEvent("click");
|
|
933
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
933
|
+
// await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
934
934
|
}
|
|
935
935
|
await this.waitForPageLoad();
|
|
936
936
|
return state.info;
|
|
@@ -1009,7 +1009,6 @@ class StableBrowser {
|
|
|
1009
1009
|
await state.element.hover({ timeout: 10000 });
|
|
1010
1010
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
1011
1011
|
}
|
|
1012
|
-
await _screenshot(state, this);
|
|
1013
1012
|
await this.waitForPageLoad();
|
|
1014
1013
|
return state.info;
|
|
1015
1014
|
}
|
|
@@ -1338,6 +1337,7 @@ class StableBrowser {
|
|
|
1338
1337
|
let screenshotPath = null;
|
|
1339
1338
|
if (!info.log) {
|
|
1340
1339
|
info.log = "";
|
|
1340
|
+
info.locatorLog = new LocatorLog(selectors);
|
|
1341
1341
|
}
|
|
1342
1342
|
info.operation = "getText";
|
|
1343
1343
|
info.selectors = selectors;
|
|
@@ -1676,11 +1676,9 @@ class StableBrowser {
|
|
|
1676
1676
|
if (!fs.existsSync(world.screenshotPath)) {
|
|
1677
1677
|
fs.mkdirSync(world.screenshotPath, { recursive: true });
|
|
1678
1678
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1683
|
-
const screenshotPath = path.join(world.screenshotPath, nextIndex + ".png");
|
|
1679
|
+
// to make sure the path doesn't start with -
|
|
1680
|
+
const uuidStr = "id_" + randomUUID();
|
|
1681
|
+
const screenshotPath = path.join(world.screenshotPath, uuidStr + ".png");
|
|
1684
1682
|
try {
|
|
1685
1683
|
await this.takeScreenshot(screenshotPath);
|
|
1686
1684
|
// let buffer = await this.page.screenshot({ timeout: 4000 });
|
|
@@ -1694,7 +1692,7 @@ class StableBrowser {
|
|
|
1694
1692
|
catch (e) {
|
|
1695
1693
|
this.logger.info("unable to take screenshot, ignored");
|
|
1696
1694
|
}
|
|
1697
|
-
result.screenshotId =
|
|
1695
|
+
result.screenshotId = uuidStr;
|
|
1698
1696
|
result.screenshotPath = screenshotPath;
|
|
1699
1697
|
if (info && info.box) {
|
|
1700
1698
|
await drawRectangle(screenshotPath, info.box.x, info.box.y, info.box.width, info.box.height);
|
|
@@ -1822,10 +1820,6 @@ class StableBrowser {
|
|
|
1822
1820
|
break;
|
|
1823
1821
|
}
|
|
1824
1822
|
state.info.value = state.value;
|
|
1825
|
-
this[variable] = state.value;
|
|
1826
|
-
if (world) {
|
|
1827
|
-
world[variable] = state.value;
|
|
1828
|
-
}
|
|
1829
1823
|
this.setTestData({ [variable]: state.value }, world);
|
|
1830
1824
|
this.logger.info("set test data: " + variable + "=" + state.value);
|
|
1831
1825
|
return state.info;
|
|
@@ -1837,6 +1831,66 @@ class StableBrowser {
|
|
|
1837
1831
|
_commandFinally(state, this);
|
|
1838
1832
|
}
|
|
1839
1833
|
}
|
|
1834
|
+
async verifyAttribute(selectors, attribute, value, _params = null, options = {}, world = null) {
|
|
1835
|
+
const state = {
|
|
1836
|
+
selectors,
|
|
1837
|
+
_params,
|
|
1838
|
+
attribute,
|
|
1839
|
+
value,
|
|
1840
|
+
options,
|
|
1841
|
+
world,
|
|
1842
|
+
type: Types.VERIFY_ATTRIBUTE,
|
|
1843
|
+
text: `Verify element attribute`,
|
|
1844
|
+
operation: "verifyAttribute",
|
|
1845
|
+
log: "***** verify attribute " + attribute + " from " + selectors.element_name + " *****\n",
|
|
1846
|
+
};
|
|
1847
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
1848
|
+
let val;
|
|
1849
|
+
try {
|
|
1850
|
+
await _preCommand(state, this);
|
|
1851
|
+
switch (attribute) {
|
|
1852
|
+
case "innerText":
|
|
1853
|
+
val = String(await state.element.innerText());
|
|
1854
|
+
break;
|
|
1855
|
+
case "value":
|
|
1856
|
+
val = String(await state.element.inputValue());
|
|
1857
|
+
break;
|
|
1858
|
+
case "checked":
|
|
1859
|
+
val = String(await state.element.isChecked());
|
|
1860
|
+
break;
|
|
1861
|
+
case "disabled":
|
|
1862
|
+
val = String(await state.element.isDisabled());
|
|
1863
|
+
break;
|
|
1864
|
+
case "readOnly":
|
|
1865
|
+
const isEditable = await state.element.isEditable();
|
|
1866
|
+
val = String(!isEditable);
|
|
1867
|
+
break;
|
|
1868
|
+
default:
|
|
1869
|
+
val = String(await state.element.getAttribute(attribute));
|
|
1870
|
+
break;
|
|
1871
|
+
}
|
|
1872
|
+
state.info.expectedValue = val;
|
|
1873
|
+
let regex;
|
|
1874
|
+
if (value.startsWith("/") && value.endsWith("/")) {
|
|
1875
|
+
const patternBody = value.slice(1, -1);
|
|
1876
|
+
regex = new RegExp(patternBody, "g");
|
|
1877
|
+
}
|
|
1878
|
+
else {
|
|
1879
|
+
const escapedPattern = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1880
|
+
regex = new RegExp(escapedPattern, "g");
|
|
1881
|
+
}
|
|
1882
|
+
if (!val.match(regex)) {
|
|
1883
|
+
throw new Error(`The ${attribute} attribute has a value of "${val}", but the expected value is "${value}"`);
|
|
1884
|
+
}
|
|
1885
|
+
return state.info;
|
|
1886
|
+
}
|
|
1887
|
+
catch (e) {
|
|
1888
|
+
await _commandError(state, e, this);
|
|
1889
|
+
}
|
|
1890
|
+
finally {
|
|
1891
|
+
_commandFinally(state, this);
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1840
1894
|
async extractEmailData(emailAddress, options, world) {
|
|
1841
1895
|
if (!emailAddress) {
|
|
1842
1896
|
throw new Error("email address is null");
|
|
@@ -1855,7 +1909,7 @@ class StableBrowser {
|
|
|
1855
1909
|
if (options && options.timeout) {
|
|
1856
1910
|
timeout = options.timeout;
|
|
1857
1911
|
}
|
|
1858
|
-
const serviceUrl =
|
|
1912
|
+
const serviceUrl = _getServerUrl() + "/api/mail/createLinkOrCodeFromEmail";
|
|
1859
1913
|
const request = {
|
|
1860
1914
|
method: "POST",
|
|
1861
1915
|
url: serviceUrl,
|
|
@@ -2028,7 +2082,7 @@ class StableBrowser {
|
|
|
2028
2082
|
}
|
|
2029
2083
|
finally {
|
|
2030
2084
|
const endTime = Date.now();
|
|
2031
|
-
|
|
2085
|
+
_reportToWorld(world, {
|
|
2032
2086
|
type: Types.VERIFY_PAGE_PATH,
|
|
2033
2087
|
text: "Verify page path",
|
|
2034
2088
|
screenshotId,
|
|
@@ -2048,6 +2102,35 @@ class StableBrowser {
|
|
|
2048
2102
|
});
|
|
2049
2103
|
}
|
|
2050
2104
|
}
|
|
2105
|
+
async findTextInAllFrames(dateAlternatives, numberAlternatives, text, state) {
|
|
2106
|
+
const frames = this.page.frames();
|
|
2107
|
+
let results = [];
|
|
2108
|
+
let ignoreCase = false;
|
|
2109
|
+
for (let i = 0; i < frames.length; i++) {
|
|
2110
|
+
if (dateAlternatives.date) {
|
|
2111
|
+
for (let j = 0; j < dateAlternatives.dates.length; j++) {
|
|
2112
|
+
const result = await this._locateElementByText(frames[i], dateAlternatives.dates[j], "*:not(script, style, head)", false, true, ignoreCase, {});
|
|
2113
|
+
result.frame = frames[i];
|
|
2114
|
+
results.push(result);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
else if (numberAlternatives.number) {
|
|
2118
|
+
for (let j = 0; j < numberAlternatives.numbers.length; j++) {
|
|
2119
|
+
const result = await this._locateElementByText(frames[i], numberAlternatives.numbers[j], "*:not(script, style, head)", false, true, ignoreCase, {});
|
|
2120
|
+
result.frame = frames[i];
|
|
2121
|
+
results.push(result);
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
else {
|
|
2125
|
+
const result = await this._locateElementByText(frames[i], text, "*:not(script, style, head)", false, true, ignoreCase, {});
|
|
2126
|
+
result.frame = frames[i];
|
|
2127
|
+
results.push(result);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
state.info.results = results;
|
|
2131
|
+
const resultWithElementsFound = results.filter((result) => result.elementCount > 0);
|
|
2132
|
+
return resultWithElementsFound;
|
|
2133
|
+
}
|
|
2051
2134
|
async verifyTextExistInPage(text, options = {}, world = null) {
|
|
2052
2135
|
text = unEscapeString(text);
|
|
2053
2136
|
const state = {
|
|
@@ -2057,7 +2140,7 @@ class StableBrowser {
|
|
|
2057
2140
|
locate: false,
|
|
2058
2141
|
scroll: false,
|
|
2059
2142
|
highlight: false,
|
|
2060
|
-
type: Types.
|
|
2143
|
+
type: Types.VERIFY_PAGE_CONTAINS_TEXT,
|
|
2061
2144
|
text: `Verify text exists in page`,
|
|
2062
2145
|
operation: "verifyTextExistInPage",
|
|
2063
2146
|
log: "***** verify text " + text + " exists in page *****\n",
|
|
@@ -2075,33 +2158,9 @@ class StableBrowser {
|
|
|
2075
2158
|
await _preCommand(state, this);
|
|
2076
2159
|
state.info.text = text;
|
|
2077
2160
|
while (true) {
|
|
2078
|
-
const
|
|
2079
|
-
let results = [];
|
|
2080
|
-
for (let i = 0; i < frames.length; i++) {
|
|
2081
|
-
if (dateAlternatives.date) {
|
|
2082
|
-
for (let j = 0; j < dateAlternatives.dates.length; j++) {
|
|
2083
|
-
const result = await this._locateElementByText(frames[i], dateAlternatives.dates[j], "*:not(script, style, head)", true, true, {});
|
|
2084
|
-
result.frame = frames[i];
|
|
2085
|
-
results.push(result);
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
else if (numberAlternatives.number) {
|
|
2089
|
-
for (let j = 0; j < numberAlternatives.numbers.length; j++) {
|
|
2090
|
-
const result = await this._locateElementByText(frames[i], numberAlternatives.numbers[j], "*:not(script, style, head)", true, true, {});
|
|
2091
|
-
result.frame = frames[i];
|
|
2092
|
-
results.push(result);
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
else {
|
|
2096
|
-
const result = await this._locateElementByText(frames[i], text, "*:not(script, style, head)", true, true, {});
|
|
2097
|
-
result.frame = frames[i];
|
|
2098
|
-
results.push(result);
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
state.info.results = results;
|
|
2102
|
-
const resultWithElementsFound = results.filter((result) => result.elementCount > 0);
|
|
2161
|
+
const resultWithElementsFound = await this.findTextInAllFrames(dateAlternatives, numberAlternatives, text, state);
|
|
2103
2162
|
if (resultWithElementsFound.length === 0) {
|
|
2104
|
-
if (Date.now() - startTime > timeout) {
|
|
2163
|
+
if (Date.now() - state.startTime > timeout) {
|
|
2105
2164
|
throw new Error(`Text ${text} not found in page`);
|
|
2106
2165
|
}
|
|
2107
2166
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
@@ -2109,9 +2168,9 @@ class StableBrowser {
|
|
|
2109
2168
|
}
|
|
2110
2169
|
if (resultWithElementsFound[0].randomToken) {
|
|
2111
2170
|
const frame = resultWithElementsFound[0].frame;
|
|
2112
|
-
const dataAttribute = `[data-blinq-id
|
|
2171
|
+
const dataAttribute = `[data-blinq-id-${resultWithElementsFound[0].randomToken}]`;
|
|
2113
2172
|
await this._highlightElements(frame, dataAttribute);
|
|
2114
|
-
const element = await frame
|
|
2173
|
+
const element = await frame.locator(dataAttribute).first();
|
|
2115
2174
|
if (element) {
|
|
2116
2175
|
await this.scrollIfNeeded(element, state.info);
|
|
2117
2176
|
await element.dispatchEvent("bvt_verify_page_contains_text");
|
|
@@ -2129,15 +2188,133 @@ class StableBrowser {
|
|
|
2129
2188
|
_commandFinally(state, this);
|
|
2130
2189
|
}
|
|
2131
2190
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2191
|
+
async waitForTextToDisappear(text, options = {}, world = null) {
|
|
2192
|
+
text = unEscapeString(text);
|
|
2193
|
+
const state = {
|
|
2194
|
+
text_search: text,
|
|
2195
|
+
options,
|
|
2196
|
+
world,
|
|
2197
|
+
locate: false,
|
|
2198
|
+
scroll: false,
|
|
2199
|
+
highlight: false,
|
|
2200
|
+
type: Types.WAIT_FOR_TEXT_TO_DISAPPEAR,
|
|
2201
|
+
text: `Verify text does not exist in page`,
|
|
2202
|
+
operation: "verifyTextNotExistInPage",
|
|
2203
|
+
log: "***** verify text " + text + " does not exist in page *****\n",
|
|
2204
|
+
};
|
|
2205
|
+
const timeout = this._getLoadTimeout(options);
|
|
2206
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2207
|
+
const newValue = await this._replaceWithLocalData(text, world);
|
|
2208
|
+
if (newValue !== text) {
|
|
2209
|
+
this.logger.info(text + "=" + newValue);
|
|
2210
|
+
text = newValue;
|
|
2211
|
+
}
|
|
2212
|
+
let dateAlternatives = findDateAlternatives(text);
|
|
2213
|
+
let numberAlternatives = findNumberAlternatives(text);
|
|
2214
|
+
try {
|
|
2215
|
+
await _preCommand(state, this);
|
|
2216
|
+
state.info.text = text;
|
|
2217
|
+
while (true) {
|
|
2218
|
+
const resultWithElementsFound = await this.findTextInAllFrames(dateAlternatives, numberAlternatives, text, state);
|
|
2219
|
+
if (resultWithElementsFound.length === 0) {
|
|
2220
|
+
await _screenshot(state, this);
|
|
2221
|
+
return state.info;
|
|
2222
|
+
}
|
|
2223
|
+
if (Date.now() - state.startTime > timeout) {
|
|
2224
|
+
throw new Error(`Text ${text} found in page`);
|
|
2225
|
+
}
|
|
2226
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
catch (e) {
|
|
2230
|
+
await _commandError(state, e, this);
|
|
2231
|
+
}
|
|
2232
|
+
finally {
|
|
2233
|
+
_commandFinally(state, this);
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
async verifyTextRelatedToText(textAnchor, climb, textToVerify, options = {}, world = null) {
|
|
2237
|
+
textAnchor = unEscapeString(textAnchor);
|
|
2238
|
+
textToVerify = unEscapeString(textToVerify);
|
|
2239
|
+
const state = {
|
|
2240
|
+
text_search: textToVerify,
|
|
2241
|
+
options,
|
|
2242
|
+
world,
|
|
2243
|
+
locate: false,
|
|
2244
|
+
scroll: false,
|
|
2245
|
+
highlight: false,
|
|
2246
|
+
type: Types.VERIFY_TEXT_WITH_RELATION,
|
|
2247
|
+
text: `Verify text with relation to another text`,
|
|
2248
|
+
operation: "verify_text_with_relation",
|
|
2249
|
+
log: "***** search for " + textAnchor + " climb " + climb + " and verify " + textToVerify + " found *****\n",
|
|
2250
|
+
};
|
|
2251
|
+
const timeout = this._getLoadTimeout(options);
|
|
2252
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2253
|
+
let newValue = await this._replaceWithLocalData(textAnchor, world);
|
|
2254
|
+
if (newValue !== textAnchor) {
|
|
2255
|
+
this.logger.info(textAnchor + "=" + newValue);
|
|
2256
|
+
textAnchor = newValue;
|
|
2257
|
+
}
|
|
2258
|
+
newValue = await this._replaceWithLocalData(textToVerify, world);
|
|
2259
|
+
if (newValue !== textToVerify) {
|
|
2260
|
+
this.logger.info(textToVerify + "=" + newValue);
|
|
2261
|
+
textToVerify = newValue;
|
|
2262
|
+
}
|
|
2263
|
+
let dateAlternatives = findDateAlternatives(textToVerify);
|
|
2264
|
+
let numberAlternatives = findNumberAlternatives(textToVerify);
|
|
2265
|
+
let foundAncore = false;
|
|
2266
|
+
try {
|
|
2267
|
+
await _preCommand(state, this);
|
|
2268
|
+
state.info.text = textToVerify;
|
|
2269
|
+
while (true) {
|
|
2270
|
+
const resultWithElementsFound = await this.findTextInAllFrames(dateAlternatives, numberAlternatives, textAnchor, state);
|
|
2271
|
+
if (resultWithElementsFound.length === 0) {
|
|
2272
|
+
if (Date.now() - state.startTime > timeout) {
|
|
2273
|
+
throw new Error(`Text ${foundAncore ? textToVerify : textAnchor} not found in page`);
|
|
2274
|
+
}
|
|
2275
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
2276
|
+
continue;
|
|
2277
|
+
}
|
|
2278
|
+
for (let i = 0; i < resultWithElementsFound.length; i++) {
|
|
2279
|
+
foundAncore = true;
|
|
2280
|
+
const result = resultWithElementsFound[i];
|
|
2281
|
+
const token = result.randomToken;
|
|
2282
|
+
const frame = result.frame;
|
|
2283
|
+
let css = `[data-blinq-id-${token}]`;
|
|
2284
|
+
const climbArray1 = [];
|
|
2285
|
+
for (let i = 0; i < climb; i++) {
|
|
2286
|
+
climbArray1.push("..");
|
|
2287
|
+
}
|
|
2288
|
+
let climbXpath = "xpath=" + climbArray1.join("/");
|
|
2289
|
+
css = css + " >> " + climbXpath;
|
|
2290
|
+
const count = await frame.locator(css).count();
|
|
2291
|
+
for (let j = 0; j < count; j++) {
|
|
2292
|
+
const continer = await frame.locator(css).nth(j);
|
|
2293
|
+
const result = await this._locateElementByText(continer, textToVerify, "*", false, true, true, {});
|
|
2294
|
+
if (result.elementCount > 0) {
|
|
2295
|
+
const dataAttribute = "[data-blinq-id-" + result.randomToken + "]";
|
|
2296
|
+
//const cssAnchor = `[data-blinq-id="blinq-id-${token}-anchor"]`;
|
|
2297
|
+
await this._highlightElements(frame, dataAttribute);
|
|
2298
|
+
//await this._highlightElements(frame, cssAnchor);
|
|
2299
|
+
const element = await frame.locator(dataAttribute).first();
|
|
2300
|
+
if (element) {
|
|
2301
|
+
await this.scrollIfNeeded(element, state.info);
|
|
2302
|
+
await element.dispatchEvent("bvt_verify_page_contains_text");
|
|
2303
|
+
}
|
|
2304
|
+
await _screenshot(state, this);
|
|
2305
|
+
return state.info;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
// await expect(element).toHaveCount(1, { timeout: 10000 });
|
|
2136
2311
|
}
|
|
2137
|
-
|
|
2138
|
-
|
|
2312
|
+
catch (e) {
|
|
2313
|
+
await _commandError(state, e, this);
|
|
2314
|
+
}
|
|
2315
|
+
finally {
|
|
2316
|
+
_commandFinally(state, this);
|
|
2139
2317
|
}
|
|
2140
|
-
return serviceUrl;
|
|
2141
2318
|
}
|
|
2142
2319
|
async visualVerification(text, options = {}, world = null) {
|
|
2143
2320
|
const startTime = Date.now();
|
|
@@ -2153,7 +2330,7 @@ class StableBrowser {
|
|
|
2153
2330
|
throw new Error("TOKEN is not set");
|
|
2154
2331
|
}
|
|
2155
2332
|
try {
|
|
2156
|
-
let serviceUrl =
|
|
2333
|
+
let serviceUrl = _getServerUrl();
|
|
2157
2334
|
({ screenshotId, screenshotPath } = await this._screenShot(options, world, info));
|
|
2158
2335
|
info.screenshotPath = screenshotPath;
|
|
2159
2336
|
const screenshot = await this.takeScreenshot();
|
|
@@ -2194,7 +2371,7 @@ class StableBrowser {
|
|
|
2194
2371
|
}
|
|
2195
2372
|
finally {
|
|
2196
2373
|
const endTime = Date.now();
|
|
2197
|
-
|
|
2374
|
+
_reportToWorld(world, {
|
|
2198
2375
|
type: Types.VERIFY_VISUAL,
|
|
2199
2376
|
text: "Visual verification",
|
|
2200
2377
|
screenshotId,
|
|
@@ -2242,6 +2419,7 @@ class StableBrowser {
|
|
|
2242
2419
|
let screenshotPath = null;
|
|
2243
2420
|
const info = {};
|
|
2244
2421
|
info.log = "";
|
|
2422
|
+
info.locatorLog = new LocatorLog(selectors);
|
|
2245
2423
|
info.operation = "getTableData";
|
|
2246
2424
|
info.selectors = selectors;
|
|
2247
2425
|
try {
|
|
@@ -2262,7 +2440,7 @@ class StableBrowser {
|
|
|
2262
2440
|
}
|
|
2263
2441
|
finally {
|
|
2264
2442
|
const endTime = Date.now();
|
|
2265
|
-
|
|
2443
|
+
_reportToWorld(world, {
|
|
2266
2444
|
element_name: selectors.element_name,
|
|
2267
2445
|
type: Types.GET_TABLE_DATA,
|
|
2268
2446
|
text: "Get table data",
|
|
@@ -2317,7 +2495,7 @@ class StableBrowser {
|
|
|
2317
2495
|
info.operation = "analyzeTable";
|
|
2318
2496
|
info.selectors = selectors;
|
|
2319
2497
|
info.query = query;
|
|
2320
|
-
query =
|
|
2498
|
+
query = _fixUsingParams(query, _params);
|
|
2321
2499
|
info.query_fixed = query;
|
|
2322
2500
|
info.operator = operator;
|
|
2323
2501
|
info.value = value;
|
|
@@ -2428,7 +2606,7 @@ class StableBrowser {
|
|
|
2428
2606
|
}
|
|
2429
2607
|
finally {
|
|
2430
2608
|
const endTime = Date.now();
|
|
2431
|
-
|
|
2609
|
+
_reportToWorld(world, {
|
|
2432
2610
|
element_name: selectors.element_name,
|
|
2433
2611
|
type: Types.ANALYZE_TABLE,
|
|
2434
2612
|
text: "Analyze table",
|
|
@@ -2501,7 +2679,7 @@ class StableBrowser {
|
|
|
2501
2679
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2502
2680
|
({ screenshotId, screenshotPath } = await this._screenShot(options, world));
|
|
2503
2681
|
const endTime = Date.now();
|
|
2504
|
-
|
|
2682
|
+
_reportToWorld(world, {
|
|
2505
2683
|
type: Types.GET_PAGE_STATUS,
|
|
2506
2684
|
text: "Wait for page load",
|
|
2507
2685
|
screenshotId,
|
|
@@ -2545,6 +2723,11 @@ class StableBrowser {
|
|
|
2545
2723
|
_commandFinally(state, this);
|
|
2546
2724
|
}
|
|
2547
2725
|
}
|
|
2726
|
+
saveTestDataAsGlobal(options, world) {
|
|
2727
|
+
const dataFile = this._getDataFile(world);
|
|
2728
|
+
process.env.GLOBAL_TEST_DATA_FILE = dataFile;
|
|
2729
|
+
this.logger.info("Save the scenario test data as global for the following scenarios.");
|
|
2730
|
+
}
|
|
2548
2731
|
async setViewportSize(width, hight, options = {}, world = null) {
|
|
2549
2732
|
const startTime = Date.now();
|
|
2550
2733
|
let error = null;
|
|
@@ -2568,7 +2751,7 @@ class StableBrowser {
|
|
|
2568
2751
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2569
2752
|
({ screenshotId, screenshotPath } = await this._screenShot(options, world));
|
|
2570
2753
|
const endTime = Date.now();
|
|
2571
|
-
|
|
2754
|
+
_reportToWorld(world, {
|
|
2572
2755
|
type: Types.SET_VIEWPORT,
|
|
2573
2756
|
text: "set viewport size to " + width + "x" + hight,
|
|
2574
2757
|
screenshotId,
|
|
@@ -2605,7 +2788,7 @@ class StableBrowser {
|
|
|
2605
2788
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2606
2789
|
({ screenshotId, screenshotPath } = await this._screenShot(options, world, info));
|
|
2607
2790
|
const endTime = Date.now();
|
|
2608
|
-
|
|
2791
|
+
_reportToWorld(world, {
|
|
2609
2792
|
type: Types.GET_PAGE_STATUS,
|
|
2610
2793
|
text: "page relaod",
|
|
2611
2794
|
screenshotId,
|
|
@@ -2641,11 +2824,45 @@ class StableBrowser {
|
|
|
2641
2824
|
console.log("#-#");
|
|
2642
2825
|
}
|
|
2643
2826
|
}
|
|
2644
|
-
|
|
2645
|
-
if (
|
|
2646
|
-
|
|
2827
|
+
async beforeStep(world, step) {
|
|
2828
|
+
if (this.stepIndex === undefined) {
|
|
2829
|
+
this.stepIndex = 0;
|
|
2830
|
+
}
|
|
2831
|
+
else {
|
|
2832
|
+
this.stepIndex++;
|
|
2833
|
+
}
|
|
2834
|
+
if (step && step.pickleStep && step.pickleStep.text) {
|
|
2835
|
+
this.stepName = step.pickleStep.text;
|
|
2836
|
+
this.logger.info("step: " + this.stepName);
|
|
2837
|
+
}
|
|
2838
|
+
else if (step && step.text) {
|
|
2839
|
+
this.stepName = step.text;
|
|
2840
|
+
}
|
|
2841
|
+
else {
|
|
2842
|
+
this.stepName = "step " + this.stepIndex;
|
|
2843
|
+
}
|
|
2844
|
+
if (this.context && this.context.browserObject && this.context.browserObject.trace === true) {
|
|
2845
|
+
if (this.context.browserObject.context) {
|
|
2846
|
+
await this.context.browserObject.context.tracing.startChunk({ title: this.stepName });
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
if (this.tags === null && step && step.pickle && step.pickle.tags) {
|
|
2850
|
+
this.tags = step.pickle.tags.map((tag) => tag.name);
|
|
2851
|
+
// check if @global_test_data tag is present
|
|
2852
|
+
if (this.tags.includes("@global_test_data")) {
|
|
2853
|
+
this.saveTestDataAsGlobal({}, world);
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
async afterStep(world, step) {
|
|
2858
|
+
this.stepName = null;
|
|
2859
|
+
if (this.context && this.context.browserObject && this.context.browserObject.trace === true) {
|
|
2860
|
+
if (this.context.browserObject.context) {
|
|
2861
|
+
await this.context.browserObject.context.tracing.stopChunk({
|
|
2862
|
+
path: path.join(this.context.browserObject.traceFolder, `trace-${this.stepIndex}.zip`),
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2647
2865
|
}
|
|
2648
|
-
world.attach(JSON.stringify(properties), { mediaType: "application/json" });
|
|
2649
2866
|
}
|
|
2650
2867
|
}
|
|
2651
2868
|
function createTimedPromise(promise, label) {
|
|
@@ -2653,156 +2870,5 @@ function createTimedPromise(promise, label) {
|
|
|
2653
2870
|
.then((result) => ({ status: "fulfilled", label, result }))
|
|
2654
2871
|
.catch((error) => Promise.reject({ status: "rejected", label, error }));
|
|
2655
2872
|
}
|
|
2656
|
-
const KEYBOARD_EVENTS = [
|
|
2657
|
-
"ALT",
|
|
2658
|
-
"AltGraph",
|
|
2659
|
-
"CapsLock",
|
|
2660
|
-
"Control",
|
|
2661
|
-
"Fn",
|
|
2662
|
-
"FnLock",
|
|
2663
|
-
"Hyper",
|
|
2664
|
-
"Meta",
|
|
2665
|
-
"NumLock",
|
|
2666
|
-
"ScrollLock",
|
|
2667
|
-
"Shift",
|
|
2668
|
-
"Super",
|
|
2669
|
-
"Symbol",
|
|
2670
|
-
"SymbolLock",
|
|
2671
|
-
"Enter",
|
|
2672
|
-
"Tab",
|
|
2673
|
-
"ArrowDown",
|
|
2674
|
-
"ArrowLeft",
|
|
2675
|
-
"ArrowRight",
|
|
2676
|
-
"ArrowUp",
|
|
2677
|
-
"End",
|
|
2678
|
-
"Home",
|
|
2679
|
-
"PageDown",
|
|
2680
|
-
"PageUp",
|
|
2681
|
-
"Backspace",
|
|
2682
|
-
"Clear",
|
|
2683
|
-
"Copy",
|
|
2684
|
-
"CrSel",
|
|
2685
|
-
"Cut",
|
|
2686
|
-
"Delete",
|
|
2687
|
-
"EraseEof",
|
|
2688
|
-
"ExSel",
|
|
2689
|
-
"Insert",
|
|
2690
|
-
"Paste",
|
|
2691
|
-
"Redo",
|
|
2692
|
-
"Undo",
|
|
2693
|
-
"Accept",
|
|
2694
|
-
"Again",
|
|
2695
|
-
"Attn",
|
|
2696
|
-
"Cancel",
|
|
2697
|
-
"ContextMenu",
|
|
2698
|
-
"Escape",
|
|
2699
|
-
"Execute",
|
|
2700
|
-
"Find",
|
|
2701
|
-
"Finish",
|
|
2702
|
-
"Help",
|
|
2703
|
-
"Pause",
|
|
2704
|
-
"Play",
|
|
2705
|
-
"Props",
|
|
2706
|
-
"Select",
|
|
2707
|
-
"ZoomIn",
|
|
2708
|
-
"ZoomOut",
|
|
2709
|
-
"BrightnessDown",
|
|
2710
|
-
"BrightnessUp",
|
|
2711
|
-
"Eject",
|
|
2712
|
-
"LogOff",
|
|
2713
|
-
"Power",
|
|
2714
|
-
"PowerOff",
|
|
2715
|
-
"PrintScreen",
|
|
2716
|
-
"Hibernate",
|
|
2717
|
-
"Standby",
|
|
2718
|
-
"WakeUp",
|
|
2719
|
-
"AllCandidates",
|
|
2720
|
-
"Alphanumeric",
|
|
2721
|
-
"CodeInput",
|
|
2722
|
-
"Compose",
|
|
2723
|
-
"Convert",
|
|
2724
|
-
"Dead",
|
|
2725
|
-
"FinalMode",
|
|
2726
|
-
"GroupFirst",
|
|
2727
|
-
"GroupLast",
|
|
2728
|
-
"GroupNext",
|
|
2729
|
-
"GroupPrevious",
|
|
2730
|
-
"ModeChange",
|
|
2731
|
-
"NextCandidate",
|
|
2732
|
-
"NonConvert",
|
|
2733
|
-
"PreviousCandidate",
|
|
2734
|
-
"Process",
|
|
2735
|
-
"SingleCandidate",
|
|
2736
|
-
"HangulMode",
|
|
2737
|
-
"HanjaMode",
|
|
2738
|
-
"JunjaMode",
|
|
2739
|
-
"Eisu",
|
|
2740
|
-
"Hankaku",
|
|
2741
|
-
"Hiragana",
|
|
2742
|
-
"HiraganaKatakana",
|
|
2743
|
-
"KanaMode",
|
|
2744
|
-
"KanjiMode",
|
|
2745
|
-
"Katakana",
|
|
2746
|
-
"Romaji",
|
|
2747
|
-
"Zenkaku",
|
|
2748
|
-
"ZenkakuHanaku",
|
|
2749
|
-
"F1",
|
|
2750
|
-
"F2",
|
|
2751
|
-
"F3",
|
|
2752
|
-
"F4",
|
|
2753
|
-
"F5",
|
|
2754
|
-
"F6",
|
|
2755
|
-
"F7",
|
|
2756
|
-
"F8",
|
|
2757
|
-
"F9",
|
|
2758
|
-
"F10",
|
|
2759
|
-
"F11",
|
|
2760
|
-
"F12",
|
|
2761
|
-
"Soft1",
|
|
2762
|
-
"Soft2",
|
|
2763
|
-
"Soft3",
|
|
2764
|
-
"Soft4",
|
|
2765
|
-
"ChannelDown",
|
|
2766
|
-
"ChannelUp",
|
|
2767
|
-
"Close",
|
|
2768
|
-
"MailForward",
|
|
2769
|
-
"MailReply",
|
|
2770
|
-
"MailSend",
|
|
2771
|
-
"MediaFastForward",
|
|
2772
|
-
"MediaPause",
|
|
2773
|
-
"MediaPlay",
|
|
2774
|
-
"MediaPlayPause",
|
|
2775
|
-
"MediaRecord",
|
|
2776
|
-
"MediaRewind",
|
|
2777
|
-
"MediaStop",
|
|
2778
|
-
"MediaTrackNext",
|
|
2779
|
-
"MediaTrackPrevious",
|
|
2780
|
-
"AudioBalanceLeft",
|
|
2781
|
-
"AudioBalanceRight",
|
|
2782
|
-
"AudioBassBoostDown",
|
|
2783
|
-
"AudioBassBoostToggle",
|
|
2784
|
-
"AudioBassBoostUp",
|
|
2785
|
-
"AudioFaderFront",
|
|
2786
|
-
"AudioFaderRear",
|
|
2787
|
-
"AudioSurroundModeNext",
|
|
2788
|
-
"AudioTrebleDown",
|
|
2789
|
-
"AudioTrebleUp",
|
|
2790
|
-
"AudioVolumeDown",
|
|
2791
|
-
"AudioVolumeMute",
|
|
2792
|
-
"AudioVolumeUp",
|
|
2793
|
-
"MicrophoneToggle",
|
|
2794
|
-
"MicrophoneVolumeDown",
|
|
2795
|
-
"MicrophoneVolumeMute",
|
|
2796
|
-
"MicrophoneVolumeUp",
|
|
2797
|
-
"TV",
|
|
2798
|
-
"TV3DMode",
|
|
2799
|
-
"TVAntennaCable",
|
|
2800
|
-
"TVAudioDescription",
|
|
2801
|
-
];
|
|
2802
|
-
function unEscapeString(str) {
|
|
2803
|
-
const placeholder = "__NEWLINE__";
|
|
2804
|
-
str = str.replace(new RegExp(placeholder, "g"), "\n");
|
|
2805
|
-
return str;
|
|
2806
|
-
}
|
|
2807
2873
|
export { StableBrowser };
|
|
2808
2874
|
//# sourceMappingURL=stable_browser.js.map
|