@midscene/web 1.0.1-beta-20251022061922.0 → 1.0.1-beta-20251024064637.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.
@@ -1 +1 @@
1
- {"version":3,"file":"static/static-page.js","sources":["webpack://@midscene/web/webpack/runtime/define_property_getters","webpack://@midscene/web/webpack/runtime/has_own_property","webpack://@midscene/web/webpack/runtime/make_namespace_object","webpack://@midscene/web/./src/static/static-page.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { DeviceAction, Point, UIContext } from '@midscene/core';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport {\n defineActionDragAndDrop,\n defineActionHover,\n defineActionInput,\n defineActionKeyboardPress,\n defineActionRightClick,\n defineActionScroll,\n defineActionTap,\n} from '@midscene/core/device';\nimport { ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED } from '@midscene/shared/common';\n\ntype WebUIContext = UIContext & {\n screenshotBase64?: string;\n size: { width: number; height: number; dpr?: number };\n};\n\nconst ThrowNotImplemented = (methodName: string) => {\n throw new Error(\n `The method \"${methodName}\" is not implemented as designed since this is a static UI context. (${ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED})`,\n );\n};\n\nexport default class StaticPage implements AbstractInterface {\n interfaceType = 'static';\n\n private uiContext: WebUIContext;\n\n constructor(uiContext: WebUIContext) {\n if (uiContext.tree) {\n this.uiContext = uiContext;\n } else {\n this.uiContext = Object.assign(uiContext, {\n tree: {\n node: null,\n children: [],\n },\n });\n }\n }\n\n actionSpace(): DeviceAction[] {\n // Return available actions for static page - they will throw \"not implemented\" errors when executed\n // but need to be available for planning phase\n return [\n defineActionTap(async (param) => {\n ThrowNotImplemented('Tap');\n }),\n defineActionRightClick(async (param) => {\n ThrowNotImplemented('RightClick');\n }),\n defineActionHover(async (param) => {\n ThrowNotImplemented('Hover');\n }),\n defineActionInput(async (param) => {\n ThrowNotImplemented('Input');\n }),\n defineActionKeyboardPress(async (param) => {\n ThrowNotImplemented('KeyboardPress');\n }),\n defineActionScroll(async (param) => {\n ThrowNotImplemented('Scroll');\n }),\n defineActionDragAndDrop(async (param) => {\n ThrowNotImplemented('DragAndDrop');\n }),\n ];\n }\n\n async evaluateJavaScript<T = unknown>(script: string): Promise<T> {\n return ThrowNotImplemented('evaluateJavaScript');\n }\n\n // @deprecated\n async getElementsInfo() {\n return ThrowNotImplemented('getElementsInfo');\n }\n\n async getElementsNodeTree() {\n return ThrowNotImplemented('getElementsNodeTree');\n }\n\n async getXpathsByPoint(point: Point) {\n return ThrowNotImplemented('getXpathsByPoint');\n }\n\n async getElementInfoByXpath(xpath: string) {\n return ThrowNotImplemented('getElementInfoByXpath');\n }\n\n async size() {\n return {\n ...this.uiContext.size,\n dpr: this.uiContext.size.dpr || 1,\n };\n }\n\n async screenshotBase64() {\n const base64 = this.uiContext.screenshotBase64;\n if (!base64) {\n throw new Error('screenshot base64 is empty');\n }\n return base64;\n }\n\n async url() {\n return Promise.resolve('https://static_page_without_url');\n }\n\n async scrollUntilTop(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilTop');\n }\n\n async scrollUntilBottom(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilBottom');\n }\n\n async scrollUntilLeft(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilLeft');\n }\n\n async scrollUntilRight(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilRight');\n }\n\n async scrollUp(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollUp');\n }\n\n async scrollDown(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollDown');\n }\n\n async scrollLeft(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollLeft');\n }\n\n async scrollRight(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollRight');\n }\n\n async clearInput() {\n return ThrowNotImplemented('clearInput');\n }\n\n mouse = {\n click: ThrowNotImplemented.bind(null, 'mouse.click'),\n wheel: ThrowNotImplemented.bind(null, 'mouse.wheel'),\n move: ThrowNotImplemented.bind(null, 'mouse.move'),\n drag: ThrowNotImplemented.bind(null, 'mouse.drag'),\n };\n\n keyboard = {\n type: ThrowNotImplemented.bind(null, 'keyboard.type'),\n press: ThrowNotImplemented.bind(null, 'keyboard.press'),\n };\n\n async destroy(): Promise<void> {\n //\n }\n\n async getContext(): Promise<UIContext> {\n return this.uiContext;\n }\n\n updateContext(newContext: WebUIContext): void {\n this.uiContext = newContext;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","ThrowNotImplemented","methodName","Error","ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED","StaticPage","defineActionTap","param","defineActionRightClick","defineActionHover","defineActionInput","defineActionKeyboardPress","defineActionScroll","defineActionDragAndDrop","script","point","xpath","base64","Promise","startingPoint","distance","newContext","uiContext"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,C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B,IAAI,CAAC,MAAM;YACtC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;QACvC;QAEA,mCAAW;YACT,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,OAAOA,oBAAoB,IAAI,CAAC,MAAM;QACxC;QA9HE,IAAIqB,UAAU,IAAI,EAChB,IAAI,CAAC,SAAS,GAAGA;aAEjB,IAAI,CAAC,SAAS,GAAGzB,OAAO,MAAM,CAACyB,WAAW;YACxC,MAAM;gBACJ,MAAM;gBACN,UAAU,EAAE;YACd;QACF;IAEJ;AAiIF"}
1
+ {"version":3,"file":"static/static-page.js","sources":["webpack://@midscene/web/webpack/runtime/define_property_getters","webpack://@midscene/web/webpack/runtime/has_own_property","webpack://@midscene/web/webpack/runtime/make_namespace_object","webpack://@midscene/web/./src/static/static-page.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { DeviceAction, Point, UIContext } from '@midscene/core';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport {\n defineActionDragAndDrop,\n defineActionHover,\n defineActionInput,\n defineActionKeyboardPress,\n defineActionRightClick,\n defineActionScroll,\n defineActionTap,\n} from '@midscene/core/device';\nimport { ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED } from '@midscene/shared/common';\n\ntype WebUIContext = UIContext & {\n screenshotBase64?: string;\n size: { width: number; height: number; dpr?: number };\n};\n\nconst ThrowNotImplemented = (methodName: string) => {\n throw new Error(\n `The method \"${methodName}\" is not implemented as designed since this is a static UI context. (${ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED})`,\n );\n};\n\nexport default class StaticPage implements AbstractInterface {\n interfaceType = 'static';\n\n private uiContext: WebUIContext;\n\n constructor(uiContext: WebUIContext) {\n this.uiContext = uiContext;\n }\n\n actionSpace(): DeviceAction[] {\n // Return available actions for static page - they will throw \"not implemented\" errors when executed\n // but need to be available for planning phase\n return [\n defineActionTap(async (param) => {\n ThrowNotImplemented('Tap');\n }),\n defineActionRightClick(async (param) => {\n ThrowNotImplemented('RightClick');\n }),\n defineActionHover(async (param) => {\n ThrowNotImplemented('Hover');\n }),\n defineActionInput(async (param) => {\n ThrowNotImplemented('Input');\n }),\n defineActionKeyboardPress(async (param) => {\n ThrowNotImplemented('KeyboardPress');\n }),\n defineActionScroll(async (param) => {\n ThrowNotImplemented('Scroll');\n }),\n defineActionDragAndDrop(async (param) => {\n ThrowNotImplemented('DragAndDrop');\n }),\n ];\n }\n\n async evaluateJavaScript<T = unknown>(script: string): Promise<T> {\n return ThrowNotImplemented('evaluateJavaScript');\n }\n\n // @deprecated\n async getElementsInfo() {\n return ThrowNotImplemented('getElementsInfo');\n }\n\n async getElementsNodeTree() {\n return ThrowNotImplemented('getElementsNodeTree');\n }\n\n async getXpathsByPoint(point: Point) {\n return ThrowNotImplemented('getXpathsByPoint');\n }\n\n async getElementInfoByXpath(xpath: string) {\n return ThrowNotImplemented('getElementInfoByXpath');\n }\n\n async size() {\n return {\n ...this.uiContext.size,\n dpr: this.uiContext.size.dpr || 1,\n };\n }\n\n async screenshotBase64() {\n const base64 = this.uiContext.screenshotBase64;\n if (!base64) {\n throw new Error('screenshot base64 is empty');\n }\n return base64;\n }\n\n async url() {\n return Promise.resolve('https://static_page_without_url');\n }\n\n async scrollUntilTop(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilTop');\n }\n\n async scrollUntilBottom(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilBottom');\n }\n\n async scrollUntilLeft(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilLeft');\n }\n\n async scrollUntilRight(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilRight');\n }\n\n async scrollUp(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollUp');\n }\n\n async scrollDown(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollDown');\n }\n\n async scrollLeft(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollLeft');\n }\n\n async scrollRight(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollRight');\n }\n\n async clearInput() {\n return ThrowNotImplemented('clearInput');\n }\n\n mouse = {\n click: ThrowNotImplemented.bind(null, 'mouse.click'),\n wheel: ThrowNotImplemented.bind(null, 'mouse.wheel'),\n move: ThrowNotImplemented.bind(null, 'mouse.move'),\n drag: ThrowNotImplemented.bind(null, 'mouse.drag'),\n };\n\n keyboard = {\n type: ThrowNotImplemented.bind(null, 'keyboard.type'),\n press: ThrowNotImplemented.bind(null, 'keyboard.press'),\n };\n\n async destroy(): Promise<void> {\n //\n }\n\n async getContext(): Promise<UIContext> {\n return this.uiContext;\n }\n\n updateContext(newContext: WebUIContext): void {\n this.uiContext = newContext;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","ThrowNotImplemented","methodName","Error","ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED","StaticPage","defineActionTap","param","defineActionRightClick","defineActionHover","defineActionInput","defineActionKeyboardPress","defineActionScroll","defineActionDragAndDrop","script","point","xpath","base64","Promise","startingPoint","distance","newContext","uiContext"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;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C,SAAS,GAAGA;IACnB;IAlIA,YAAYC,SAAuB,CAAE;QAJrC,wCAAgB;QAEhB,uBAAQ,aAAR;QA8GA,gCAAQ;YACN,OAAOrB,oBAAoB,IAAI,CAAC,MAAM;YACtC,OAAOA,oBAAoB,IAAI,CAAC,MAAM;YACtC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;QACvC;QAEA,mCAAW;YACT,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,OAAOA,oBAAoB,IAAI,CAAC,MAAM;QACxC;QArHE,IAAI,CAAC,SAAS,GAAGqB;IACnB;AAiIF"}
@@ -28,7 +28,6 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  WebPageContextParser: ()=>WebPageContextParser,
29
29
  limitOpenNewTabScript: ()=>limitOpenNewTabScript
30
30
  });
31
- const extractor_namespaceObject = require("@midscene/shared/extractor");
32
31
  const logger_namespaceObject = require("@midscene/shared/logger");
33
32
  const agent_namespaceObject = require("@midscene/core/agent");
34
33
  function _define_property(obj, key, value) {
@@ -64,33 +63,12 @@ class WebElementInfoImpl {
64
63
  this.isVisible = isVisible;
65
64
  }
66
65
  }
67
- const debug = (0, logger_namespaceObject.getDebug)('web:parse-context');
66
+ (0, logger_namespaceObject.getDebug)('web:parse-context');
68
67
  async function WebPageContextParser(page, _opt) {
69
- var _page_getElementsNodeTree;
70
68
  const basicContext = await (0, agent_namespaceObject.commonContextParser)(page, {
71
69
  uploadServerUrl: _opt.uploadServerUrl
72
70
  });
73
- debug('will traverse element tree');
74
- const tree = await (null == (_page_getElementsNodeTree = page.getElementsNodeTree) ? void 0 : _page_getElementsNodeTree.call(page)) || {
75
- node: null,
76
- children: []
77
- };
78
- const webTree = (0, extractor_namespaceObject.traverseTree)(tree, (elementInfo)=>{
79
- const { rect, id, content, attributes, indexId, isVisible } = elementInfo;
80
- return new WebElementInfoImpl({
81
- rect,
82
- id,
83
- content,
84
- attributes,
85
- indexId,
86
- isVisible
87
- });
88
- });
89
- debug('traverse element tree end');
90
- return {
91
- ...basicContext,
92
- tree: webTree
93
- };
71
+ return basicContext;
94
72
  }
95
73
  const limitOpenNewTabScript = `
96
74
  if (!window.__MIDSCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__) {
@@ -1 +1 @@
1
- {"version":3,"file":"web-element.js","sources":["webpack://@midscene/web/webpack/runtime/define_property_getters","webpack://@midscene/web/webpack/runtime/has_own_property","webpack://@midscene/web/webpack/runtime/make_namespace_object","webpack://@midscene/web/./src/web-element.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n AgentOpt,\n DeviceAction,\n Rect,\n UIContext,\n WebElementInfo,\n} from '@midscene/core';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport { traverseTree } from '@midscene/shared/extractor';\nimport { getDebug } from '@midscene/shared/logger';\nimport { _keyDefinitions } from '@midscene/shared/us-keyboard-layout';\n\nimport { commonContextParser } from '@midscene/core/agent';\nimport type { NodeType } from '@midscene/shared/constants';\nimport type ChromeExtensionProxyPage from './chrome-extension/page';\nimport type { PlaywrightWebPage } from './playwright';\nimport type { PuppeteerWebPage } from './puppeteer';\nimport type { StaticPage } from './static';\nexport type { WebElementInfo };\n\nexport type WebPageAgentOpt = AgentOpt & WebPageOpt;\nexport type WebPageOpt = {\n waitForNavigationTimeout?: number;\n waitForNetworkIdleTimeout?: number;\n forceSameTabNavigation?: boolean /* if limit the new tab to the current page, default true */;\n beforeInvokeAction?: () => Promise<void>;\n afterInvokeAction?: () => Promise<void>;\n customActions?: DeviceAction<any>[];\n};\n\nexport type WebPage =\n | PlaywrightWebPage\n | PuppeteerWebPage\n | StaticPage\n | ChromeExtensionProxyPage;\n\nexport class WebElementInfoImpl implements WebElementInfo {\n content: string;\n\n rect: Rect;\n\n center: [number, number];\n\n id: string;\n\n indexId: number;\n\n attributes: {\n nodeType: NodeType;\n [key: string]: string;\n };\n\n xpaths?: string[];\n\n isVisible: boolean;\n\n constructor({\n content,\n rect,\n id,\n attributes,\n indexId,\n xpaths,\n isVisible,\n }: {\n content: string;\n rect: Rect;\n id: string;\n attributes: {\n nodeType: NodeType;\n [key: string]: string;\n };\n indexId: number;\n xpaths?: string[];\n isVisible: boolean;\n }) {\n this.content = content;\n this.rect = rect;\n this.center = [\n Math.floor(rect.left + rect.width / 2),\n Math.floor(rect.top + rect.height / 2),\n ];\n this.id = id;\n this.attributes = attributes;\n this.indexId = indexId;\n this.xpaths = xpaths;\n this.isVisible = isVisible;\n }\n}\n\nconst debug = getDebug('web:parse-context');\nexport async function WebPageContextParser(\n page: AbstractInterface,\n _opt: { uploadServerUrl?: string },\n): Promise<UIContext> {\n const basicContext = await commonContextParser(page, {\n uploadServerUrl: _opt.uploadServerUrl,\n });\n\n debug('will traverse element tree');\n const tree = (await page.getElementsNodeTree?.()) || {\n node: null,\n children: [],\n };\n const webTree = traverseTree(tree!, (elementInfo) => {\n const { rect, id, content, attributes, indexId, isVisible } = elementInfo;\n return new WebElementInfoImpl({\n rect,\n id,\n content,\n attributes,\n indexId,\n isVisible,\n });\n });\n debug('traverse element tree end');\n\n return {\n ...basicContext,\n tree: webTree,\n };\n}\n\nexport const limitOpenNewTabScript = `\nif (!window.__MIDSCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__) {\n window.__MIDSCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__ = true;\n\n // Intercept the window.open method (only once)\n window.open = function(url) {\n console.log('Blocked window.open:', url);\n window.location.href = url;\n return null;\n };\n\n // Block all a tag clicks with target=\"_blank\" (only once)\n document.addEventListener('click', function(e) {\n const target = e.target.closest('a');\n if (target && target.target === '_blank') {\n e.preventDefault();\n console.log('Blocked new tab:', target.href);\n window.location.href = target.href;\n target.removeAttribute('target');\n }\n }, true);\n}\n`;\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","WebElementInfoImpl","content","rect","id","attributes","indexId","xpaths","isVisible","Math","debug","getDebug","WebPageContextParser","page","_opt","basicContext","commonContextParser","tree","webTree","traverseTree","elementInfo","limitOpenNewTabScript"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;;AC8BO,MAAMI;IAoBX,YAAY,EACVC,OAAO,EACPC,IAAI,EACJC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,MAAM,EACNC,SAAS,EAYV,CAAE;QAtCH;QAEA;QAEA;QAEA;QAEA;QAEA;QAKA;QAEA;QAsBE,IAAI,CAAC,OAAO,GAAGN;QACf,IAAI,CAAC,IAAI,GAAGC;QACZ,IAAI,CAAC,MAAM,GAAG;YACZM,KAAK,KAAK,CAACN,KAAK,IAAI,GAAGA,KAAK,KAAK,GAAG;YACpCM,KAAK,KAAK,CAACN,KAAK,GAAG,GAAGA,KAAK,MAAM,GAAG;SACrC;QACD,IAAI,CAAC,EAAE,GAAGC;QACV,IAAI,CAAC,UAAU,GAAGC;QAClB,IAAI,CAAC,OAAO,GAAGC;QACf,IAAI,CAAC,MAAM,GAAGC;QACd,IAAI,CAAC,SAAS,GAAGC;IACnB;AACF;AAEA,MAAME,QAAQC,AAAAA,IAAAA,uBAAAA,QAAAA,AAAAA,EAAS;AAChB,eAAeC,qBACpBC,IAAuB,EACvBC,IAAkC;QAOdD;IALpB,MAAME,eAAe,MAAMC,AAAAA,IAAAA,sBAAAA,mBAAAA,AAAAA,EAAoBH,MAAM;QACnD,iBAAiBC,KAAK,eAAe;IACvC;IAEAJ,MAAM;IACN,MAAMO,OAAQ,eAAMJ,CAAAA,4BAAAA,KAAK,mBAAmB,AAAD,IAAvBA,KAAAA,IAAAA,0BAAAA,IAAAA,CAAAA,KAAI,KAA6B;QACnD,MAAM;QACN,UAAU,EAAE;IACd;IACA,MAAMK,UAAUC,AAAAA,IAAAA,0BAAAA,YAAAA,AAAAA,EAAaF,MAAO,CAACG;QACnC,MAAM,EAAEjB,IAAI,EAAEC,EAAE,EAAEF,OAAO,EAAEG,UAAU,EAAEC,OAAO,EAAEE,SAAS,EAAE,GAAGY;QAC9D,OAAO,IAAInB,mBAAmB;YAC5BE;YACAC;YACAF;YACAG;YACAC;YACAE;QACF;IACF;IACAE,MAAM;IAEN,OAAO;QACL,GAAGK,YAAY;QACf,MAAMG;IACR;AACF;AAEO,MAAMG,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsBtC,CAAC"}
1
+ {"version":3,"file":"web-element.js","sources":["webpack://@midscene/web/webpack/runtime/define_property_getters","webpack://@midscene/web/webpack/runtime/has_own_property","webpack://@midscene/web/webpack/runtime/make_namespace_object","webpack://@midscene/web/./src/web-element.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n AgentOpt,\n DeviceAction,\n Rect,\n UIContext,\n WebElementInfo,\n} from '@midscene/core';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport { getDebug } from '@midscene/shared/logger';\nimport { _keyDefinitions } from '@midscene/shared/us-keyboard-layout';\n\nimport { commonContextParser } from '@midscene/core/agent';\nimport type { NodeType } from '@midscene/shared/constants';\nimport type ChromeExtensionProxyPage from './chrome-extension/page';\nimport type { PlaywrightWebPage } from './playwright';\nimport type { PuppeteerWebPage } from './puppeteer';\nimport type { StaticPage } from './static';\nexport type { WebElementInfo };\n\nexport type WebPageAgentOpt = AgentOpt & WebPageOpt;\nexport type WebPageOpt = {\n waitForNavigationTimeout?: number;\n waitForNetworkIdleTimeout?: number;\n forceSameTabNavigation?: boolean /* if limit the new tab to the current page, default true */;\n beforeInvokeAction?: () => Promise<void>;\n afterInvokeAction?: () => Promise<void>;\n customActions?: DeviceAction<any>[];\n};\n\nexport type WebPage =\n | PlaywrightWebPage\n | PuppeteerWebPage\n | StaticPage\n | ChromeExtensionProxyPage;\n\nexport class WebElementInfoImpl implements WebElementInfo {\n content: string;\n\n rect: Rect;\n\n center: [number, number];\n\n id: string;\n\n indexId: number;\n\n attributes: {\n nodeType: NodeType;\n [key: string]: string;\n };\n\n xpaths?: string[];\n\n isVisible: boolean;\n\n constructor({\n content,\n rect,\n id,\n attributes,\n indexId,\n xpaths,\n isVisible,\n }: {\n content: string;\n rect: Rect;\n id: string;\n attributes: {\n nodeType: NodeType;\n [key: string]: string;\n };\n indexId: number;\n xpaths?: string[];\n isVisible: boolean;\n }) {\n this.content = content;\n this.rect = rect;\n this.center = [\n Math.floor(rect.left + rect.width / 2),\n Math.floor(rect.top + rect.height / 2),\n ];\n this.id = id;\n this.attributes = attributes;\n this.indexId = indexId;\n this.xpaths = xpaths;\n this.isVisible = isVisible;\n }\n}\n\nconst debug = getDebug('web:parse-context');\nexport async function WebPageContextParser(\n page: AbstractInterface,\n _opt: { uploadServerUrl?: string },\n): Promise<UIContext> {\n const basicContext = await commonContextParser(page, {\n uploadServerUrl: _opt.uploadServerUrl,\n });\n\n // debug('will traverse element tree');\n // const tree = (await page.getElementsNodeTree?.()) || {\n // node: null,\n // children: [],\n // };\n // // const webTree = traverseTree(tree!, (elementInfo) => {\n // // const { rect, id, content, attributes, indexId, isVisible } = elementInfo;\n // // return new WebElementInfoImpl({\n // // rect,\n // // id,\n // // content,\n // // attributes,\n // // indexId,\n // // isVisible,\n // // });\n // // });\n // debug('traverse element tree end');\n\n return basicContext;\n}\n\nexport const limitOpenNewTabScript = `\nif (!window.__MIDSCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__) {\n window.__MIDSCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__ = true;\n\n // Intercept the window.open method (only once)\n window.open = function(url) {\n console.log('Blocked window.open:', url);\n window.location.href = url;\n return null;\n };\n\n // Block all a tag clicks with target=\"_blank\" (only once)\n document.addEventListener('click', function(e) {\n const target = e.target.closest('a');\n if (target && target.target === '_blank') {\n e.preventDefault();\n console.log('Blocked new tab:', target.href);\n window.location.href = target.href;\n target.removeAttribute('target');\n }\n }, true);\n}\n`;\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","WebElementInfoImpl","content","rect","id","attributes","indexId","xpaths","isVisible","Math","getDebug","WebPageContextParser","page","_opt","basicContext","commonContextParser","limitOpenNewTabScript"],"mappings":";;;IAAAA,oBAAoB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e,MAAMC,AAAAA,IAAAA,sBAAAA,mBAAAA,AAAAA,EAAoBH,MAAM;QACnD,iBAAiBC,KAAK,eAAe;IACvC;IAoBA,OAAOC;AACT;AAEO,MAAME,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsBtC,CAAC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "Browser use",
9
9
  "Android use"
10
10
  ],
11
- "version": "1.0.1-beta-20251022061922.0",
11
+ "version": "1.0.1-beta-20251024064637.0",
12
12
  "repository": "https://github.com/web-infra-dev/midscene",
13
13
  "homepage": "https://midscenejs.com/",
14
14
  "main": "./dist/lib/index.js",
@@ -103,9 +103,9 @@
103
103
  "http-server": "14.1.1",
104
104
  "socket.io": "^4.8.1",
105
105
  "socket.io-client": "4.8.1",
106
- "@midscene/core": "1.0.1-beta-20251022061922.0",
107
- "@midscene/playground": "1.0.1-beta-20251022061922.0",
108
- "@midscene/shared": "1.0.1-beta-20251022061922.0"
106
+ "@midscene/core": "1.0.1-beta-20251024064637.0",
107
+ "@midscene/playground": "1.0.1-beta-20251024064637.0",
108
+ "@midscene/shared": "1.0.1-beta-20251024064637.0"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@types/js-yaml": "4.0.9",