ff-dom 1.0.18-beta.5 → 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.cdn.js CHANGED
@@ -1083,7 +1083,7 @@
1083
1083
  currentNode = currentNode.parentElement;
1084
1084
  }
1085
1085
  // Final constructed XPath
1086
- const finalXPath = xpathParts.join("");
1086
+ const finalXPath = xpathParts.join("") + nodeXpath;
1087
1087
  let count = getCountOfXPath(finalXPath, domNode, docmt);
1088
1088
  if (count === 1) {
1089
1089
  parentXpathCache.set(domNode, finalXPath); // Cache final result
@@ -2278,7 +2278,7 @@
2278
2278
  tag.remove();
2279
2279
  });
2280
2280
  }
2281
- tempDiv.innerHTML = document.body.innerHTML;
2281
+ tempDiv.innerHTML = document.body?.innerHTML;
2282
2282
  const finalLocatorsSet = new Set();
2283
2283
  let finalLocators = [];
2284
2284
  function createLocator(base, overrides = {}) {
@@ -2381,7 +2381,7 @@
2381
2381
  else if ((locator.name.includes("xpath") ||
2382
2382
  trimmedSelector.startsWith("//")) &&
2383
2383
  !locator.type.match("dynamic")) {
2384
- if (tempDiv.innerHTML) {
2384
+ if (tempDiv?.innerHTML) {
2385
2385
  const normalizedXPath = normalizeXPath(trimmedSelector);
2386
2386
  targetElement = getElementFromXPath(tempDiv, normalizedXPath);
2387
2387
  if (targetElement) {
@@ -2478,17 +2478,16 @@
2478
2478
  });
2479
2479
  });
2480
2480
  }
2481
- const fnValue = parseDOM(targetElement, document, false, true);
2482
- record.locators.forEach((loc) => {
2483
- createLocator(loc, {
2484
- name: 'xpath',
2485
- value: fnValue,
2486
- isRecorded: fnValue?.find((x) => x.value === loc.value)
2487
- ? loc.isRecorded
2488
- : "Y",
2489
- isSelfHealed: fnValue?.find((x) => x.value === loc.value)
2490
- ? loc.isSelfHealed
2491
- : "Y",
2481
+ const xpathResults = parseDOM(targetElement, document, false, true);
2482
+ xpathResults.forEach((result) => {
2483
+ const fnValue = result.value;
2484
+ record.locators.forEach((loc) => {
2485
+ createLocator(loc, {
2486
+ name: 'xpath',
2487
+ value: fnValue,
2488
+ isRecorded: loc.value === fnValue ? loc.isRecorded : 'Y',
2489
+ isSelfHealed: loc.value === fnValue ? loc.isSelfHealed : 'Y',
2490
+ });
2492
2491
  });
2493
2492
  });
2494
2493
  for (const locator of record.locators) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-dom",
3
- "version": "1.0.18-beta.5",
3
+ "version": "1.0.18-beta.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -148,7 +148,7 @@ const getElementsFromHTML = (
148
148
  });
149
149
  }
150
150
 
151
- tempDiv.innerHTML = document.body.innerHTML;
151
+ tempDiv.innerHTML = document.body?.innerHTML;
152
152
  const finalLocatorsSet: Set<string> = new Set();
153
153
  let finalLocators: any[] = [];
154
154
 
@@ -289,7 +289,7 @@ const getElementsFromHTML = (
289
289
  trimmedSelector.startsWith("//")) &&
290
290
  !locator.type.match("dynamic")
291
291
  ) {
292
- if (tempDiv.innerHTML) {
292
+ if (tempDiv?.innerHTML) {
293
293
  const normalizedXPath = normalizeXPath(trimmedSelector);
294
294
  targetElement = getElementFromXPath(
295
295
  tempDiv,