@midscene/recorder 0.23.4-beta-20250725053012.0 → 0.23.4-beta-20250725070727.0

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.
@@ -950,7 +950,7 @@ ${indentStr}${after}`;
950
950
  function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1, basePoint = {
951
951
  left: 0,
952
952
  top: 0
953
- }) {
953
+ }, isContainer = false) {
954
954
  const rect = elementRect(node, currentWindow, currentDocument, baseZoom);
955
955
  if (!rect) return null;
956
956
  if (rect.width < CONTAINER_MINI_WIDTH || rect.height < CONTAINER_MINI_HEIGHT) return null;
@@ -1099,7 +1099,7 @@ ${indentStr}${after}`;
1099
1099
  };
1100
1100
  return elementInfo;
1101
1101
  }
1102
- if (isContainerElement(node)) {
1102
+ if (isContainerElement(node) || isContainer) {
1103
1103
  const attributes = getNodeAttributes(node, currentWindow);
1104
1104
  const nodeHashId = midsceneGenerateHash(node, "", rect);
1105
1105
  const elementInfo = {
@@ -1275,13 +1275,15 @@ ${indentStr}${after}`;
1275
1275
  const el = element;
1276
1276
  if (el === document.documentElement) return "/html";
1277
1277
  if (el === document.body) return "/html/body";
1278
- const index = getElementIndex(el);
1278
+ const isSVG = "http://www.w3.org/2000/svg" === el.namespaceURI;
1279
1279
  const tagName = el.nodeName.toLowerCase();
1280
+ if (isSVG && "svg" === tagName) return getElementXPath(el.parentNode);
1280
1281
  if (!el.parentNode) {
1281
1282
  const baseXPath2 = `/${tagName}`;
1282
1283
  return addTextContentToXPath(el, baseXPath2);
1283
1284
  }
1284
1285
  const parentXPath = getElementXPath(el.parentNode);
1286
+ const index = getElementIndex(el);
1285
1287
  const baseXPath = `${parentXPath}/${tagName}[${index}]`;
1286
1288
  return addTextContentToXPath(el, baseXPath);
1287
1289
  };
@@ -1317,7 +1319,7 @@ ${indentStr}${after}`;
1317
1319
  return collectElementInfo(node, window, document, 1, {
1318
1320
  left: 0,
1319
1321
  top: 0
1320
- });
1322
+ }, true);
1321
1323
  }
1322
1324
  },
1323
1325
  "?d94c": function() {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/recorder",
3
- "version": "0.23.4-beta-20250725053012.0",
3
+ "version": "0.23.4-beta-20250725070727.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -24,7 +24,7 @@
24
24
  "antd": "^5.21.6",
25
25
  "dayjs": "^1.11.11",
26
26
  "react-dom": "18.3.1",
27
- "@midscene/shared": "0.23.4-beta-20250725053012.0"
27
+ "@midscene/shared": "0.23.4-beta-20250725070727.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": "18.3.1",
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "scripts": {
34
34
  "build": "rslib build",
35
- "dev": "rslib build --watch"
35
+ "dev": "rslib build --watch",
36
+ "build:watch": "npm run dev"
36
37
  }
37
38
  }