@rpascene/web 0.30.8

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.
Files changed (135) hide show
  1. package/README.md +9 -0
  2. package/bin/midscene-playground +3 -0
  3. package/dist/es/bin.mjs +26 -0
  4. package/dist/es/bin.mjs.map +1 -0
  5. package/dist/es/bridge-mode/agent-cli-side.mjs +117 -0
  6. package/dist/es/bridge-mode/agent-cli-side.mjs.map +1 -0
  7. package/dist/es/bridge-mode/browser.mjs +2 -0
  8. package/dist/es/bridge-mode/common.mjs +37 -0
  9. package/dist/es/bridge-mode/common.mjs.map +1 -0
  10. package/dist/es/bridge-mode/index.mjs +4 -0
  11. package/dist/es/bridge-mode/io-client.mjs +101 -0
  12. package/dist/es/bridge-mode/io-client.mjs.map +1 -0
  13. package/dist/es/bridge-mode/io-server.mjs +208 -0
  14. package/dist/es/bridge-mode/io-server.mjs.map +1 -0
  15. package/dist/es/bridge-mode/page-browser-side.mjs +103 -0
  16. package/dist/es/bridge-mode/page-browser-side.mjs.map +1 -0
  17. package/dist/es/chrome-extension/agent.mjs +9 -0
  18. package/dist/es/chrome-extension/agent.mjs.map +1 -0
  19. package/dist/es/chrome-extension/cdpInput.mjs +174 -0
  20. package/dist/es/chrome-extension/cdpInput.mjs.LICENSE.txt +5 -0
  21. package/dist/es/chrome-extension/cdpInput.mjs.map +1 -0
  22. package/dist/es/chrome-extension/dynamic-scripts.mjs +37 -0
  23. package/dist/es/chrome-extension/dynamic-scripts.mjs.map +1 -0
  24. package/dist/es/chrome-extension/index.mjs +5 -0
  25. package/dist/es/chrome-extension/page.mjs +633 -0
  26. package/dist/es/chrome-extension/page.mjs.map +1 -0
  27. package/dist/es/index.mjs +6 -0
  28. package/dist/es/playwright/ai-fixture.mjs +325 -0
  29. package/dist/es/playwright/ai-fixture.mjs.map +1 -0
  30. package/dist/es/playwright/index.mjs +23 -0
  31. package/dist/es/playwright/index.mjs.map +1 -0
  32. package/dist/es/playwright/page.mjs +9 -0
  33. package/dist/es/playwright/page.mjs.map +1 -0
  34. package/dist/es/playwright/reporter/index.mjs +90 -0
  35. package/dist/es/playwright/reporter/index.mjs.map +1 -0
  36. package/dist/es/puppeteer/agent-launcher.mjs +132 -0
  37. package/dist/es/puppeteer/agent-launcher.mjs.map +1 -0
  38. package/dist/es/puppeteer/base-page.mjs +491 -0
  39. package/dist/es/puppeteer/base-page.mjs.map +1 -0
  40. package/dist/es/puppeteer/index.mjs +17 -0
  41. package/dist/es/puppeteer/index.mjs.map +1 -0
  42. package/dist/es/puppeteer/page.mjs +9 -0
  43. package/dist/es/puppeteer/page.mjs.map +1 -0
  44. package/dist/es/static/index.mjs +3 -0
  45. package/dist/es/static/static-agent.mjs +10 -0
  46. package/dist/es/static/static-agent.mjs.map +1 -0
  47. package/dist/es/static/static-page.mjs +132 -0
  48. package/dist/es/static/static-page.mjs.map +1 -0
  49. package/dist/es/web-element.mjs +96 -0
  50. package/dist/es/web-element.mjs.map +1 -0
  51. package/dist/es/web-page.mjs +206 -0
  52. package/dist/es/web-page.mjs.map +1 -0
  53. package/dist/lib/bin.js +54 -0
  54. package/dist/lib/bin.js.map +1 -0
  55. package/dist/lib/bridge-mode/agent-cli-side.js +154 -0
  56. package/dist/lib/bridge-mode/agent-cli-side.js.map +1 -0
  57. package/dist/lib/bridge-mode/browser.js +38 -0
  58. package/dist/lib/bridge-mode/browser.js.map +1 -0
  59. package/dist/lib/bridge-mode/common.js +95 -0
  60. package/dist/lib/bridge-mode/common.js.map +1 -0
  61. package/dist/lib/bridge-mode/index.js +46 -0
  62. package/dist/lib/bridge-mode/index.js.map +1 -0
  63. package/dist/lib/bridge-mode/io-client.js +135 -0
  64. package/dist/lib/bridge-mode/io-client.js.map +1 -0
  65. package/dist/lib/bridge-mode/io-server.js +245 -0
  66. package/dist/lib/bridge-mode/io-server.js.map +1 -0
  67. package/dist/lib/bridge-mode/page-browser-side.js +147 -0
  68. package/dist/lib/bridge-mode/page-browser-side.js.map +1 -0
  69. package/dist/lib/chrome-extension/agent.js +43 -0
  70. package/dist/lib/chrome-extension/agent.js.map +1 -0
  71. package/dist/lib/chrome-extension/cdpInput.js +208 -0
  72. package/dist/lib/chrome-extension/cdpInput.js.LICENSE.txt +5 -0
  73. package/dist/lib/chrome-extension/cdpInput.js.map +1 -0
  74. package/dist/lib/chrome-extension/dynamic-scripts.js +77 -0
  75. package/dist/lib/chrome-extension/dynamic-scripts.js.map +1 -0
  76. package/dist/lib/chrome-extension/index.js +60 -0
  77. package/dist/lib/chrome-extension/index.js.map +1 -0
  78. package/dist/lib/chrome-extension/page.js +667 -0
  79. package/dist/lib/chrome-extension/page.js.map +1 -0
  80. package/dist/lib/index.js +60 -0
  81. package/dist/lib/index.js.map +1 -0
  82. package/dist/lib/playwright/ai-fixture.js +362 -0
  83. package/dist/lib/playwright/ai-fixture.js.map +1 -0
  84. package/dist/lib/playwright/index.js +66 -0
  85. package/dist/lib/playwright/index.js.map +1 -0
  86. package/dist/lib/playwright/page.js +43 -0
  87. package/dist/lib/playwright/page.js.map +1 -0
  88. package/dist/lib/playwright/reporter/index.js +124 -0
  89. package/dist/lib/playwright/reporter/index.js.map +1 -0
  90. package/dist/lib/puppeteer/agent-launcher.js +194 -0
  91. package/dist/lib/puppeteer/agent-launcher.js.map +1 -0
  92. package/dist/lib/puppeteer/base-page.js +531 -0
  93. package/dist/lib/puppeteer/base-page.js.map +1 -0
  94. package/dist/lib/puppeteer/index.js +57 -0
  95. package/dist/lib/puppeteer/index.js.map +1 -0
  96. package/dist/lib/puppeteer/page.js +43 -0
  97. package/dist/lib/puppeteer/page.js.map +1 -0
  98. package/dist/lib/static/index.js +52 -0
  99. package/dist/lib/static/index.js.map +1 -0
  100. package/dist/lib/static/static-agent.js +44 -0
  101. package/dist/lib/static/static-agent.js.map +1 -0
  102. package/dist/lib/static/static-page.js +166 -0
  103. package/dist/lib/static/static-page.js.map +1 -0
  104. package/dist/lib/web-element.js +136 -0
  105. package/dist/lib/web-element.js.map +1 -0
  106. package/dist/lib/web-page.js +256 -0
  107. package/dist/lib/web-page.js.map +1 -0
  108. package/dist/types/bin.d.ts +1 -0
  109. package/dist/types/bridge-mode/agent-cli-side.d.ts +32 -0
  110. package/dist/types/bridge-mode/browser.d.ts +2 -0
  111. package/dist/types/bridge-mode/common.d.ts +60 -0
  112. package/dist/types/bridge-mode/index.d.ts +4 -0
  113. package/dist/types/bridge-mode/io-client.d.ts +10 -0
  114. package/dist/types/bridge-mode/io-server.d.ts +26 -0
  115. package/dist/types/bridge-mode/page-browser-side.d.ts +18 -0
  116. package/dist/types/chrome-extension/agent.d.ts +5 -0
  117. package/dist/types/chrome-extension/cdpInput.d.ts +52 -0
  118. package/dist/types/chrome-extension/dynamic-scripts.d.ts +3 -0
  119. package/dist/types/chrome-extension/index.d.ts +5 -0
  120. package/dist/types/chrome-extension/page.d.ts +95 -0
  121. package/dist/types/index.d.ts +9 -0
  122. package/dist/types/playwright/ai-fixture.d.ts +117 -0
  123. package/dist/types/playwright/index.d.ts +12 -0
  124. package/dist/types/playwright/page.d.ts +6 -0
  125. package/dist/types/playwright/reporter/index.d.ts +18 -0
  126. package/dist/types/puppeteer/agent-launcher.d.ts +29 -0
  127. package/dist/types/puppeteer/base-page.d.ts +90 -0
  128. package/dist/types/puppeteer/index.d.ts +9 -0
  129. package/dist/types/puppeteer/page.d.ts +6 -0
  130. package/dist/types/static/index.d.ts +2 -0
  131. package/dist/types/static/static-agent.d.ts +5 -0
  132. package/dist/types/static/static-page.d.ts +52 -0
  133. package/dist/types/web-element.d.ts +51 -0
  134. package/dist/types/web-page.d.ts +59 -0
  135. package/package.json +164 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ PuppeteerAgent: ()=>PuppeteerAgent,
28
+ overrideAIConfig: ()=>env_namespaceObject.overrideAIConfig,
29
+ PuppeteerWebPage: ()=>external_page_js_namespaceObject.PuppeteerWebPage
30
+ });
31
+ const agent_namespaceObject = require("@rpascene/core/agent");
32
+ const logger_namespaceObject = require("@rpascene/shared/logger");
33
+ const external_base_page_js_namespaceObject = require("./base-page.js");
34
+ const external_page_js_namespaceObject = require("./page.js");
35
+ const env_namespaceObject = require("@rpascene/shared/env");
36
+ const debug = (0, logger_namespaceObject.getDebug)('puppeteer:agent');
37
+ class PuppeteerAgent extends agent_namespaceObject.Agent {
38
+ constructor(page, opts){
39
+ const webPage = new external_page_js_namespaceObject.PuppeteerWebPage(page, opts);
40
+ super(webPage, opts);
41
+ const { forceSameTabNavigation = true } = opts ?? {};
42
+ if (forceSameTabNavigation) (0, external_base_page_js_namespaceObject.forceClosePopup)(page, debug);
43
+ }
44
+ }
45
+ exports.PuppeteerAgent = __webpack_exports__.PuppeteerAgent;
46
+ exports.PuppeteerWebPage = __webpack_exports__.PuppeteerWebPage;
47
+ exports.overrideAIConfig = __webpack_exports__.overrideAIConfig;
48
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
49
+ "PuppeteerAgent",
50
+ "PuppeteerWebPage",
51
+ "overrideAIConfig"
52
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
53
+ Object.defineProperty(exports, '__esModule', {
54
+ value: true
55
+ });
56
+
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puppeteer\\index.js","sources":["webpack://@rpascene/web/webpack/runtime/define_property_getters","webpack://@rpascene/web/webpack/runtime/has_own_property","webpack://@rpascene/web/webpack/runtime/make_namespace_object","webpack://@rpascene/web/./src/puppeteer/index.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 { WebPageAgentOpt } from '@/web-element';\nimport { Agent as PageAgent } from '@rpascene/core/agent';\nimport { getDebug } from '@rpascene/shared/logger';\nimport type { Page as PuppeteerPage } from 'puppeteer';\nimport { forceClosePopup } from './base-page';\nimport { PuppeteerWebPage } from './page';\n\nconst debug = getDebug('puppeteer:agent');\n\nexport { PuppeteerWebPage } from './page';\n\nexport class PuppeteerAgent extends PageAgent<PuppeteerWebPage> {\n constructor(page: PuppeteerPage, opts?: WebPageAgentOpt) {\n const webPage = new PuppeteerWebPage(page, opts);\n super(webPage, opts);\n\n const { forceSameTabNavigation = true } = opts ?? {};\n\n if (forceSameTabNavigation) {\n forceClosePopup(page, debug);\n }\n }\n}\n\nexport { overrideAIConfig } from '@rpascene/shared/env';\n\n// Do NOT export this since it requires puppeteer\n// export { puppeteerAgentForTarget } from './agent-launcher';\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","PuppeteerAgent","PageAgent","page","opts","webPage","PuppeteerWebPage","forceSameTabNavigation","forceClosePopup"],"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;;;;;;;;;;;;;;ACCA,MAAMI,QAAQC,AAAAA,IAAAA,uBAAAA,QAAAA,AAAAA,EAAS;AAIhB,MAAMC,uBAAuBC,sBAAAA,KAASA;IAC3C,YAAYC,IAAmB,EAAEC,IAAsB,CAAE;QACvD,MAAMC,UAAU,IAAIC,iCAAAA,gBAAgBA,CAACH,MAAMC;QAC3C,KAAK,CAACC,SAASD;QAEf,MAAM,EAAEG,yBAAyB,IAAI,EAAE,GAAGH,QAAQ,CAAC;QAEnD,IAAIG,wBACFC,AAAAA,IAAAA,sCAAAA,eAAAA,AAAAA,EAAgBL,MAAMJ;IAE1B;AACF"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ PuppeteerWebPage: ()=>PuppeteerWebPage
28
+ });
29
+ const external_base_page_js_namespaceObject = require("./base-page.js");
30
+ class PuppeteerWebPage extends external_base_page_js_namespaceObject.Page {
31
+ constructor(page, opts){
32
+ super(page, 'puppeteer', opts);
33
+ }
34
+ }
35
+ exports.PuppeteerWebPage = __webpack_exports__.PuppeteerWebPage;
36
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
37
+ "PuppeteerWebPage"
38
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
39
+ Object.defineProperty(exports, '__esModule', {
40
+ value: true
41
+ });
42
+
43
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puppeteer\\page.js","sources":["webpack://@rpascene/web/webpack/runtime/define_property_getters","webpack://@rpascene/web/webpack/runtime/has_own_property","webpack://@rpascene/web/webpack/runtime/make_namespace_object","webpack://@rpascene/web/./src/puppeteer/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 { WebPageOpt } from '@/web-element';\nimport type { Page as PuppeteerPageType } from 'puppeteer';\nimport { Page as BasePage } from './base-page';\n\nexport class PuppeteerWebPage extends BasePage<'puppeteer', PuppeteerPageType> {\n constructor(page: PuppeteerPageType, opts?: WebPageOpt) {\n super(page, 'puppeteer', opts);\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","PuppeteerWebPage","BasePage","page","opts"],"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;;;;;;;;ACFO,MAAMI,yBAAyBC,sCAAAA,IAAQA;IAC5C,YAAYC,IAAuB,EAAEC,IAAiB,CAAE;QACtD,KAAK,CAACD,MAAM,aAAaC;IAC3B;AACF"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ StaticPage: ()=>external_static_page_js_default(),
37
+ StaticPageAgent: ()=>external_static_agent_js_namespaceObject.StaticPageAgent
38
+ });
39
+ const external_static_agent_js_namespaceObject = require("./static-agent.js");
40
+ const external_static_page_js_namespaceObject = require("./static-page.js");
41
+ var external_static_page_js_default = /*#__PURE__*/ __webpack_require__.n(external_static_page_js_namespaceObject);
42
+ exports.StaticPage = __webpack_exports__.StaticPage;
43
+ exports.StaticPageAgent = __webpack_exports__.StaticPageAgent;
44
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
45
+ "StaticPage",
46
+ "StaticPageAgent"
47
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
48
+ Object.defineProperty(exports, '__esModule', {
49
+ value: true
50
+ });
51
+
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static\\index.js","sources":["webpack://@rpascene/web/webpack/runtime/compat_get_default_export","webpack://@rpascene/web/webpack/runtime/define_property_getters","webpack://@rpascene/web/webpack/runtime/has_own_property","webpack://@rpascene/web/webpack/runtime/make_namespace_object"],"sourcesContent":["// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__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};"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol"],"mappings":";;;IACAA,oBAAoB,CAAC,GAAG,CAACC;QACxB,IAAIC,SAASD,UAAUA,OAAO,UAAU,GACvC,IAAOA,MAAM,CAAC,UAAU,GACxB,IAAOA;QACRD,oBAAoB,CAAC,CAACE,QAAQ;YAAE,GAAGA;QAAO;QAC1C,OAAOA;IACR;;;ICPAF,oBAAoB,CAAC,GAAG,CAAC,UAASG;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGH,oBAAoB,CAAC,CAACG,YAAYC,QAAQ,CAACJ,oBAAoB,CAAC,CAAC,UAASI,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAJ,oBAAoB,CAAC,GAAG,CAACM,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFP,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOQ,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ StaticPageAgent: ()=>StaticPageAgent
28
+ });
29
+ const agent_namespaceObject = require("@rpascene/core/agent");
30
+ class StaticPageAgent extends agent_namespaceObject.Agent {
31
+ constructor(page){
32
+ super(page, {});
33
+ this.dryMode = true;
34
+ }
35
+ }
36
+ exports.StaticPageAgent = __webpack_exports__.StaticPageAgent;
37
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
38
+ "StaticPageAgent"
39
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
40
+ Object.defineProperty(exports, '__esModule', {
41
+ value: true
42
+ });
43
+
44
+ //# sourceMappingURL=static-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static\\static-agent.js","sources":["webpack://@rpascene/web/webpack/runtime/define_property_getters","webpack://@rpascene/web/webpack/runtime/has_own_property","webpack://@rpascene/web/webpack/runtime/make_namespace_object","webpack://@rpascene/web/./src/static/static-agent.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 { Agent as PageAgent } from '@rpascene/core/agent';\nimport type StaticPage from './static-page';\n\nexport class StaticPageAgent extends PageAgent {\n constructor(page: StaticPage) {\n super(page, {});\n this.dryMode = true;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","StaticPageAgent","PageAgent","page"],"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;;;;;;;;ACHO,MAAMI,wBAAwBC,sBAAAA,KAASA;IAC5C,YAAYC,IAAgB,CAAE;QAC5B,KAAK,CAACA,MAAM,CAAC;QACb,IAAI,CAAC,OAAO,GAAG;IACjB;AACF"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ default: ()=>StaticPage
28
+ });
29
+ const device_namespaceObject = require("@rpascene/core/device");
30
+ const common_namespaceObject = require("@rpascene/shared/common");
31
+ function _define_property(obj, key, value) {
32
+ if (key in obj) Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ else obj[key] = value;
39
+ return obj;
40
+ }
41
+ const ThrowNotImplemented = (methodName)=>{
42
+ throw new Error(`The method "${methodName}" is not implemented as designed since this is a static UI context. (${common_namespaceObject.ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED})`);
43
+ };
44
+ class StaticPage {
45
+ actionSpace() {
46
+ return [
47
+ (0, device_namespaceObject.defineActionTap)(async (param)=>{
48
+ ThrowNotImplemented('Tap');
49
+ }),
50
+ (0, device_namespaceObject.defineActionRightClick)(async (param)=>{
51
+ ThrowNotImplemented('RightClick');
52
+ }),
53
+ (0, device_namespaceObject.defineActionHover)(async (param)=>{
54
+ ThrowNotImplemented('Hover');
55
+ }),
56
+ (0, device_namespaceObject.defineActionInput)(async (param)=>{
57
+ ThrowNotImplemented('Input');
58
+ }),
59
+ (0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
60
+ ThrowNotImplemented('KeyboardPress');
61
+ }),
62
+ (0, device_namespaceObject.defineActionScroll)(async (param)=>{
63
+ ThrowNotImplemented('Scroll');
64
+ }),
65
+ (0, device_namespaceObject.defineActionDragAndDrop)(async (param)=>{
66
+ ThrowNotImplemented('DragAndDrop');
67
+ })
68
+ ];
69
+ }
70
+ async evaluateJavaScript(script) {
71
+ return ThrowNotImplemented('evaluateJavaScript');
72
+ }
73
+ async getElementsInfo() {
74
+ return ThrowNotImplemented('getElementsInfo');
75
+ }
76
+ async getElementsNodeTree() {
77
+ return ThrowNotImplemented('getElementsNodeTree');
78
+ }
79
+ async getXpathsById(id) {
80
+ return ThrowNotImplemented('getXpathsById');
81
+ }
82
+ async getXpathsByPoint(point) {
83
+ return ThrowNotImplemented('getXpathsByPoint');
84
+ }
85
+ async getElementInfoByXpath(xpath) {
86
+ return ThrowNotImplemented('getElementInfoByXpath');
87
+ }
88
+ async size() {
89
+ return {
90
+ ...this.uiContext.size,
91
+ dpr: this.uiContext.size.dpr || 1
92
+ };
93
+ }
94
+ async screenshotBase64() {
95
+ const base64 = this.uiContext.screenshotBase64;
96
+ if (!base64) throw new Error('screenshot base64 is empty');
97
+ return base64;
98
+ }
99
+ async url() {
100
+ return Promise.resolve('https://static_page_without_url');
101
+ }
102
+ async scrollUntilTop(startingPoint) {
103
+ return ThrowNotImplemented('scrollUntilTop');
104
+ }
105
+ async scrollUntilBottom(startingPoint) {
106
+ return ThrowNotImplemented('scrollUntilBottom');
107
+ }
108
+ async scrollUntilLeft(startingPoint) {
109
+ return ThrowNotImplemented('scrollUntilLeft');
110
+ }
111
+ async scrollUntilRight(startingPoint) {
112
+ return ThrowNotImplemented('scrollUntilRight');
113
+ }
114
+ async scrollUp(distance, startingPoint) {
115
+ return ThrowNotImplemented('scrollUp');
116
+ }
117
+ async scrollDown(distance, startingPoint) {
118
+ return ThrowNotImplemented('scrollDown');
119
+ }
120
+ async scrollLeft(distance, startingPoint) {
121
+ return ThrowNotImplemented('scrollLeft');
122
+ }
123
+ async scrollRight(distance, startingPoint) {
124
+ return ThrowNotImplemented('scrollRight');
125
+ }
126
+ async clearInput() {
127
+ return ThrowNotImplemented('clearInput');
128
+ }
129
+ async destroy() {}
130
+ async getContext() {
131
+ return this.uiContext;
132
+ }
133
+ updateContext(newContext) {
134
+ this.uiContext = newContext;
135
+ }
136
+ constructor(uiContext){
137
+ _define_property(this, "interfaceType", 'static');
138
+ _define_property(this, "uiContext", void 0);
139
+ _define_property(this, "mouse", {
140
+ click: ThrowNotImplemented.bind(null, 'mouse.click'),
141
+ wheel: ThrowNotImplemented.bind(null, 'mouse.wheel'),
142
+ move: ThrowNotImplemented.bind(null, 'mouse.move'),
143
+ drag: ThrowNotImplemented.bind(null, 'mouse.drag')
144
+ });
145
+ _define_property(this, "keyboard", {
146
+ type: ThrowNotImplemented.bind(null, 'keyboard.type'),
147
+ press: ThrowNotImplemented.bind(null, 'keyboard.press')
148
+ });
149
+ if (uiContext.tree) this.uiContext = uiContext;
150
+ else this.uiContext = Object.assign(uiContext, {
151
+ tree: {
152
+ node: null,
153
+ children: []
154
+ }
155
+ });
156
+ }
157
+ }
158
+ exports["default"] = __webpack_exports__["default"];
159
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
160
+ "default"
161
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
162
+ Object.defineProperty(exports, '__esModule', {
163
+ value: true
164
+ });
165
+
166
+ //# sourceMappingURL=static-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static\\static-page.js","sources":["webpack://@rpascene/web/webpack/runtime/define_property_getters","webpack://@rpascene/web/webpack/runtime/has_own_property","webpack://@rpascene/web/webpack/runtime/make_namespace_object","webpack://@rpascene/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 '@rpascene/core';\nimport type { AbstractInterface } from '@rpascene/core/device';\nimport {\n defineActionDragAndDrop,\n defineActionHover,\n defineActionInput,\n defineActionKeyboardPress,\n defineActionRightClick,\n defineActionScroll,\n defineActionTap,\n} from '@rpascene/core/device';\nimport { ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED } from '@rpascene/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 getXpathsById(id: string) {\n return ThrowNotImplemented('getXpathsById');\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","id","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,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;;;;;;;;;;;;;;;;;;;ACYA,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AAOA,oBAAoB,IAAI,CAAC,MAAM;QACxC;QAlIE,IAAIsB,UAAU,IAAI,EAChB,IAAI,CAAC,SAAS,GAAGA;aAEjB,IAAI,CAAC,SAAS,GAAG1B,OAAO,MAAM,CAAC0B,WAAW;YACxC,MAAM;gBACJ,MAAM;gBACN,UAAU,EAAE;YACd;QACF;IAEJ;AAqIF"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ WebElementInfoImpl: ()=>WebElementInfoImpl,
28
+ WebPageContextParser: ()=>WebPageContextParser,
29
+ limitOpenNewTabScript: ()=>limitOpenNewTabScript
30
+ });
31
+ const extractor_namespaceObject = require("@rpascene/shared/extractor");
32
+ const logger_namespaceObject = require("@rpascene/shared/logger");
33
+ const agent_namespaceObject = require("@rpascene/core/agent");
34
+ function _define_property(obj, key, value) {
35
+ if (key in obj) Object.defineProperty(obj, key, {
36
+ value: value,
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true
40
+ });
41
+ else obj[key] = value;
42
+ return obj;
43
+ }
44
+ class WebElementInfoImpl {
45
+ constructor({ content, rect, id, attributes, indexId, xpaths, isVisible, allPaths, containerPaths }){
46
+ _define_property(this, "content", void 0);
47
+ _define_property(this, "rect", void 0);
48
+ _define_property(this, "center", void 0);
49
+ _define_property(this, "id", void 0);
50
+ _define_property(this, "indexId", void 0);
51
+ _define_property(this, "attributes", void 0);
52
+ _define_property(this, "xpaths", void 0);
53
+ _define_property(this, "isVisible", void 0);
54
+ _define_property(this, "allPaths", void 0);
55
+ _define_property(this, "containerPaths", void 0);
56
+ this.content = content;
57
+ this.rect = rect;
58
+ this.center = [
59
+ Math.floor(rect.left + rect.width / 2),
60
+ Math.floor(rect.top + rect.height / 2)
61
+ ];
62
+ this.id = id;
63
+ this.attributes = attributes;
64
+ this.indexId = indexId;
65
+ this.xpaths = xpaths;
66
+ this.isVisible = isVisible;
67
+ this.allPaths = allPaths;
68
+ this.containerPaths = containerPaths;
69
+ }
70
+ }
71
+ const debug = (0, logger_namespaceObject.getDebug)('web:parse-context');
72
+ async function WebPageContextParser(page, _opt) {
73
+ var _page_getElementsNodeTree;
74
+ const basicContext = await (0, agent_namespaceObject.commonContextParser)(page, {
75
+ uploadServerUrl: _opt.uploadServerUrl
76
+ });
77
+ debug('will traverse element tree');
78
+ const tree = await (null == (_page_getElementsNodeTree = page.getElementsNodeTree) ? void 0 : _page_getElementsNodeTree.call(page)) || {
79
+ node: null,
80
+ children: []
81
+ };
82
+ const webTree = (0, extractor_namespaceObject.traverseTree)(tree, (elementInfo)=>{
83
+ const { rect, id, content, attributes, indexId, isVisible, allPaths, containerPaths } = elementInfo;
84
+ return new WebElementInfoImpl({
85
+ rect,
86
+ id,
87
+ content,
88
+ attributes,
89
+ indexId,
90
+ isVisible,
91
+ allPaths,
92
+ containerPaths
93
+ });
94
+ });
95
+ debug('traverse element tree end');
96
+ return {
97
+ ...basicContext,
98
+ tree: webTree
99
+ };
100
+ }
101
+ const limitOpenNewTabScript = `
102
+ if (!window.__RPASCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__) {
103
+ window.__RPASCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__ = true;
104
+
105
+ // Intercept the window.open method (only once)
106
+ window.open = function(url) {
107
+ console.log('Blocked window.open:', url);
108
+ window.location.href = url;
109
+ return null;
110
+ };
111
+
112
+ // Block all a tag clicks with target="_blank" (only once)
113
+ document.addEventListener('click', function(e) {
114
+ const target = e.target.closest('a');
115
+ if (target && target.target === '_blank') {
116
+ e.preventDefault();
117
+ console.log('Blocked new tab:', target.href);
118
+ window.location.href = target.href;
119
+ target.removeAttribute('target');
120
+ }
121
+ }, true);
122
+ }
123
+ `;
124
+ exports.WebElementInfoImpl = __webpack_exports__.WebElementInfoImpl;
125
+ exports.WebPageContextParser = __webpack_exports__.WebPageContextParser;
126
+ exports.limitOpenNewTabScript = __webpack_exports__.limitOpenNewTabScript;
127
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
128
+ "WebElementInfoImpl",
129
+ "WebPageContextParser",
130
+ "limitOpenNewTabScript"
131
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
132
+ Object.defineProperty(exports, '__esModule', {
133
+ value: true
134
+ });
135
+
136
+ //# sourceMappingURL=web-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-element.js","sources":["webpack://@rpascene/web/webpack/runtime/define_property_getters","webpack://@rpascene/web/webpack/runtime/has_own_property","webpack://@rpascene/web/webpack/runtime/make_namespace_object","webpack://@rpascene/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 '@rpascene/core';\nimport type { AbstractInterface } from '@rpascene/core/device';\nimport { traverseTree } from '@rpascene/shared/extractor';\nimport { getDebug } from '@rpascene/shared/logger';\nimport { _keyDefinitions } from '@rpascene/shared/us-keyboard-layout';\n\nimport { commonContextParser } from '@rpascene/core/agent';\nimport type { NodeType } from '@rpascene/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 allPaths?: any;\n\n containerPaths?: any;\n\n constructor({\n content,\n rect,\n id,\n attributes,\n indexId,\n xpaths,\n isVisible,\n allPaths,\n containerPaths\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 allPaths?: any;\n containerPaths?: any;\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 this.allPaths = allPaths;\n this.containerPaths = containerPaths\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, allPaths, containerPaths } = elementInfo;\n return new WebElementInfoImpl({\n rect,\n id,\n content,\n attributes,\n indexId,\n isVisible,\n allPaths,\n containerPaths\n });\n });\n debug('traverse element tree end');\n\n return {\n ...basicContext,\n tree: webTree,\n };\n}\n\nexport const limitOpenNewTabScript = `\nif (!window.__RPASCENE_NEW_TAB_INTERCEPTOR_INITIALIZED__) {\n window.__RPASCENE_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","allPaths","containerPaths","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,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