ff-automationv2 2.2.34-beta.3 → 2.2.34-beta.4
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/dist/automation/actions/executor.d.ts +1 -1
- package/dist/automation/actions/executor.js +3 -2
- package/dist/core/helpers/elementSelectorResolver.d.ts +1 -1
- package/dist/core/helpers/elementSelectorResolver.js +3 -1
- package/dist/core/main/actionHandlerFactory.js +1 -1
- package/dist/core/main/runAutomationScript.js +5 -1
- package/dist/utils/iframesExtraction/findElementUsingFF.js +15 -1
- package/dist/utils/iframesExtraction/iframeInterface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ export declare class ActionExecutor implements IActionExecutor {
|
|
|
19
19
|
navigate(url: string): Promise<void>;
|
|
20
20
|
goBack(): Promise<void>;
|
|
21
21
|
refresh(): Promise<void>;
|
|
22
|
-
switchToFrame(selector: string, frames: FrameMeta[], elementName: string, elementType: string, pageDOM: string, fireflinkIndex: string, usedElementNames?: string[]): Promise<void>;
|
|
22
|
+
switchToFrame(selector: string, frames: FrameMeta[], elementName: string, elementType: string, pageDOM: string, fireflinkIndex: string, usedElementNames?: string[], skipRecording?: boolean): Promise<void>;
|
|
23
23
|
wait(time: string): Promise<void>;
|
|
24
24
|
click(pageDOM: string, selector: string, fireflinkIndex: string, elementName: string, elementType: string): Promise<void>;
|
|
25
25
|
clickUsingJS(pageDOM: string, selector: string, fireflinkIndex: string, elementName: string, elementType: string): Promise<void>;
|
|
@@ -424,7 +424,7 @@ class ActionExecutor {
|
|
|
424
424
|
throw error;
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
async switchToFrame(selector, frames, elementName, elementType, pageDOM, fireflinkIndex, usedElementNames) {
|
|
427
|
+
async switchToFrame(selector, frames, elementName, elementType, pageDOM, fireflinkIndex, usedElementNames, skipRecording) {
|
|
428
428
|
try {
|
|
429
429
|
await (0, findElementUsingFF_js_1.findElementUsingFF)({
|
|
430
430
|
driver: this.driver,
|
|
@@ -437,7 +437,8 @@ class ActionExecutor {
|
|
|
437
437
|
fireflinkIndex,
|
|
438
438
|
elementGetter: this.elementGetter,
|
|
439
439
|
platform: this.platform,
|
|
440
|
-
usedElementNames
|
|
440
|
+
usedElementNames,
|
|
441
|
+
skipRecording
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
444
|
catch (error) {
|
|
@@ -10,4 +10,4 @@ export declare function resolveElementSelector(doc: any, domInfo: any, fireflink
|
|
|
10
10
|
doc: any;
|
|
11
11
|
domInfo: any;
|
|
12
12
|
}>;
|
|
13
|
-
export declare function handleShadowAndIframe(driver: any, stepAction: string, selector: string, fireflinkIndex: string, domInfo: any, actionHandlers: Record<string, any>, elementName: string, elementType: string, usedElementNames?: string[]): Promise<ShadowIframeResult>;
|
|
13
|
+
export declare function handleShadowAndIframe(driver: any, stepAction: string, selector: string, fireflinkIndex: string, domInfo: any, actionHandlers: Record<string, any>, elementName: string, elementType: string, usedElementNames?: string[], skipRecording?: boolean): Promise<ShadowIframeResult>;
|
|
@@ -63,7 +63,7 @@ async function resolveElementSelector(doc, domInfo, fireflinkIndex, platform, dr
|
|
|
63
63
|
selector = selector.replace(/\/div\[0\]\/div\[0\]/g, "/div[1]").replace(/\/div\[0\]/g, "/div[1]");
|
|
64
64
|
return { selector, doc: updatedDoc, domInfo: updatedDomInfo };
|
|
65
65
|
}
|
|
66
|
-
async function handleShadowAndIframe(driver, stepAction, selector, fireflinkIndex, domInfo, actionHandlers, elementName, elementType, usedElementNames) {
|
|
66
|
+
async function handleShadowAndIframe(driver, stepAction, selector, fireflinkIndex, domInfo, actionHandlers, elementName, elementType, usedElementNames, skipRecording) {
|
|
67
67
|
let updatedStepAction = stepAction;
|
|
68
68
|
let updatedSelector = selector;
|
|
69
69
|
let iframeDomHtml = null;
|
|
@@ -83,6 +83,7 @@ async function handleShadowAndIframe(driver, stepAction, selector, fireflinkInde
|
|
|
83
83
|
pageDOM: domInfo.dom,
|
|
84
84
|
fireflinkIndex,
|
|
85
85
|
usedElementNames,
|
|
86
|
+
skipRecording,
|
|
86
87
|
});
|
|
87
88
|
return {
|
|
88
89
|
stepAction: updatedStepAction,
|
|
@@ -116,6 +117,7 @@ async function handleShadowAndIframe(driver, stepAction, selector, fireflinkInde
|
|
|
116
117
|
pageDOM: domInfo.dom,
|
|
117
118
|
fireflinkIndex,
|
|
118
119
|
usedElementNames,
|
|
120
|
+
skipRecording,
|
|
119
121
|
});
|
|
120
122
|
return {
|
|
121
123
|
stepAction: updatedStepAction,
|
|
@@ -389,7 +389,7 @@ function createActionHandlers(context) {
|
|
|
389
389
|
await executor.wait(result.value);
|
|
390
390
|
}),
|
|
391
391
|
switchToFrame: withExecutor(async (executor, result) => {
|
|
392
|
-
await executor.switchToFrame(result.selector, result.frames, result.elementName, result.elementType, result.pageDOM, result.fireflinkIndex, result.usedElementNames);
|
|
392
|
+
await executor.switchToFrame(result.selector, result.frames, result.elementName, result.elementType, result.pageDOM, result.fireflinkIndex, result.usedElementNames, result.skipRecording);
|
|
393
393
|
}),
|
|
394
394
|
Click: withExecutor(async (executor, result) => {
|
|
395
395
|
await executor.click(result.pageDOM, result.selector, result.fireflinkIndex, result.elementName, result.elementType);
|
|
@@ -560,6 +560,7 @@ class AutomationRunner {
|
|
|
560
560
|
continue;
|
|
561
561
|
}
|
|
562
562
|
baseStepActionBeforeFallback = stepAction;
|
|
563
|
+
let iframeSwitchRecorded = false;
|
|
563
564
|
for (let fallbackAttempt = 1; fallbackAttempt <= 2; fallbackAttempt++) {
|
|
564
565
|
let shadowIframeResult = null;
|
|
565
566
|
try {
|
|
@@ -622,7 +623,10 @@ class AutomationRunner {
|
|
|
622
623
|
logData_js_1.logger.info(`Unable to resolve xpath for ${fireflinkIndex}`);
|
|
623
624
|
throw new Error(`Unable to resolve xpath for ${fireflinkIndex}`);
|
|
624
625
|
}
|
|
625
|
-
shadowIframeResult = await (0, elementSelectorResolver_js_1.handleShadowAndIframe)(driver, stepAction, selector, fireflinkIndex, domInfo, actionHandlers, currentElementName || result.response.elementName, stepResult.response.elementType, usedElementNames);
|
|
626
|
+
shadowIframeResult = await (0, elementSelectorResolver_js_1.handleShadowAndIframe)(driver, stepAction, selector, fireflinkIndex, domInfo, actionHandlers, currentElementName || result.response.elementName, stepResult.response.elementType, usedElementNames, iframeSwitchRecorded);
|
|
627
|
+
if (shadowIframeResult?.isIframe) {
|
|
628
|
+
iframeSwitchRecorded = true;
|
|
629
|
+
}
|
|
626
630
|
if (!shadowIframeResult.handled) {
|
|
627
631
|
return;
|
|
628
632
|
}
|
|
@@ -7,9 +7,23 @@ const elementSelectorResolver_js_1 = require("../../core/helpers/elementSelector
|
|
|
7
7
|
const findElementUsingFF = async (args) => {
|
|
8
8
|
await args.driver.switchFrame(null);
|
|
9
9
|
const usedElementNames = args.usedElementNames || [];
|
|
10
|
-
|
|
10
|
+
const uniqueFrames = [];
|
|
11
|
+
for (const frame of args.frames || []) {
|
|
12
|
+
const isDuplicate = uniqueFrames.some(existing => (frame.id && existing.id === frame.id) ||
|
|
13
|
+
(frame.name && existing.name === frame.name) ||
|
|
14
|
+
(frame.title && existing.title === frame.title) ||
|
|
15
|
+
(frame.aria && existing.aria === frame.aria) ||
|
|
16
|
+
(frame.src && existing.src === frame.src));
|
|
17
|
+
if (!isDuplicate) {
|
|
18
|
+
uniqueFrames.push(frame);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
for (const frameMeta of uniqueFrames) {
|
|
11
22
|
const xpathUsed = await (0, switchToIframeByMeta_js_1.switchToIframeByMeta)(args.driver, frameMeta);
|
|
12
23
|
if (xpathUsed) {
|
|
24
|
+
if (args.skipRecording) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
13
27
|
const baseName = args.elementName ? args.elementName.trim().replace(/\s+/g, "-") : args.elementName;
|
|
14
28
|
const finalElementName = ((0, elementSelectorResolver_js_1.generateUniqueName)(baseName, usedElementNames, "-iframe") || baseName)?.replace(/\s+/g, "-");
|
|
15
29
|
(0, appendScriptData_js_1.appendScriptData)({
|