ff-dom 1.0.18-beta.4 → 1.0.18-beta.6
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/index.browser.cjs +13 -14
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +13 -14
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cdn.js +13 -14
- package/package.json +1 -1
- package/src/utils/getElementsFromHTML.ts +2 -2
- package/src/utils/xpath.ts +34 -45
package/dist/index.browser.cjs
CHANGED
|
@@ -1084,7 +1084,7 @@ const getUniqueParentXpath = (domNode, docmt, node, isTarget, nodeXpath, isIndex
|
|
|
1084
1084
|
currentNode = currentNode.parentElement;
|
|
1085
1085
|
}
|
|
1086
1086
|
// Final constructed XPath
|
|
1087
|
-
const finalXPath = xpathParts.join("");
|
|
1087
|
+
const finalXPath = xpathParts.join("") + nodeXpath;
|
|
1088
1088
|
let count = getCountOfXPath(finalXPath, domNode, docmt);
|
|
1089
1089
|
if (count === 1) {
|
|
1090
1090
|
parentXpathCache.set(domNode, finalXPath); // Cache final result
|
|
@@ -2279,7 +2279,7 @@ const getElementsFromHTML = (record, docmt) => {
|
|
|
2279
2279
|
tag.remove();
|
|
2280
2280
|
});
|
|
2281
2281
|
}
|
|
2282
|
-
tempDiv.innerHTML = document.body
|
|
2282
|
+
tempDiv.innerHTML = document.body?.innerHTML;
|
|
2283
2283
|
const finalLocatorsSet = new Set();
|
|
2284
2284
|
let finalLocators = [];
|
|
2285
2285
|
function createLocator(base, overrides = {}) {
|
|
@@ -2382,7 +2382,7 @@ const getElementsFromHTML = (record, docmt) => {
|
|
|
2382
2382
|
else if ((locator.name.includes("xpath") ||
|
|
2383
2383
|
trimmedSelector.startsWith("//")) &&
|
|
2384
2384
|
!locator.type.match("dynamic")) {
|
|
2385
|
-
if (tempDiv
|
|
2385
|
+
if (tempDiv?.innerHTML) {
|
|
2386
2386
|
const normalizedXPath = normalizeXPath(trimmedSelector);
|
|
2387
2387
|
targetElement = getElementFromXPath(tempDiv, normalizedXPath);
|
|
2388
2388
|
if (targetElement) {
|
|
@@ -2479,17 +2479,16 @@ const getElementsFromHTML = (record, docmt) => {
|
|
|
2479
2479
|
});
|
|
2480
2480
|
});
|
|
2481
2481
|
}
|
|
2482
|
-
const
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
:
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
: "Y",
|
|
2482
|
+
const xpathResults = parseDOM(targetElement, document, false, true);
|
|
2483
|
+
xpathResults.forEach((result) => {
|
|
2484
|
+
const fnValue = result.value;
|
|
2485
|
+
record.locators.forEach((loc) => {
|
|
2486
|
+
createLocator(loc, {
|
|
2487
|
+
name: 'xpath',
|
|
2488
|
+
value: fnValue,
|
|
2489
|
+
isRecorded: loc.value === fnValue ? loc.isRecorded : 'Y',
|
|
2490
|
+
isSelfHealed: loc.value === fnValue ? loc.isSelfHealed : 'Y',
|
|
2491
|
+
});
|
|
2493
2492
|
});
|
|
2494
2493
|
});
|
|
2495
2494
|
for (const locator of record.locators) {
|