@midscene/web 0.5.2-beta-20241010035503.0 → 0.5.2

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.
@@ -361,7 +361,7 @@ var import_utils5 = require("@midscene/core/utils");
361
361
  var import_node_assert2 = __toESM(require("assert"));
362
362
  var import_core = __toESM(require("@midscene/core"));
363
363
  var import_utils3 = require("@midscene/core/utils");
364
- var import_img2 = require("@midscene/shared/img");
364
+ var import_img3 = require("@midscene/shared/img");
365
365
 
366
366
  // src/common/task-cache.ts
367
367
  var import_node_fs2 = require("fs");
@@ -374,8 +374,10 @@ var import_node_assert = __toESM(require("assert"));
374
374
  var import_node_crypto = require("crypto");
375
375
  var import_node_fs = require("fs");
376
376
  var import_node_path = __toESM(require("path"));
377
+ var import_constants = require("@midscene/shared/constants");
377
378
  var import_fs = require("@midscene/shared/fs");
378
379
  var import_img = require("@midscene/shared/img");
380
+ var import_img2 = require("@midscene/shared/img");
379
381
  var import_dayjs = __toESM(require_dayjs_min());
380
382
 
381
383
  // src/web-element.ts
@@ -386,7 +388,8 @@ var WebElementInfo = class {
386
388
  page,
387
389
  locator,
388
390
  id,
389
- attributes
391
+ attributes,
392
+ indexId
390
393
  }) {
391
394
  this.content = content;
392
395
  this.rect = rect;
@@ -398,6 +401,7 @@ var WebElementInfo = class {
398
401
  this.locator = locator;
399
402
  this.id = id;
400
403
  this.attributes = attributes;
404
+ this.indexId = indexId;
401
405
  }
402
406
  };
403
407
 
@@ -406,19 +410,24 @@ async function parseContextFromWebPage(page, _opt) {
406
410
  (0, import_node_assert.default)(page, "page is required");
407
411
  const url = page.url();
408
412
  const file = await page.screenshot();
409
- const screenshotBuffer = (0, import_node_fs.readFileSync)(file);
410
413
  const screenshotBase64 = (0, import_img.base64Encoded)(file);
411
414
  const captureElementSnapshot = await page.getElementInfos();
412
- const elementsInfo = await alignElements(
413
- screenshotBuffer,
414
- captureElementSnapshot,
415
- page
416
- );
415
+ const elementsInfo = await alignElements(captureElementSnapshot, page);
416
+ const elementsPositionInfoWithoutText = elementsInfo.filter((elementInfo) => {
417
+ if (elementInfo.attributes.nodeType === import_constants.NodeType.TEXT) {
418
+ return false;
419
+ }
420
+ return true;
421
+ });
417
422
  const size = await (0, import_img.imageInfoOfBase64)(screenshotBase64);
423
+ const screenshotBase64WithElementInfos = await (0, import_img2.compositeElementInfoImg)({
424
+ inputImgBase64: screenshotBase64.split(";base64,").pop(),
425
+ elementsPositionInfo: elementsPositionInfoWithoutText
426
+ });
418
427
  return {
419
428
  content: elementsInfo,
420
429
  size,
421
- screenshotBase64,
430
+ screenshotBase64: `data:image/png;base64,${screenshotBase64WithElementInfos}`,
422
431
  url
423
432
  };
424
433
  }
@@ -430,13 +439,13 @@ async function getExtraReturnLogic() {
430
439
  return `${elementInfosScriptContent}midscene_element_inspector.webExtractTextWithPosition()`;
431
440
  }
432
441
  var sizeThreshold = 3;
433
- async function alignElements(screenshotBuffer, elements, page) {
442
+ async function alignElements(elements, page) {
434
443
  const validElements = elements.filter((item) => {
435
444
  return item.rect.height >= sizeThreshold && item.rect.width >= sizeThreshold;
436
445
  });
437
446
  const textsAligned = [];
438
447
  for (const item of validElements) {
439
- const { rect, id, content, attributes, locator } = item;
448
+ const { rect, id, content, attributes, locator, indexId } = item;
440
449
  textsAligned.push(
441
450
  new WebElementInfo({
442
451
  rect,
@@ -444,7 +453,8 @@ async function alignElements(screenshotBuffer, elements, page) {
444
453
  id,
445
454
  content,
446
455
  attributes,
447
- page
456
+ page,
457
+ indexId
448
458
  })
449
459
  );
450
460
  }
@@ -629,7 +639,7 @@ var PageTaskExecutor = class {
629
639
  const item = {
630
640
  type: "screenshot",
631
641
  ts: Date.now(),
632
- screenshot: (0, import_img2.base64Encoded)(file),
642
+ screenshot: (0, import_img3.base64Encoded)(file),
633
643
  timing
634
644
  };
635
645
  return item;
@@ -998,13 +1008,13 @@ var PageTaskExecutor = class {
998
1008
  const assertTask = await this.convertPlanToExecutable([assertPlan]);
999
1009
  await taskExecutor.append(this.wrapExecutorWithScreenshot(assertTask[0]));
1000
1010
  const output = await taskExecutor.flush();
1001
- if (output.pass) {
1011
+ if (output == null ? void 0 : output.pass) {
1002
1012
  return {
1003
1013
  output: void 0,
1004
1014
  executor: taskExecutor
1005
1015
  };
1006
1016
  }
1007
- errorThought = output.thought;
1017
+ errorThought = (output == null ? void 0 : output.thought) || "unknown error";
1008
1018
  const now = Date.now();
1009
1019
  if (now - startTime < checkIntervalMs) {
1010
1020
  const timeRemaining = checkIntervalMs - (now - startTime);
@@ -1275,7 +1285,7 @@ function waitForNetworkIdle(page) {
1275
1285
  // src/puppeteer/base-page.ts
1276
1286
  var import_node_fs3 = require("fs");
1277
1287
  var import_utils7 = require("@midscene/core/utils");
1278
- var import_img3 = require("@midscene/shared/img");
1288
+ var import_img4 = require("@midscene/shared/img");
1279
1289
  var Page = class {
1280
1290
  evaluate(pageFunction, arg) {
1281
1291
  if (this.pageType === "puppeteer") {
@@ -1300,14 +1310,14 @@ var Page = class {
1300
1310
  deviceScaleFactor: window.devicePixelRatio
1301
1311
  };
1302
1312
  });
1303
- const path2 = (0, import_utils7.getTmpFile)("jpeg");
1313
+ const path2 = (0, import_utils7.getTmpFile)("png");
1304
1314
  await this.page.screenshot({
1305
1315
  path: path2,
1306
1316
  type: "png"
1307
1317
  });
1308
1318
  let buf;
1309
1319
  if (viewportSize.deviceScaleFactor > 1) {
1310
- buf = await (0, import_img3.resizeImg)((0, import_node_fs3.readFileSync)(path2), {
1320
+ buf = await (0, import_img4.resizeImg)((0, import_node_fs3.readFileSync)(path2), {
1311
1321
  width: viewportSize.width,
1312
1322
  height: viewportSize.height
1313
1323
  });
@@ -357,7 +357,7 @@ var import_utils5 = require("@midscene/core/utils");
357
357
  var import_node_assert2 = __toESM(require("assert"));
358
358
  var import_core = __toESM(require("@midscene/core"));
359
359
  var import_utils3 = require("@midscene/core/utils");
360
- var import_img2 = require("@midscene/shared/img");
360
+ var import_img3 = require("@midscene/shared/img");
361
361
 
362
362
  // src/common/task-cache.ts
363
363
  var import_node_fs2 = require("fs");
@@ -370,8 +370,10 @@ var import_node_assert = __toESM(require("assert"));
370
370
  var import_node_crypto = require("crypto");
371
371
  var import_node_fs = require("fs");
372
372
  var import_node_path = __toESM(require("path"));
373
+ var import_constants = require("@midscene/shared/constants");
373
374
  var import_fs = require("@midscene/shared/fs");
374
375
  var import_img = require("@midscene/shared/img");
376
+ var import_img2 = require("@midscene/shared/img");
375
377
  var import_dayjs = __toESM(require_dayjs_min());
376
378
 
377
379
  // src/web-element.ts
@@ -382,7 +384,8 @@ var WebElementInfo = class {
382
384
  page,
383
385
  locator,
384
386
  id,
385
- attributes
387
+ attributes,
388
+ indexId
386
389
  }) {
387
390
  this.content = content;
388
391
  this.rect = rect;
@@ -394,6 +397,7 @@ var WebElementInfo = class {
394
397
  this.locator = locator;
395
398
  this.id = id;
396
399
  this.attributes = attributes;
400
+ this.indexId = indexId;
397
401
  }
398
402
  };
399
403
 
@@ -402,19 +406,24 @@ async function parseContextFromWebPage(page, _opt) {
402
406
  (0, import_node_assert.default)(page, "page is required");
403
407
  const url = page.url();
404
408
  const file = await page.screenshot();
405
- const screenshotBuffer = (0, import_node_fs.readFileSync)(file);
406
409
  const screenshotBase64 = (0, import_img.base64Encoded)(file);
407
410
  const captureElementSnapshot = await page.getElementInfos();
408
- const elementsInfo = await alignElements(
409
- screenshotBuffer,
410
- captureElementSnapshot,
411
- page
412
- );
411
+ const elementsInfo = await alignElements(captureElementSnapshot, page);
412
+ const elementsPositionInfoWithoutText = elementsInfo.filter((elementInfo) => {
413
+ if (elementInfo.attributes.nodeType === import_constants.NodeType.TEXT) {
414
+ return false;
415
+ }
416
+ return true;
417
+ });
413
418
  const size = await (0, import_img.imageInfoOfBase64)(screenshotBase64);
419
+ const screenshotBase64WithElementInfos = await (0, import_img2.compositeElementInfoImg)({
420
+ inputImgBase64: screenshotBase64.split(";base64,").pop(),
421
+ elementsPositionInfo: elementsPositionInfoWithoutText
422
+ });
414
423
  return {
415
424
  content: elementsInfo,
416
425
  size,
417
- screenshotBase64,
426
+ screenshotBase64: `data:image/png;base64,${screenshotBase64WithElementInfos}`,
418
427
  url
419
428
  };
420
429
  }
@@ -426,13 +435,13 @@ async function getExtraReturnLogic() {
426
435
  return `${elementInfosScriptContent}midscene_element_inspector.webExtractTextWithPosition()`;
427
436
  }
428
437
  var sizeThreshold = 3;
429
- async function alignElements(screenshotBuffer, elements, page) {
438
+ async function alignElements(elements, page) {
430
439
  const validElements = elements.filter((item) => {
431
440
  return item.rect.height >= sizeThreshold && item.rect.width >= sizeThreshold;
432
441
  });
433
442
  const textsAligned = [];
434
443
  for (const item of validElements) {
435
- const { rect, id, content, attributes, locator } = item;
444
+ const { rect, id, content, attributes, locator, indexId } = item;
436
445
  textsAligned.push(
437
446
  new WebElementInfo({
438
447
  rect,
@@ -440,7 +449,8 @@ async function alignElements(screenshotBuffer, elements, page) {
440
449
  id,
441
450
  content,
442
451
  attributes,
443
- page
452
+ page,
453
+ indexId
444
454
  })
445
455
  );
446
456
  }
@@ -625,7 +635,7 @@ var PageTaskExecutor = class {
625
635
  const item = {
626
636
  type: "screenshot",
627
637
  ts: Date.now(),
628
- screenshot: (0, import_img2.base64Encoded)(file),
638
+ screenshot: (0, import_img3.base64Encoded)(file),
629
639
  timing
630
640
  };
631
641
  return item;
@@ -994,13 +1004,13 @@ var PageTaskExecutor = class {
994
1004
  const assertTask = await this.convertPlanToExecutable([assertPlan]);
995
1005
  await taskExecutor.append(this.wrapExecutorWithScreenshot(assertTask[0]));
996
1006
  const output = await taskExecutor.flush();
997
- if (output.pass) {
1007
+ if (output == null ? void 0 : output.pass) {
998
1008
  return {
999
1009
  output: void 0,
1000
1010
  executor: taskExecutor
1001
1011
  };
1002
1012
  }
1003
- errorThought = output.thought;
1013
+ errorThought = (output == null ? void 0 : output.thought) || "unknown error";
1004
1014
  const now = Date.now();
1005
1015
  if (now - startTime < checkIntervalMs) {
1006
1016
  const timeRemaining = checkIntervalMs - (now - startTime);
@@ -1143,7 +1153,7 @@ ${errorTask == null ? void 0 : errorTask.errorStack}`);
1143
1153
  // src/puppeteer/base-page.ts
1144
1154
  var import_node_fs3 = require("fs");
1145
1155
  var import_utils7 = require("@midscene/core/utils");
1146
- var import_img3 = require("@midscene/shared/img");
1156
+ var import_img4 = require("@midscene/shared/img");
1147
1157
  var Page = class {
1148
1158
  evaluate(pageFunction, arg) {
1149
1159
  if (this.pageType === "puppeteer") {
@@ -1168,14 +1178,14 @@ var Page = class {
1168
1178
  deviceScaleFactor: window.devicePixelRatio
1169
1179
  };
1170
1180
  });
1171
- const path2 = (0, import_utils7.getTmpFile)("jpeg");
1181
+ const path2 = (0, import_utils7.getTmpFile)("png");
1172
1182
  await this.page.screenshot({
1173
1183
  path: path2,
1174
1184
  type: "png"
1175
1185
  });
1176
1186
  let buf;
1177
1187
  if (viewportSize.deviceScaleFactor > 1) {
1178
- buf = await (0, import_img3.resizeImg)((0, import_node_fs3.readFileSync)(path2), {
1188
+ buf = await (0, import_img4.resizeImg)((0, import_node_fs3.readFileSync)(path2), {
1179
1189
  width: viewportSize.width,
1180
1190
  height: viewportSize.height
1181
1191
  });
@@ -872,15 +872,13 @@ var midscene_element_inspector = (() => {
872
872
  const hashHex = (0, import_js_sha256.default)(combined);
873
873
  return hashHex.slice(0, 10);
874
874
  }
875
- function generateId(numberId) {
876
- return `${numberId}`;
877
- }
878
875
  function getDocument() {
879
876
  const container = document.body || document;
880
877
  return container;
881
878
  }
882
879
 
883
880
  // src/extractor/web-extractor.ts
881
+ var indexId = 0;
884
882
  function collectElementInfo(node, nodePath, baseZoom = 1) {
885
883
  var _a;
886
884
  const rect = visibleRect(node, baseZoom);
@@ -908,6 +906,7 @@ var midscene_element_inspector = (() => {
908
906
  nodeHashId,
909
907
  locator: selector,
910
908
  nodeType: NodeType.FORM_ITEM,
909
+ indexId: indexId++,
911
910
  attributes: __spreadProps(__spreadValues({}, attributes), {
912
911
  htmlTagName: `<${tagName}>`,
913
912
  nodeType: NodeType.FORM_ITEM
@@ -932,6 +931,7 @@ var midscene_element_inspector = (() => {
932
931
  const selector = setDataForNode(node, nodeHashId);
933
932
  const elementInfo = {
934
933
  id: nodeHashId,
934
+ indexId: indexId++,
935
935
  nodePath,
936
936
  nodeHashId,
937
937
  nodeType: NodeType.BUTTON,
@@ -957,6 +957,7 @@ var midscene_element_inspector = (() => {
957
957
  const selector = setDataForNode(node, nodeHashId);
958
958
  const elementInfo = {
959
959
  id: nodeHashId,
960
+ indexId: indexId++,
960
961
  nodePath,
961
962
  nodeHashId,
962
963
  locator: selector,
@@ -992,6 +993,7 @@ var midscene_element_inspector = (() => {
992
993
  const selector = setDataForNode(node, nodeHashId, true);
993
994
  const elementInfo = {
994
995
  id: nodeHashId,
996
+ indexId: indexId++,
995
997
  nodePath,
996
998
  nodeHashId,
997
999
  nodeType: NodeType.TEXT,
@@ -1020,6 +1022,7 @@ var midscene_element_inspector = (() => {
1020
1022
  id: nodeHashId,
1021
1023
  nodePath,
1022
1024
  nodeHashId,
1025
+ indexId: indexId++,
1023
1026
  nodeType: NodeType.CONTAINER,
1024
1027
  locator: selector,
1025
1028
  attributes: __spreadProps(__spreadValues({}, attributes), {
@@ -1064,9 +1067,6 @@ var midscene_element_inspector = (() => {
1064
1067
  return elementInfo;
1065
1068
  }
1066
1069
  dfs(initNode || getDocument(), "0");
1067
- for (let i = 0; i < elementInfoArray.length; i++) {
1068
- elementInfoArray[i].indexId = (i + 1).toString();
1069
- }
1070
1070
  if (currentFrame.left !== 0 || currentFrame.top !== 0) {
1071
1071
  for (let i = 0; i < elementInfoArray.length; i++) {
1072
1072
  elementInfoArray[i].rect.left += currentFrame.left;
@@ -1214,7 +1214,7 @@ var midscene_element_inspector = (() => {
1214
1214
  const xpath = getXPathForElement(node);
1215
1215
  const elementInfo = {
1216
1216
  id: nodeHashId,
1217
- indexId: generateId(nodeIndex++),
1217
+ indexId: nodeIndex++,
1218
1218
  nodeHashId,
1219
1219
  locator: xpath,
1220
1220
  attributes: __spreadValues({
@@ -871,6 +871,7 @@ var midscene_element_inspector = (() => {
871
871
  }
872
872
 
873
873
  // src/extractor/web-extractor.ts
874
+ var indexId = 0;
874
875
  function collectElementInfo(node, nodePath, baseZoom = 1) {
875
876
  var _a;
876
877
  const rect = visibleRect(node, baseZoom);
@@ -898,6 +899,7 @@ var midscene_element_inspector = (() => {
898
899
  nodeHashId,
899
900
  locator: selector,
900
901
  nodeType: NodeType.FORM_ITEM,
902
+ indexId: indexId++,
901
903
  attributes: __spreadProps(__spreadValues({}, attributes), {
902
904
  htmlTagName: `<${tagName}>`,
903
905
  nodeType: NodeType.FORM_ITEM
@@ -922,6 +924,7 @@ var midscene_element_inspector = (() => {
922
924
  const selector = setDataForNode(node, nodeHashId);
923
925
  const elementInfo = {
924
926
  id: nodeHashId,
927
+ indexId: indexId++,
925
928
  nodePath,
926
929
  nodeHashId,
927
930
  nodeType: NodeType.BUTTON,
@@ -947,6 +950,7 @@ var midscene_element_inspector = (() => {
947
950
  const selector = setDataForNode(node, nodeHashId);
948
951
  const elementInfo = {
949
952
  id: nodeHashId,
953
+ indexId: indexId++,
950
954
  nodePath,
951
955
  nodeHashId,
952
956
  locator: selector,
@@ -982,6 +986,7 @@ var midscene_element_inspector = (() => {
982
986
  const selector = setDataForNode(node, nodeHashId, true);
983
987
  const elementInfo = {
984
988
  id: nodeHashId,
989
+ indexId: indexId++,
985
990
  nodePath,
986
991
  nodeHashId,
987
992
  nodeType: NodeType.TEXT,
@@ -1010,6 +1015,7 @@ var midscene_element_inspector = (() => {
1010
1015
  id: nodeHashId,
1011
1016
  nodePath,
1012
1017
  nodeHashId,
1018
+ indexId: indexId++,
1013
1019
  nodeType: NodeType.CONTAINER,
1014
1020
  locator: selector,
1015
1021
  attributes: __spreadProps(__spreadValues({}, attributes), {
@@ -1054,9 +1060,6 @@ var midscene_element_inspector = (() => {
1054
1060
  return elementInfo;
1055
1061
  }
1056
1062
  dfs(initNode || getDocument(), "0");
1057
- for (let i = 0; i < elementInfoArray.length; i++) {
1058
- elementInfoArray[i].indexId = (i + 1).toString();
1059
- }
1060
1063
  if (currentFrame.left !== 0 || currentFrame.top !== 0) {
1061
1064
  for (let i = 0; i < elementInfoArray.length; i++) {
1062
1065
  elementInfoArray[i].rect.left += currentFrame.left;
@@ -1,5 +1,5 @@
1
- export { P as AppiumAgent } from './tasks-876d60ec.js';
2
- export { P as AppiumPage } from './page-dd5d0f7b.js';
1
+ export { P as AppiumAgent } from './tasks-9af2ee2d.js';
2
+ export { P as AppiumPage } from './page-ccbba1d9.js';
3
3
  import '@midscene/core';
4
4
  import '@midscene/shared/constants';
5
5
  import '@midscene/shared/fs';
@@ -1,9 +1,9 @@
1
1
  import { writeFileSync } from 'node:fs';
2
- import { W as WebPage, E as ElementInfo } from './page-dd5d0f7b.js';
3
- import { NodeType } from '@midscene/shared/constants';
2
+ import { W as WebPage, E as ElementInfo } from './page-ccbba1d9.js';
4
3
  import 'playwright';
5
4
  import 'puppeteer';
6
5
  import 'webdriverio';
6
+ import '@midscene/shared/constants';
7
7
 
8
8
  declare function generateExtractData(page: WebPage, targetDir: string, saveImgType?: {
9
9
  disableInputImage: boolean;
@@ -16,29 +16,9 @@ declare function generateTestDataPath(testDataName: string): string;
16
16
  type WriteFileSyncParams = Parameters<typeof writeFileSync>;
17
17
  declare function writeFileSyncWithDir(filePath: string, content: WriteFileSyncParams[1], options?: WriteFileSyncParams[2]): void;
18
18
  declare function getElementInfos(page: WebPage): Promise<{
19
- elementsPositionInfo: {
20
- label: string;
21
- x: number;
22
- y: number;
23
- width: number;
24
- height: number;
25
- attributes: {
26
- [key: string]: string;
27
- nodeType: NodeType;
28
- };
29
- }[];
19
+ elementsPositionInfo: ElementInfo[];
30
20
  captureElementSnapshot: ElementInfo[];
31
- elementsPositionInfoWithoutText: {
32
- label: string;
33
- x: number;
34
- y: number;
35
- width: number;
36
- height: number;
37
- attributes: {
38
- [key: string]: string;
39
- nodeType: NodeType;
40
- };
41
- }[];
21
+ elementsPositionInfoWithoutText: ElementInfo[];
42
22
  }>;
43
23
 
44
24
  export { generateExtractData, generateTestDataPath, getElementInfos, writeFileSyncWithDir };
@@ -1,6 +1,6 @@
1
1
  export { PlayWrightAiFixtureType, PlaywrightAiFixture } from './playwright.js';
2
- export { P as AppiumAgent, P as PlaywrightAgent } from './tasks-876d60ec.js';
3
- export { P as AppiumPage } from './page-dd5d0f7b.js';
2
+ export { P as AppiumAgent, P as PlaywrightAgent } from './tasks-9af2ee2d.js';
3
+ export { P as AppiumPage } from './page-ccbba1d9.js';
4
4
  export { PuppeteerAgent } from './puppeteer.js';
5
5
  export { generateExtractData } from './debug.js';
6
6
  import '@midscene/core/.';
@@ -5,7 +5,7 @@ import { NodeType } from '@midscene/shared/constants';
5
5
 
6
6
  interface ElementInfo {
7
7
  id: string;
8
- indexId?: string;
8
+ indexId: number;
9
9
  nodePath: string;
10
10
  nodeHashId: string;
11
11
  locator: string;
@@ -1,9 +1,9 @@
1
1
  import { AgentWaitForOpt } from '@midscene/core/.';
2
2
  import { TestInfo } from '@playwright/test';
3
3
  import { Page } from 'playwright';
4
- import { b as PageTaskExecutor } from './tasks-876d60ec.js';
5
- export { P as PlaywrightAgent } from './tasks-876d60ec.js';
6
- export { b as PlaywrightWebPage } from './page-dd5d0f7b.js';
4
+ import { b as PageTaskExecutor } from './tasks-9af2ee2d.js';
5
+ export { P as PlaywrightAgent } from './tasks-9af2ee2d.js';
6
+ export { b as PlaywrightWebPage } from './page-ccbba1d9.js';
7
7
  import '@midscene/core';
8
8
  import '@midscene/shared/constants';
9
9
  import '@midscene/shared/fs';
@@ -1,6 +1,6 @@
1
- import { P as PageAgent, a as PageAgentOpt } from './tasks-876d60ec.js';
1
+ import { P as PageAgent, a as PageAgentOpt } from './tasks-9af2ee2d.js';
2
2
  import { Page } from 'puppeteer';
3
- export { a as PuppeteerWebPage } from './page-dd5d0f7b.js';
3
+ export { a as PuppeteerWebPage } from './page-ccbba1d9.js';
4
4
  import '@midscene/core';
5
5
  import '@midscene/shared/constants';
6
6
  import '@midscene/shared/fs';
@@ -1,4 +1,4 @@
1
- import { W as WebPage } from './page-dd5d0f7b.js';
1
+ import { W as WebPage } from './page-ccbba1d9.js';
2
2
  import Insight, { BaseElement, Rect, UIContext, PlanningAction, AIElementParseResponse, GroupedActionDump, ExecutionDump, AgentWaitForOpt, InsightExtractParam, InsightAssertionResponse, PlanningActionParamWaitFor, Executor } from '@midscene/core';
3
3
  import { NodeType } from '@midscene/shared/constants';
4
4
  import { getMidscenePkgInfo } from '@midscene/shared/fs';
@@ -10,11 +10,12 @@ declare class WebElementInfo implements BaseElement {
10
10
  center: [number, number];
11
11
  page: WebPage;
12
12
  id: string;
13
+ indexId: number;
13
14
  attributes: {
14
15
  nodeType: NodeType;
15
16
  [key: string]: string;
16
17
  };
17
- constructor({ content, rect, page, locator, id, attributes, }: {
18
+ constructor({ content, rect, page, locator, id, attributes, indexId, }: {
18
19
  content: string;
19
20
  rect: Rect;
20
21
  page: WebPage;
@@ -24,6 +25,7 @@ declare class WebElementInfo implements BaseElement {
24
25
  nodeType: NodeType;
25
26
  [key: string]: string;
26
27
  };
28
+ indexId: number;
27
29
  });
28
30
  }
29
31
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midscene/web",
3
3
  "description": "An AI-powered automation SDK can control the page, perform assertions, and extract data in JSON format using natural language. See https://midscenejs.com/ for details.",
4
- "version": "0.5.2-beta-20241010035503.0",
4
+ "version": "0.5.2",
5
5
  "jsnext:source": "./src/index.ts",
6
6
  "main": "./dist/lib/index.js",
7
7
  "types": "./dist/types/index.d.ts",
@@ -47,8 +47,8 @@
47
47
  "openai": "4.57.1",
48
48
  "inquirer": "10.1.5",
49
49
  "@xmldom/xmldom": "0.8.10",
50
- "@midscene/core": "0.5.2-beta-20241010035503.0",
51
- "@midscene/shared": "0.5.2-beta-20241010035503.0"
50
+ "@midscene/core": "0.5.2",
51
+ "@midscene/shared": "0.5.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@modern-js/module-tools": "2.58.2",