@midscene/recorder 0.24.2-beta-20250801111909.0 → 0.25.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.
- package/dist/recorder-iife.js +16 -9
- package/dist/recorder.d.ts +1 -0
- package/dist/recorder.js +14 -9
- package/package.json +2 -2
package/dist/recorder-iife.js
CHANGED
|
@@ -518,6 +518,7 @@
|
|
|
518
518
|
descriptionOfTree: ()=>descriptionOfTree,
|
|
519
519
|
generateElementByPosition: ()=>generateElementByPosition,
|
|
520
520
|
getElementInfoByXpath: ()=>getElementInfoByXpath,
|
|
521
|
+
getElementXpath: ()=>getElementXpath,
|
|
521
522
|
getNodeFromCacheList: ()=>getNodeFromCacheList,
|
|
522
523
|
getNodeInfoByXpath: ()=>getNodeInfoByXpath,
|
|
523
524
|
getXpathsById: ()=>getXpathsById,
|
|
@@ -618,6 +619,7 @@ ${indentStr}${after}`;
|
|
|
618
619
|
var CONTAINER_MINI_HEIGHT = 3;
|
|
619
620
|
var CONTAINER_MINI_WIDTH = 3;
|
|
620
621
|
var import_js_sha256 = __webpack_require__("../../node_modules/.pnpm/js-sha256@0.11.0/node_modules/js-sha256/src/sha256.js");
|
|
622
|
+
"undefined" != typeof process && process.versions?.node;
|
|
621
623
|
var hashMap = {};
|
|
622
624
|
function generateHashId(rect, content = "") {
|
|
623
625
|
const combined = JSON.stringify({
|
|
@@ -1588,7 +1590,8 @@ ${indentStr}${after}`;
|
|
|
1588
1590
|
isLabelClick = true;
|
|
1589
1591
|
labelInfo = {
|
|
1590
1592
|
htmlFor: target.htmlFor,
|
|
1591
|
-
textContent: target.textContent?.trim()
|
|
1593
|
+
textContent: target.textContent?.trim(),
|
|
1594
|
+
xpath: (0, extractor.getElementXpath)(target)
|
|
1592
1595
|
};
|
|
1593
1596
|
} else {
|
|
1594
1597
|
let parent = target.parentElement;
|
|
@@ -1597,7 +1600,8 @@ ${indentStr}${after}`;
|
|
|
1597
1600
|
isLabelClick = true;
|
|
1598
1601
|
labelInfo = {
|
|
1599
1602
|
htmlFor: parent.htmlFor,
|
|
1600
|
-
textContent: parent.textContent?.trim()
|
|
1603
|
+
textContent: parent.textContent?.trim(),
|
|
1604
|
+
xpath: (0, extractor.getElementXpath)(parent)
|
|
1601
1605
|
};
|
|
1602
1606
|
break;
|
|
1603
1607
|
}
|
|
@@ -1616,14 +1620,17 @@ ${indentStr}${after}`;
|
|
|
1616
1620
|
const lastEvent = events[events.length - 1];
|
|
1617
1621
|
if ('click' === event.type) {
|
|
1618
1622
|
const lastEvent = getLastLabelClick(events);
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1621
|
-
|
|
1623
|
+
if (event.element) {
|
|
1624
|
+
const { isLabelClick, labelInfo } = this.checkLabelClick(event.element);
|
|
1625
|
+
if (lastEvent && isLabelClick && 'click' === lastEvent.type && lastEvent.isLabelClick && (lastEvent.labelInfo?.htmlFor && event.element.id && lastEvent.labelInfo?.htmlFor === event.element.id || labelInfo?.xpath && lastEvent.labelInfo?.xpath && lastEvent.labelInfo?.xpath === labelInfo?.xpath)) {
|
|
1626
|
+
debugLog('Skip input event triggered by label click:', event.element);
|
|
1627
|
+
return events;
|
|
1628
|
+
}
|
|
1629
|
+
return [
|
|
1630
|
+
...events,
|
|
1631
|
+
event
|
|
1632
|
+
];
|
|
1622
1633
|
}
|
|
1623
|
-
return [
|
|
1624
|
-
...events,
|
|
1625
|
-
event
|
|
1626
|
-
];
|
|
1627
1634
|
}
|
|
1628
1635
|
if ('input' === event.type) {
|
|
1629
1636
|
if (lastEvent && 'click' === lastEvent.type && lastEvent.isLabelClick && lastEvent.labelInfo?.htmlFor === event.targetId) {
|
package/dist/recorder.d.ts
CHANGED
package/dist/recorder.js
CHANGED
|
@@ -232,7 +232,8 @@ class EventRecorder {
|
|
|
232
232
|
isLabelClick = true;
|
|
233
233
|
labelInfo = {
|
|
234
234
|
htmlFor: target.htmlFor,
|
|
235
|
-
textContent: target.textContent?.trim()
|
|
235
|
+
textContent: target.textContent?.trim(),
|
|
236
|
+
xpath: (0, __WEBPACK_EXTERNAL_MODULE__midscene_shared_extractor_dbce1f15__.getElementXpath)(target)
|
|
236
237
|
};
|
|
237
238
|
} else {
|
|
238
239
|
let parent = target.parentElement;
|
|
@@ -241,7 +242,8 @@ class EventRecorder {
|
|
|
241
242
|
isLabelClick = true;
|
|
242
243
|
labelInfo = {
|
|
243
244
|
htmlFor: parent.htmlFor,
|
|
244
|
-
textContent: parent.textContent?.trim()
|
|
245
|
+
textContent: parent.textContent?.trim(),
|
|
246
|
+
xpath: (0, __WEBPACK_EXTERNAL_MODULE__midscene_shared_extractor_dbce1f15__.getElementXpath)(parent)
|
|
245
247
|
};
|
|
246
248
|
break;
|
|
247
249
|
}
|
|
@@ -260,14 +262,17 @@ class EventRecorder {
|
|
|
260
262
|
const lastEvent = events[events.length - 1];
|
|
261
263
|
if ('click' === event.type) {
|
|
262
264
|
const lastEvent = getLastLabelClick(events);
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
|
|
265
|
+
if (event.element) {
|
|
266
|
+
const { isLabelClick, labelInfo } = this.checkLabelClick(event.element);
|
|
267
|
+
if (lastEvent && isLabelClick && 'click' === lastEvent.type && lastEvent.isLabelClick && (lastEvent.labelInfo?.htmlFor && event.element.id && lastEvent.labelInfo?.htmlFor === event.element.id || labelInfo?.xpath && lastEvent.labelInfo?.xpath && lastEvent.labelInfo?.xpath === labelInfo?.xpath)) {
|
|
268
|
+
debugLog('Skip input event triggered by label click:', event.element);
|
|
269
|
+
return events;
|
|
270
|
+
}
|
|
271
|
+
return [
|
|
272
|
+
...events,
|
|
273
|
+
event
|
|
274
|
+
];
|
|
266
275
|
}
|
|
267
|
-
return [
|
|
268
|
-
...events,
|
|
269
|
-
event
|
|
270
|
-
];
|
|
271
276
|
}
|
|
272
277
|
if ('input' === event.type) {
|
|
273
278
|
if (lastEvent && 'click' === lastEvent.type && lastEvent.isLabelClick && lastEvent.labelInfo?.htmlFor === event.targetId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/recorder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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.
|
|
27
|
+
"@midscene/shared": "0.25.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "18.3.1",
|