@midscene/web 1.17.8-beta-20261106101231.0 → 1.17.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.
- package/dist/es/bridge-mode/io-client.mjs +2 -2
- package/dist/es/bridge-mode/io-client.mjs.map +1 -1
- package/dist/es/bridge-mode/io-server.mjs +2 -2
- package/dist/es/bridge-mode/io-server.mjs.map +1 -1
- package/dist/es/bridge-mode/page-browser-side.mjs +1 -1
- package/dist/es/bridge-mode/page-browser-side.mjs.map +1 -1
- package/dist/es/chrome-extension/cdpInput.mjs +6 -6
- package/dist/es/chrome-extension/cdpInput.mjs.map +1 -1
- package/dist/es/chrome-extension/page.mjs.map +1 -1
- package/dist/es/cli.mjs +1 -1
- package/dist/es/common/test-runner/cookies.mjs +16 -8
- package/dist/es/common/test-runner/cookies.mjs.map +1 -1
- package/dist/es/common/test-runner/nodes.mjs +4 -2
- package/dist/es/common/test-runner/nodes.mjs.map +1 -1
- package/dist/es/platform.mjs +4 -1
- package/dist/es/platform.mjs.map +1 -1
- package/dist/lib/agent-init-args.js +1 -1
- package/dist/lib/agent-init-args.js.map +1 -1
- package/dist/lib/agent-tools-cdp.js +1 -1
- package/dist/lib/agent-tools-cdp.js.map +1 -1
- package/dist/lib/agent-tools-puppeteer.js +1 -1
- package/dist/lib/agent-tools-puppeteer.js.map +1 -1
- package/dist/lib/agent-tools-tabs.js +1 -1
- package/dist/lib/agent-tools-tabs.js.map +1 -1
- package/dist/lib/agent-tools.js +1 -1
- package/dist/lib/agent-tools.js.map +1 -1
- package/dist/lib/bridge-mode/agent-cli-side.js +1 -1
- package/dist/lib/bridge-mode/agent-cli-side.js.map +1 -1
- package/dist/lib/bridge-mode/browser.js +1 -1
- package/dist/lib/bridge-mode/browser.js.map +1 -1
- package/dist/lib/bridge-mode/common.js +1 -1
- package/dist/lib/bridge-mode/common.js.map +1 -1
- package/dist/lib/bridge-mode/index.js +1 -1
- package/dist/lib/bridge-mode/index.js.map +1 -1
- package/dist/lib/bridge-mode/io-client.js +3 -3
- package/dist/lib/bridge-mode/io-client.js.map +1 -1
- package/dist/lib/bridge-mode/io-server.js +3 -3
- package/dist/lib/bridge-mode/io-server.js.map +1 -1
- package/dist/lib/bridge-mode/page-browser-side.js +2 -2
- package/dist/lib/bridge-mode/page-browser-side.js.map +1 -1
- package/dist/lib/cdp-proxy-constants.js +1 -1
- package/dist/lib/cdp-proxy-constants.js.map +1 -1
- package/dist/lib/cdp-proxy-manager.js +1 -1
- package/dist/lib/cdp-proxy-manager.js.map +1 -1
- package/dist/lib/cdp-target-store.js +1 -1
- package/dist/lib/cdp-target-store.js.map +1 -1
- package/dist/lib/chrome-extension/agent.js +1 -1
- package/dist/lib/chrome-extension/agent.js.map +1 -1
- package/dist/lib/chrome-extension/cdpInput.js +7 -7
- package/dist/lib/chrome-extension/cdpInput.js.map +1 -1
- package/dist/lib/chrome-extension/dynamic-scripts.js +1 -1
- package/dist/lib/chrome-extension/dynamic-scripts.js.map +1 -1
- package/dist/lib/chrome-extension/index.js +1 -1
- package/dist/lib/chrome-extension/index.js.map +1 -1
- package/dist/lib/chrome-extension/page.js +1 -1
- package/dist/lib/chrome-extension/page.js.map +1 -1
- package/dist/lib/cli-options.js +1 -1
- package/dist/lib/cli-options.js.map +1 -1
- package/dist/lib/cli.js +1 -1
- package/dist/lib/common/browser-agent-utils.js +1 -1
- package/dist/lib/common/browser-agent-utils.js.map +1 -1
- package/dist/lib/common/browser-agent.js +1 -1
- package/dist/lib/common/browser-agent.js.map +1 -1
- package/dist/lib/common/browser-page-actions.js +1 -1
- package/dist/lib/common/browser-page-actions.js.map +1 -1
- package/dist/lib/common/cache-helper.js +1 -1
- package/dist/lib/common/cache-helper.js.map +1 -1
- package/dist/lib/common/input-scripts.js +1 -1
- package/dist/lib/common/input-scripts.js.map +1 -1
- package/dist/lib/common/test-runner/cookies.js +17 -9
- package/dist/lib/common/test-runner/cookies.js.map +1 -1
- package/dist/lib/common/test-runner/driver.js +1 -1
- package/dist/lib/common/test-runner/driver.js.map +1 -1
- package/dist/lib/common/test-runner/nodes.js +5 -3
- package/dist/lib/common/test-runner/nodes.js.map +1 -1
- package/dist/lib/common/test-runner/utils.js +1 -1
- package/dist/lib/common/test-runner/utils.js.map +1 -1
- package/dist/lib/common/viewport.js +1 -1
- package/dist/lib/common/viewport.js.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/platform.js +5 -2
- package/dist/lib/platform.js.map +1 -1
- package/dist/lib/playwright/agent.js +1 -1
- package/dist/lib/playwright/agent.js.map +1 -1
- package/dist/lib/playwright/ai-fixture.js +1 -1
- package/dist/lib/playwright/ai-fixture.js.map +1 -1
- package/dist/lib/playwright/browser-agent.js +1 -1
- package/dist/lib/playwright/browser-agent.js.map +1 -1
- package/dist/lib/playwright/index.js +1 -1
- package/dist/lib/playwright/index.js.map +1 -1
- package/dist/lib/playwright/page-agent.js +1 -1
- package/dist/lib/playwright/page-agent.js.map +1 -1
- package/dist/lib/playwright/page.js +1 -1
- package/dist/lib/playwright/page.js.map +1 -1
- package/dist/lib/playwright/report-filename.js +1 -1
- package/dist/lib/playwright/report-filename.js.map +1 -1
- package/dist/lib/playwright/reporter/index.js +1 -1
- package/dist/lib/playwright/reporter/index.js.map +1 -1
- package/dist/lib/playwright/test-runner/agent-nodes.js +1 -1
- package/dist/lib/playwright/test-runner/agent-nodes.js.map +1 -1
- package/dist/lib/playwright/test-runner/driver.js +1 -1
- package/dist/lib/playwright/test-runner/driver.js.map +1 -1
- package/dist/lib/playwright/test-runner/index.js +1 -1
- package/dist/lib/playwright/test-runner/index.js.map +1 -1
- package/dist/lib/playwright/test-runner/types.js +1 -1
- package/dist/lib/playwright/test-runner/types.js.map +1 -1
- package/dist/lib/playwright/test-runner/utils.js +1 -1
- package/dist/lib/playwright/test-runner/utils.js.map +1 -1
- package/dist/lib/puppeteer/agent-launcher.js +1 -1
- package/dist/lib/puppeteer/agent-launcher.js.map +1 -1
- package/dist/lib/puppeteer/agent.js +1 -1
- package/dist/lib/puppeteer/agent.js.map +1 -1
- package/dist/lib/puppeteer/base-page.js +1 -1
- package/dist/lib/puppeteer/base-page.js.map +1 -1
- package/dist/lib/puppeteer/browser-agent.js +1 -1
- package/dist/lib/puppeteer/browser-agent.js.map +1 -1
- package/dist/lib/puppeteer/browser-page-manager.js +1 -1
- package/dist/lib/puppeteer/browser-page-manager.js.map +1 -1
- package/dist/lib/puppeteer/index.js +1 -1
- package/dist/lib/puppeteer/index.js.map +1 -1
- package/dist/lib/puppeteer/page-agent.js +1 -1
- package/dist/lib/puppeteer/page-agent.js.map +1 -1
- package/dist/lib/puppeteer/page-ownership.js +1 -1
- package/dist/lib/puppeteer/page-ownership.js.map +1 -1
- package/dist/lib/puppeteer/page.js +1 -1
- package/dist/lib/puppeteer/page.js.map +1 -1
- package/dist/lib/puppeteer/scoped-browser-agent.js +1 -1
- package/dist/lib/puppeteer/scoped-browser-agent.js.map +1 -1
- package/dist/lib/puppeteer/screenshot.js +1 -1
- package/dist/lib/puppeteer/screenshot.js.map +1 -1
- package/dist/lib/puppeteer/test-runner/agent-nodes.js +1 -1
- package/dist/lib/puppeteer/test-runner/agent-nodes.js.map +1 -1
- package/dist/lib/puppeteer/test-runner/driver.js +1 -1
- package/dist/lib/puppeteer/test-runner/driver.js.map +1 -1
- package/dist/lib/puppeteer/test-runner/index.js +1 -1
- package/dist/lib/puppeteer/test-runner/index.js.map +1 -1
- package/dist/lib/puppeteer/test-runner/types.js +1 -1
- package/dist/lib/puppeteer/test-runner/types.js.map +1 -1
- package/dist/lib/puppeteer/test-runner/utils.js +1 -1
- package/dist/lib/puppeteer/test-runner/utils.js.map +1 -1
- package/dist/lib/static/index.js +1 -1
- package/dist/lib/static/index.js.map +1 -1
- package/dist/lib/static/static-agent.js +1 -1
- package/dist/lib/static/static-agent.js.map +1 -1
- package/dist/lib/static/static-page.js +1 -1
- package/dist/lib/static/static-page.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/web-element.js +1 -1
- package/dist/lib/web-element.js.map +1 -1
- package/dist/lib/web-page.js +1 -1
- package/dist/lib/web-page.js.map +1 -1
- package/dist/types/common/test-runner/cookies.d.ts.map +1 -1
- package/dist/types/platform.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -14,7 +14,7 @@ var __webpack_require__ = {};
|
|
|
14
14
|
})();
|
|
15
15
|
(()=>{
|
|
16
16
|
__webpack_require__.r = (exports1)=>{
|
|
17
|
-
if (
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
18
|
value: 'Module'
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -29,11 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
});
|
|
30
30
|
const us_keyboard_layout_namespaceObject = require("@midscene/shared/us-keyboard-layout");
|
|
31
31
|
const utils_namespaceObject = require("@midscene/shared/utils");
|
|
32
|
-
|
|
33
|
-
* @license
|
|
34
|
-
* Copyright 2017 Google Inc.
|
|
35
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
-
*/ function _check_private_redeclaration(obj, privateCollection) {
|
|
32
|
+
function _check_private_redeclaration(obj, privateCollection) {
|
|
37
33
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
38
34
|
}
|
|
39
35
|
function _class_apply_descriptor_get(receiver, descriptor) {
|
|
@@ -82,7 +78,11 @@ function _define_property(obj, key, value) {
|
|
|
82
78
|
else obj[key] = value;
|
|
83
79
|
return obj;
|
|
84
80
|
}
|
|
85
|
-
|
|
81
|
+
/**
|
|
82
|
+
* @license
|
|
83
|
+
* Copyright 2017 Google Inc.
|
|
84
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
85
|
+
*/ var _pressedKeys = /*#__PURE__*/ new WeakMap(), _client = /*#__PURE__*/ new WeakMap(), _modifierBit = /*#__PURE__*/ new WeakSet(), _keyDescriptionForString = /*#__PURE__*/ new WeakSet();
|
|
86
86
|
class CdpKeyboard {
|
|
87
87
|
updateClient(client) {
|
|
88
88
|
_class_private_field_set(this, _client, client);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome-extension/cdpInput.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/chrome-extension/cdpInput.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};","// From https://github.com/puppeteer/puppeteer/blob/15abcc390862fd08cc3475532f2d9a11284aee6b/packages/puppeteer-core/src/cdp/Input.ts#L55\n// with some modifications to fit the session type\n/**\n * @license\n * Copyright 2017 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type KeyDefinition,\n type KeyInput,\n _keyDefinitions,\n} from '@midscene/shared/us-keyboard-layout';\nimport { assert } from '@midscene/shared/utils';\n\ntype KeyDescription = Required<\n Pick<KeyDefinition, 'keyCode' | 'key' | 'text' | 'code' | 'location'>\n>;\n\n/**\n * @public\n */\nexport interface KeyDownOptions {\n /**\n * @deprecated Do not use. This is automatically handled.\n */\n text?: string;\n /**\n * @deprecated Do not use. This is automatically handled.\n */\n commands?: string[];\n}\n\n/**\n * @public\n */\nexport interface KeyboardTypeOptions {\n /**\n * Time to wait between key presses in milliseconds\n * @default undefined\n */\n delay?: number;\n}\n\n/**\n * @public\n */\nexport type KeyPressOptions = KeyDownOptions & KeyboardTypeOptions;\n\ntype InternalCDPSession = {\n send: (command: string, params: any) => Promise<void>;\n};\n\n/**\n * @internal\n */\nexport class CdpKeyboard {\n #pressedKeys = new Set<string>();\n\n #client: InternalCDPSession;\n\n _modifiers = 0;\n\n constructor(client: InternalCDPSession) {\n this.#client = client;\n }\n\n updateClient(client: InternalCDPSession): void {\n this.#client = client;\n }\n\n async down(\n key: KeyInput,\n options: Readonly<KeyDownOptions> = {\n text: undefined,\n commands: [],\n },\n ): Promise<void> {\n const description = this.#keyDescriptionForString(key);\n\n const autoRepeat = this.#pressedKeys.has(description.code);\n this.#pressedKeys.add(description.code);\n this._modifiers |= this.#modifierBit(description.key);\n\n const text = options.text === undefined ? description.text : options.text;\n await this.#client.send('Input.dispatchKeyEvent', {\n type: text ? 'keyDown' : 'rawKeyDown',\n modifiers: this._modifiers,\n windowsVirtualKeyCode: description.keyCode,\n code: description.code,\n key: description.key,\n text: text,\n unmodifiedText: text,\n autoRepeat,\n location: description.location,\n isKeypad: description.location === 3,\n commands: options.commands,\n });\n }\n\n #modifierBit(key: string): number {\n if (key === 'Alt') {\n return 1;\n }\n if (key === 'Control') {\n return 2;\n }\n if (key === 'Meta') {\n return 4;\n }\n if (key === 'Shift') {\n return 8;\n }\n return 0;\n }\n\n #keyDescriptionForString(keyString: KeyInput): KeyDescription {\n const shift = this._modifiers & 8;\n const description = {\n key: '',\n keyCode: 0,\n code: '',\n text: '',\n location: 0,\n };\n\n const definition = _keyDefinitions[keyString];\n\n assert(definition, `Unknown key: \"${keyString}\"`);\n\n if (definition.key) {\n description.key = definition.key;\n }\n if (shift && definition.shiftKey) {\n description.key = definition.shiftKey;\n }\n\n if (definition.keyCode) {\n description.keyCode = definition.keyCode;\n }\n if (shift && definition.shiftKeyCode) {\n description.keyCode = definition.shiftKeyCode;\n }\n\n if (definition.code) {\n description.code = definition.code;\n }\n\n if (definition.location) {\n description.location = definition.location;\n }\n\n if (description.key.length === 1) {\n description.text = description.key;\n }\n\n if (definition.text) {\n description.text = definition.text;\n }\n if (shift && definition.shiftText) {\n description.text = definition.shiftText;\n }\n\n // if any modifiers besides shift are pressed, no text should be sent\n if (this._modifiers & ~8) {\n description.text = '';\n }\n\n return description;\n }\n\n async up(key: KeyInput): Promise<void> {\n const description = this.#keyDescriptionForString(key);\n\n this._modifiers &= ~this.#modifierBit(description.key);\n this.#pressedKeys.delete(description.code);\n await this.#client.send('Input.dispatchKeyEvent', {\n type: 'keyUp',\n modifiers: this._modifiers,\n key: description.key,\n windowsVirtualKeyCode: description.keyCode,\n code: description.code,\n location: description.location,\n });\n }\n\n async sendCharacter(char: string): Promise<void> {\n await this.#client.send('Input.insertText', { text: char });\n }\n\n private charIsKey(char: string): char is KeyInput {\n return !!_keyDefinitions[char as KeyInput];\n }\n\n async type(\n text: string,\n options: Readonly<KeyboardTypeOptions> = {},\n ): Promise<void> {\n const delay = options.delay || undefined;\n for (const char of text) {\n if (this.charIsKey(char)) {\n await this.press(char, { delay });\n } else {\n if (delay) {\n await new Promise((f) => {\n return setTimeout(f, delay);\n });\n }\n await this.sendCharacter(char);\n }\n }\n }\n\n async press(\n key: KeyInput | KeyInput[],\n options: Readonly<KeyPressOptions> = {},\n ): Promise<void> {\n const { delay = null } = options;\n const keys = Array.isArray(key) ? key : [key];\n\n for (const k of keys) {\n await this.down(k, options);\n }\n\n if (delay) {\n await new Promise((f) => {\n return setTimeout(f, options.delay);\n });\n }\n\n for (const k of [...keys].reverse()) {\n await this.up(k);\n }\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","_pressedKeys","_client","modifierBit","keyDescriptionForString","CdpKeyboard","client","options","undefined","description","autoRepeat","text","char","_keyDefinitions","delay","Promise","f","setTimeout","keys","Array","k","Set","keyString","shift","assert"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAA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B,YAAY,CAAC,cAAc,EAAE2B,UAAU,CAAC,CAAC;IAEhD,IAAI3B,WAAW,GAAG,EAChBc,YAAY,GAAG,GAAGd,WAAW,GAAG;IAElC,IAAI4B,SAAS5B,WAAW,QAAQ,EAC9Bc,YAAY,GAAG,GAAGd,WAAW,QAAQ;IAGvC,IAAIA,WAAW,OAAO,EACpBc,YAAY,OAAO,GAAGd,WAAW,OAAO;IAE1C,IAAI4B,SAAS5B,WAAW,YAAY,EAClCc,YAAY,OAAO,GAAGd,WAAW,YAAY;IAG/C,IAAIA,WAAW,IAAI,EACjBc,YAAY,IAAI,GAAGd,WAAW,IAAI;IAGpC,IAAIA,WAAW,QAAQ,EACrBc,YAAY,QAAQ,GAAGd,WAAW,QAAQ;IAG5C,IAAIc,AAA2B,MAA3BA,YAAY,GAAG,CAAC,MAAM,EACxBA,YAAY,IAAI,GAAGA,YAAY,GAAG;IAGpC,IAAId,WAAW,IAAI,EACjBc,YAAY,IAAI,GAAGd,WAAW,IAAI;IAEpC,IAAI4B,SAAS5B,WAAW,SAAS,EAC/Bc,YAAY,IAAI,GAAGd,WAAW,SAAS;IAIzC,IAAI,AAAkB,KAAlB,IAAI,CAAC,UAAU,EACjBc,YAAY,IAAI,GAAG;IAGrB,OAAOA;AACT"}
|
|
1
|
+
{"version":3,"file":"chrome-extension/cdpInput.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/chrome-extension/cdpInput.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};","// From https://github.com/puppeteer/puppeteer/blob/15abcc390862fd08cc3475532f2d9a11284aee6b/packages/puppeteer-core/src/cdp/Input.ts#L55\n// with some modifications to fit the session type\n/**\n * @license\n * Copyright 2017 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n type KeyDefinition,\n type KeyInput,\n _keyDefinitions,\n} from '@midscene/shared/us-keyboard-layout';\nimport { assert } from '@midscene/shared/utils';\n\ntype KeyDescription = Required<\n Pick<KeyDefinition, 'keyCode' | 'key' | 'text' | 'code' | 'location'>\n>;\n\n/**\n * @public\n */\nexport interface KeyDownOptions {\n /**\n * @deprecated Do not use. This is automatically handled.\n */\n text?: string;\n /**\n * @deprecated Do not use. This is automatically handled.\n */\n commands?: string[];\n}\n\n/**\n * @public\n */\nexport interface KeyboardTypeOptions {\n /**\n * Time to wait between key presses in milliseconds\n * @default undefined\n */\n delay?: number;\n}\n\n/**\n * @public\n */\nexport type KeyPressOptions = KeyDownOptions & KeyboardTypeOptions;\n\ntype InternalCDPSession = {\n send: (command: string, params: any) => Promise<void>;\n};\n\n/**\n * @internal\n */\nexport class CdpKeyboard {\n #pressedKeys = new Set<string>();\n\n #client: InternalCDPSession;\n\n _modifiers = 0;\n\n constructor(client: InternalCDPSession) {\n this.#client = client;\n }\n\n updateClient(client: InternalCDPSession): void {\n this.#client = client;\n }\n\n async down(\n key: KeyInput,\n options: Readonly<KeyDownOptions> = {\n text: undefined,\n commands: [],\n },\n ): Promise<void> {\n const description = this.#keyDescriptionForString(key);\n\n const autoRepeat = this.#pressedKeys.has(description.code);\n this.#pressedKeys.add(description.code);\n this._modifiers |= this.#modifierBit(description.key);\n\n const text = options.text === undefined ? description.text : options.text;\n await this.#client.send('Input.dispatchKeyEvent', {\n type: text ? 'keyDown' : 'rawKeyDown',\n modifiers: this._modifiers,\n windowsVirtualKeyCode: description.keyCode,\n code: description.code,\n key: description.key,\n text: text,\n unmodifiedText: text,\n autoRepeat,\n location: description.location,\n isKeypad: description.location === 3,\n commands: options.commands,\n });\n }\n\n #modifierBit(key: string): number {\n if (key === 'Alt') {\n return 1;\n }\n if (key === 'Control') {\n return 2;\n }\n if (key === 'Meta') {\n return 4;\n }\n if (key === 'Shift') {\n return 8;\n }\n return 0;\n }\n\n #keyDescriptionForString(keyString: KeyInput): KeyDescription {\n const shift = this._modifiers & 8;\n const description = {\n key: '',\n keyCode: 0,\n code: '',\n text: '',\n location: 0,\n };\n\n const definition = _keyDefinitions[keyString];\n\n assert(definition, `Unknown key: \"${keyString}\"`);\n\n if (definition.key) {\n description.key = definition.key;\n }\n if (shift && definition.shiftKey) {\n description.key = definition.shiftKey;\n }\n\n if (definition.keyCode) {\n description.keyCode = definition.keyCode;\n }\n if (shift && definition.shiftKeyCode) {\n description.keyCode = definition.shiftKeyCode;\n }\n\n if (definition.code) {\n description.code = definition.code;\n }\n\n if (definition.location) {\n description.location = definition.location;\n }\n\n if (description.key.length === 1) {\n description.text = description.key;\n }\n\n if (definition.text) {\n description.text = definition.text;\n }\n if (shift && definition.shiftText) {\n description.text = definition.shiftText;\n }\n\n // if any modifiers besides shift are pressed, no text should be sent\n if (this._modifiers & ~8) {\n description.text = '';\n }\n\n return description;\n }\n\n async up(key: KeyInput): Promise<void> {\n const description = this.#keyDescriptionForString(key);\n\n this._modifiers &= ~this.#modifierBit(description.key);\n this.#pressedKeys.delete(description.code);\n await this.#client.send('Input.dispatchKeyEvent', {\n type: 'keyUp',\n modifiers: this._modifiers,\n key: description.key,\n windowsVirtualKeyCode: description.keyCode,\n code: description.code,\n location: description.location,\n });\n }\n\n async sendCharacter(char: string): Promise<void> {\n await this.#client.send('Input.insertText', { text: char });\n }\n\n private charIsKey(char: string): char is KeyInput {\n return !!_keyDefinitions[char as KeyInput];\n }\n\n async type(\n text: string,\n options: Readonly<KeyboardTypeOptions> = {},\n ): Promise<void> {\n const delay = options.delay || undefined;\n for (const char of text) {\n if (this.charIsKey(char)) {\n await this.press(char, { delay });\n } else {\n if (delay) {\n await new Promise((f) => {\n return setTimeout(f, delay);\n });\n }\n await this.sendCharacter(char);\n }\n }\n }\n\n async press(\n key: KeyInput | KeyInput[],\n options: Readonly<KeyPressOptions> = {},\n ): Promise<void> {\n const { delay = null } = options;\n const keys = Array.isArray(key) ? key : [key];\n\n for (const k of keys) {\n await this.down(k, options);\n }\n\n if (delay) {\n await new Promise((f) => {\n return setTimeout(f, options.delay);\n });\n }\n\n for (const k of [...keys].reverse()) {\n await this.up(k);\n }\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","_pressedKeys","_client","modifierBit","keyDescriptionForString","CdpKeyboard","client","options","undefined","description","autoRepeat","text","char","_keyDefinitions","delay","Promise","f","setTimeout","keys","Array","k","Set","keyString","shift","assert"],"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,MAAlB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA;;;;CAIC,OAmDCI,eAAAA,WAAAA,GAAAA,IAAAA,WAEAC,UAAAA,WAAAA,GAAAA,IA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AAI4B,SAAS5B,WAAW,SAAS,EAC/Bc,YAAY,IAAI,GAAGd,WAAW,SAAS;IAIzC,IAAI,AAAkB,KAAlB,IAAI,CAAC,UAAU,EACjBc,YAAY,IAAI,GAAG;IAGrB,OAAOA;AACT"}
|
|
@@ -22,7 +22,7 @@ var __webpack_require__ = {};
|
|
|
22
22
|
})();
|
|
23
23
|
(()=>{
|
|
24
24
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
26
|
value: 'Module'
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome-extension/dynamic-scripts.js","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/chrome-extension/dynamic-scripts.ts"],"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};","import fs from 'node:fs';\nimport { ifInBrowser, ifInWorker } from '@midscene/shared/utils';\n\n// remember to include this file into extension's package\n// extract html element from page\nlet scriptFileContentCache: string | null = null;\nexport const getHtmlElementScript = async () => {\n const scriptFileToRetrieve = chrome.runtime.getURL('scripts/htmlElement.js');\n if (scriptFileContentCache) return scriptFileContentCache;\n if (ifInBrowser || ifInWorker) {\n const script = await fetch(scriptFileToRetrieve);\n scriptFileContentCache = await script.text();\n return scriptFileContentCache;\n }\n return fs.readFileSync(scriptFileToRetrieve, 'utf8');\n};\n\n// inject water flow animation\nlet waterFlowScriptFileContentCache: string | null = null;\nexport const injectWaterFlowAnimation = async () => {\n const waterFlowScriptFileToRetrieve = chrome.runtime.getURL(\n 'scripts/water-flow.js',\n );\n if (waterFlowScriptFileContentCache) return waterFlowScriptFileContentCache;\n if (ifInBrowser || ifInWorker) {\n const script = await fetch(waterFlowScriptFileToRetrieve);\n waterFlowScriptFileContentCache = await script.text();\n return waterFlowScriptFileContentCache;\n }\n return fs.readFileSync(waterFlowScriptFileToRetrieve, 'utf8');\n};\n\n// inject stop water flow animation\nlet stopWaterFlowScriptFileContentCache: string | null = null;\nexport const injectStopWaterFlowAnimation = async () => {\n const stopWaterFlowScriptFileToRetrieve = chrome.runtime.getURL(\n 'scripts/stop-water-flow.js',\n );\n if (stopWaterFlowScriptFileContentCache)\n return stopWaterFlowScriptFileContentCache;\n if (ifInBrowser || ifInWorker) {\n const script = await fetch(stopWaterFlowScriptFileToRetrieve);\n stopWaterFlowScriptFileContentCache = await script.text();\n return stopWaterFlowScriptFileContentCache;\n }\n return fs.readFileSync(stopWaterFlowScriptFileToRetrieve, 'utf8');\n};\n"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol","scriptFileContentCache","getHtmlElementScript","scriptFileToRetrieve","chrome","ifInBrowser","ifInWorker","script","fetch","fs","waterFlowScriptFileContentCache","injectWaterFlowAnimation","waterFlowScriptFileToRetrieve","stopWaterFlowScriptFileContentCache","injectStopWaterFlowAnimation","stopWaterFlowScriptFileToRetrieve"],"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,
|
|
1
|
+
{"version":3,"file":"chrome-extension/dynamic-scripts.js","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/chrome-extension/dynamic-scripts.ts"],"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};","import fs from 'node:fs';\nimport { ifInBrowser, ifInWorker } from '@midscene/shared/utils';\n\n// remember to include this file into extension's package\n// extract html element from page\nlet scriptFileContentCache: string | null = null;\nexport const getHtmlElementScript = async () => {\n const scriptFileToRetrieve = chrome.runtime.getURL('scripts/htmlElement.js');\n if (scriptFileContentCache) return scriptFileContentCache;\n if (ifInBrowser || ifInWorker) {\n const script = await fetch(scriptFileToRetrieve);\n scriptFileContentCache = await script.text();\n return scriptFileContentCache;\n }\n return fs.readFileSync(scriptFileToRetrieve, 'utf8');\n};\n\n// inject water flow animation\nlet waterFlowScriptFileContentCache: string | null = null;\nexport const injectWaterFlowAnimation = async () => {\n const waterFlowScriptFileToRetrieve = chrome.runtime.getURL(\n 'scripts/water-flow.js',\n );\n if (waterFlowScriptFileContentCache) return waterFlowScriptFileContentCache;\n if (ifInBrowser || ifInWorker) {\n const script = await fetch(waterFlowScriptFileToRetrieve);\n waterFlowScriptFileContentCache = await script.text();\n return waterFlowScriptFileContentCache;\n }\n return fs.readFileSync(waterFlowScriptFileToRetrieve, 'utf8');\n};\n\n// inject stop water flow animation\nlet stopWaterFlowScriptFileContentCache: string | null = null;\nexport const injectStopWaterFlowAnimation = async () => {\n const stopWaterFlowScriptFileToRetrieve = chrome.runtime.getURL(\n 'scripts/stop-water-flow.js',\n );\n if (stopWaterFlowScriptFileContentCache)\n return stopWaterFlowScriptFileContentCache;\n if (ifInBrowser || ifInWorker) {\n const script = await fetch(stopWaterFlowScriptFileToRetrieve);\n stopWaterFlowScriptFileContentCache = await script.text();\n return stopWaterFlowScriptFileContentCache;\n }\n return fs.readFileSync(stopWaterFlowScriptFileToRetrieve, 'utf8');\n};\n"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol","scriptFileContentCache","getHtmlElementScript","scriptFileToRetrieve","chrome","ifInBrowser","ifInWorker","script","fetch","fs","waterFlowScriptFileContentCache","injectWaterFlowAnimation","waterFlowScriptFileToRetrieve","stopWaterFlowScriptFileContentCache","injectStopWaterFlowAnimation","stopWaterFlowScriptFileToRetrieve"],"mapp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sBAAAA,WAAWA,IAAIC,sBAAAA,UAAUA,EAAE;QAC7B,MAAMC,SAAS,MAAMC,MAAMI;QAC3BF,kCAAkC,MAAMH,OAAO,IAAI;QACnD,OAAOG;IACT;IACA,OAAOD,2BAAAA,YAAe,CAACG,+BAA+B;AACxD;AAGA,IAAIC,sCAAqD;AAClD,MAAMC,+BAA+B;IAC1C,MAAMC,oCAAoCX,OAAO,OAAO,CAAC,MAAM,CAC7D;IAEF,IAAIS,qCACF,OAAOA;IACT,IAAIR,sBAAAA,WAAWA,IAAIC,sBAAAA,UAAUA,EAAE;QAC7B,MAAMC,SAAS,MAAMC,MAAMO;QAC3BF,sCAAsC,MAAMN,OAAO,IAAI;QACvD,OAAOM;IACT;IACA,OAAOJ,2BAAAA,YAAe,CAACM,mCAAmC;AAC5D"}
|
|
@@ -22,7 +22,7 @@ var __webpack_require__ = {};
|
|
|
22
22
|
})();
|
|
23
23
|
(()=>{
|
|
24
24
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
26
|
value: 'Module'
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome-extension/index.js","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","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,
|
|
1
|
+
{"version":3,"file":"chrome-extension/index.js","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","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,MAAlB,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"}
|
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome-extension/page.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/chrome-extension/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};","/// <reference types=\"chrome\" />\n\n/*\n It is used to interact with the page tab from the chrome extension.\n The page must be active when interacting with it.\n*/\n\nimport { limitOpenNewTabScript } from '@/web-element';\nimport type {\n ElementCacheFeature,\n ElementTreeNode,\n Point,\n Rect,\n Size,\n} from '@midscene/core';\nimport type {\n AbstractInterface,\n DeviceAction,\n FileChooserHandler,\n FileChooserRegistration,\n TextInputOptions,\n} from '@midscene/core/device';\nimport type { ElementInfo } from '@midscene/shared/extractor';\nimport { treeToList } from '@midscene/shared/extractor';\nimport { createImgBase64ByFormat } from '@midscene/shared/img';\nimport { getDebug } from '@midscene/shared/logger';\nimport { assert } from '@midscene/shared/utils';\nimport type { Protocol as CDPTypes } from 'devtools-protocol';\nimport {\n type CacheFeatureOptions,\n type WebElementCacheFeature,\n buildRectFromElementInfo,\n judgeOrderSensitive,\n sanitizeXpaths,\n} from '../common/cache-helper';\nimport { selectAllInputScript } from '../common/input-scripts';\nimport {\n type KeyInput,\n type MouseButton,\n commonWebActionsForWebPage,\n} from '../web-page';\nimport { CdpKeyboard } from './cdpInput';\nimport {\n getHtmlElementScript,\n injectStopWaterFlowAnimation,\n injectWaterFlowAnimation,\n} from './dynamic-scripts';\n\nconst debug = getDebug('web:chrome-extension:page');\n\nfunction sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nconst NAVIGATION_COMPLETE_TIMEOUT_MS = 30_000;\n\nfunction isBlankUrl(url: string | undefined): boolean {\n if (!url) return true;\n return url === 'about:blank' || url.startsWith('chrome://newtab');\n}\n\n/**\n * Wait for the browser target to settle before sending CDP commands to it.\n *\n * A cross-origin redirect can replace the target after `tabs.update()`\n * resolves. Sending `Runtime.evaluate` during that hand-off intermittently\n * fails because Chrome has detached the debugger from the old target.\n */\nfunction waitForTabNavigationComplete(\n tabId: number,\n targetUrl: string,\n updatedTab?: chrome.tabs.Tab,\n timeoutMs = NAVIGATION_COMPLETE_TIMEOUT_MS,\n): Promise<void> {\n return new Promise((resolve) => {\n let settled = false;\n const finish = () => {\n if (settled) return;\n settled = true;\n chrome.tabs.onUpdated.removeListener(onUpdated);\n clearTimeout(timer);\n resolve();\n };\n\n const isTargetTab = (tab: chrome.tabs.Tab | undefined): boolean => {\n if (!tab) return false;\n return tab.url === targetUrl || tab.pendingUrl === targetUrl;\n };\n\n const isReady = (\n tab: chrome.tabs.Tab | undefined,\n navigationUpdateObserved: boolean,\n ): boolean => {\n if (!tab || tab.status !== 'complete') return false;\n const currentUrl = tab.url || tab.pendingUrl || '';\n const isExpectedUrlKind = isBlankUrl(targetUrl)\n ? isBlankUrl(currentUrl)\n : !isBlankUrl(currentUrl);\n return (\n isExpectedUrlKind && (navigationUpdateObserved || isTargetTab(tab))\n );\n };\n\n const onUpdated = (\n id: number,\n info: chrome.tabs.TabChangeInfo,\n tab: chrome.tabs.Tab,\n ) => {\n // This listener is registered after tabs.update(), so a completion\n // event received here belongs to the navigation we initiated.\n if (id === tabId && isReady(tab, info.status === 'complete')) finish();\n };\n\n chrome.tabs.onUpdated.addListener(onUpdated);\n const timer = setTimeout(finish, timeoutMs);\n\n // tabs.update() returns the updated target. A completed returned tab is\n // already a settled result of this navigation, including a fast redirect.\n if (isReady(updatedTab, true)) {\n finish();\n return;\n }\n\n // The tab may have completed before the listener was added. Only accept\n // the requested target here: a previous complete HTTPS page is not proof\n // that this navigation has settled.\n chrome.tabs\n .get(tabId)\n .then((tab) => {\n if (isReady(tab, false)) finish();\n })\n .catch(() => {});\n });\n}\n\nfunction hasFlatNodeAttribute(\n attributes: string[] | undefined,\n name: string,\n): boolean {\n if (!attributes) return false;\n for (let i = 0; i < attributes.length; i += 2) {\n if (attributes[i] === name) return true;\n }\n return false;\n}\n\nfunction serializeError(error: Error): {\n message: string;\n name?: string;\n stack?: string;\n} {\n return {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n}\n\nexport default class ChromeExtensionProxyPage implements AbstractInterface {\n interfaceType = 'chrome-extension-proxy';\n\n public forceSameTabNavigation: boolean;\n\n readonly keyboardTypeDelay?: number;\n\n readonly inputStrategy?: TextInputOptions['inputStrategy'];\n\n private viewportSize?: Size;\n\n private activeTabId: number | null = null;\n\n private destroyed = false;\n\n private fileChooserEventHandler?: Parameters<\n typeof chrome.debugger.onEvent.addListener\n >[0];\n\n private fileChooserRegistrationVersion = 0;\n\n private bridgeFileChooserDispose?: () => void;\n\n private bridgeFileChooserGetError?: FileChooserRegistration['getError'];\n\n private isMobileEmulation: boolean | null = null;\n\n protected waterFlowAnimationEnabled = true;\n\n public _continueWhenFailedToAttachDebugger = false;\n\n constructor(\n forceSameTabNavigation: boolean,\n inputOptions?: TextInputOptions,\n ) {\n this.forceSameTabNavigation = forceSameTabNavigation;\n this.keyboardTypeDelay = inputOptions?.keyboardTypeDelay;\n this.inputStrategy = inputOptions?.inputStrategy;\n }\n\n actionSpace(): DeviceAction[] {\n return commonWebActionsForWebPage(this);\n }\n\n /**\n * Set the tab currently used by Midscene and optionally activate it in Chrome.\n */\n public async setActiveTabId(\n tabId: number,\n options: { activate?: boolean } = {},\n ) {\n if (this.activeTabId) {\n throw new Error(\n `Active tab id is already set, which is ${this.activeTabId}, cannot set it to ${tabId}`,\n );\n }\n if (options.activate !== false) {\n await chrome.tabs.update(tabId, { active: true });\n }\n this.activeTabId = tabId;\n }\n\n public async getActiveTabId() {\n return this.activeTabId;\n }\n\n /**\n * Get a list of current tabs\n * @returns {Promise<Array<{id: number, title: string, url: string}>>}\n */\n public async getBrowserTabList(): Promise<\n { id: string; title: string; url: string; currentActiveTab: boolean }[]\n > {\n const tabs = await chrome.tabs.query({ currentWindow: true });\n return tabs\n .map((tab) => ({\n id: `${tab.id}`,\n title: tab.title,\n url: tab.url,\n currentActiveTab: tab.active,\n }))\n .filter((tab) => tab.id && tab.title && tab.url) as {\n id: string;\n title: string;\n url: string;\n currentActiveTab: boolean;\n }[];\n }\n\n public async getTabIdOrConnectToCurrentTab() {\n if (this.activeTabId) {\n // Always reuse the controlled tab to avoid switching to a tab activated later by the user.\n return this.activeTabId;\n }\n const tabId = await chrome.tabs\n .query({ active: true, currentWindow: true })\n .then((tabs) => tabs[0]?.id);\n this.activeTabId = tabId || 0;\n return this.activeTabId;\n }\n\n /**\n * Ensure debugger is attached to the current tab.\n * Uses lazy attach pattern - only attaches when needed.\n */\n private async ensureDebuggerAttached() {\n assert(!this.destroyed, 'Page is destroyed');\n\n const url = await this.url();\n if (url.startsWith('chrome://')) {\n throw new Error(\n 'Cannot attach debugger to chrome:// pages, please use Midscene in a normal page with http://, https:// or file://',\n );\n }\n\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n try {\n await chrome.debugger.attach({ tabId }, '1.3');\n console.log('Debugger attached to tab:', tabId);\n } catch (error) {\n const errorMsg = (error as Error)?.message || '';\n // Already attached is OK, we can continue\n if (errorMsg.includes('Another debugger is already attached')) {\n console.log('Debugger already attached to tab:', tabId);\n return;\n }\n\n if (this._continueWhenFailedToAttachDebugger) {\n console.warn(\n 'Failed to attach debugger, but continuing due to _continueWhenFailedToAttachDebugger flag',\n error,\n );\n return;\n }\n\n throw error;\n }\n\n // Wait for debugger banner in Chrome to appear\n await sleep(500);\n\n // Enable water flow animation. Non-fatal: this is a purely visual\n // overlay, and Chrome can briefly detach the debugger between\n // attach() and the eval below (cross-origin navigation / Site\n // Isolation race). If we awaited it and it threw \"Debugger is not\n // attached\", the error would propagate out of the catch block in\n // sendCommandToDebugger, preventing the actual CDP command from\n // ever being retried. Fire-and-forget here so the lazy-attach\n // retry can succeed even when the animation fails.\n this.enableWaterFlowAnimation().catch((err) => {\n console.warn('Failed to enable water flow animation:', err);\n });\n }\n\n private async showMousePointer(x: number, y: number) {\n if (!this.waterFlowAnimationEnabled) return;\n\n // update mouse pointer while redirecting\n const pointerScript = `(() => {\n if(typeof window.midsceneWaterFlowAnimation !== 'undefined') {\n window.midsceneWaterFlowAnimation.enable();\n window.midsceneWaterFlowAnimation.showMousePointer(${x}, ${y});\n } else {\n console.log('midsceneWaterFlowAnimation is not defined');\n }\n })()`;\n\n await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `${pointerScript}`,\n });\n }\n\n private async hideMousePointer() {\n await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n if(typeof window.midsceneWaterFlowAnimation !== 'undefined') {\n window.midsceneWaterFlowAnimation.hideMousePointer();\n }\n })()`,\n });\n }\n\n /**\n * Public method to detach debugger without destroying the page instance.\n * Useful for error recovery scenarios where we want to remove the debugger banner\n * without completely destroying the page.\n */\n public async detachDebugger(tabId?: number) {\n const tabIdToDetach = tabId || (await this.getTabIdOrConnectToCurrentTab());\n console.log('detaching debugger from tab:', tabIdToDetach);\n\n try {\n await this.disableWaterFlowAnimation(tabIdToDetach);\n await sleep(200); // wait for the animation to stop\n } catch (error) {\n console.warn('Failed to disable water flow animation', error);\n }\n\n try {\n await chrome.debugger.detach({ tabId: tabIdToDetach });\n console.log('Debugger detached successfully from tab:', tabIdToDetach);\n } catch (error) {\n // Tab might be closed or debugger already detached - this is OK\n console.warn(\n 'Failed to detach debugger (may already be detached):',\n error,\n );\n }\n }\n\n private async enableWaterFlowAnimation() {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n // limit open page in new tab\n if (this.forceSameTabNavigation) {\n await chrome.debugger.sendCommand({ tabId }, 'Runtime.evaluate', {\n expression: limitOpenNewTabScript,\n });\n }\n\n if (!this.waterFlowAnimationEnabled) {\n return;\n }\n\n const script = await injectWaterFlowAnimation();\n // we will call this function in sendCommandToDebugger, so we have to use the chrome.debugger.sendCommand\n await chrome.debugger.sendCommand({ tabId }, 'Runtime.evaluate', {\n expression: script,\n });\n }\n\n private async disableWaterFlowAnimation(tabId: number) {\n const script = await injectStopWaterFlowAnimation();\n\n await chrome.debugger.sendCommand({ tabId }, 'Runtime.evaluate', {\n expression: script,\n });\n }\n\n public async setWaterFlowAnimationEnabled(enabled: boolean) {\n this.waterFlowAnimationEnabled = enabled;\n if (!enabled) {\n const script = await injectStopWaterFlowAnimation();\n await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: script,\n });\n }\n }\n\n /**\n * Returns the current water-flow animation enabled flag.\n */\n public getWaterFlowAnimationEnabled(): boolean {\n return this.waterFlowAnimationEnabled;\n }\n\n /**\n * Send a command to the debugger with automatic attach and retry on detachment.\n * Uses lazy attach pattern - will automatically attach if not already attached.\n */\n private async sendCommandToDebugger<ResponseType = any, RequestType = any>(\n command: string,\n params: RequestType,\n retryCount = 0,\n ): Promise<ResponseType> {\n const MAX_RETRIES = 2;\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n try {\n // Try to send command directly first\n const result = (await chrome.debugger.sendCommand(\n { tabId },\n command,\n params as any,\n )) as ResponseType;\n\n // Enable water flow animation after successful command (don't await)\n this.enableWaterFlowAnimation().catch((err) => {\n console.warn('Failed to enable water flow animation:', err);\n });\n\n return result;\n } catch (error) {\n // If command failed, check if it's because debugger is not attached\n const errorMsg = (error as Error)?.message || '';\n const isDetachError =\n errorMsg.includes('Debugger is not attached') ||\n errorMsg.includes('Cannot access a Target') ||\n errorMsg.includes('No target with given id');\n\n if (isDetachError && retryCount < MAX_RETRIES) {\n console.log(\n `Debugger not attached for command \"${command}\", attempting to attach (retry ${retryCount + 1}/${MAX_RETRIES})`,\n );\n\n // Try to attach and retry\n await this.ensureDebuggerAttached();\n\n return this.sendCommandToDebugger<ResponseType, RequestType>(\n command,\n params,\n retryCount + 1,\n );\n }\n\n // Not a detach error or out of retries\n throw error;\n }\n }\n\n private async getPageContentByCDP() {\n const script = await getHtmlElementScript();\n\n // check tab url\n await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: script,\n });\n\n const expression = () => {\n const tree = (\n window as any\n ).midscene_element_inspector.webExtractNodeTree();\n\n return {\n tree,\n size: {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n },\n };\n };\n const returnValue = await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: `(${expression.toString()})()`,\n returnByValue: true,\n });\n\n if (!returnValue.result.value) {\n const errorDescription =\n returnValue.exceptionDetails?.exception?.description || '';\n if (!errorDescription) {\n console.error('returnValue from cdp', returnValue);\n }\n throw new Error(\n `Failed to get page content from page, error: ${errorDescription}`,\n );\n }\n\n return returnValue.result.value as {\n tree: ElementTreeNode<ElementInfo>;\n size: Size;\n };\n }\n\n public async evaluateJavaScript(script: string) {\n return this.sendCommandToDebugger('Runtime.evaluate', {\n expression: script,\n awaitPromise: true,\n });\n }\n\n async registerFileChooserListener(\n handler: (chooser: FileChooserHandler) => Promise<void>,\n ): Promise<FileChooserRegistration> {\n const registrationVersion = ++this.fileChooserRegistrationVersion;\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n await this.ensureDebuggerAttached();\n await this.sendCommandToDebugger('Page.enable', {});\n await this.sendCommandToDebugger('DOM.enable', {});\n await this.sendCommandToDebugger('Page.setInterceptFileChooserDialog', {\n enabled: true,\n });\n\n if (this.fileChooserEventHandler) {\n chrome.debugger.onEvent.removeListener(this.fileChooserEventHandler);\n this.fileChooserEventHandler = undefined;\n }\n\n let capturedError: Error | undefined;\n let pendingFileChooserHandling = Promise.resolve();\n\n const fileChooserEventHandler: Parameters<\n typeof chrome.debugger.onEvent.addListener\n >[0] = (source, method, params) => {\n if (source.tabId !== tabId || method !== 'Page.fileChooserOpened') {\n return;\n }\n\n const event = params as CDPTypes.Page.FileChooserOpenedEvent;\n if (event.backendNodeId === undefined) {\n debug(\n 'chrome extension file chooser opened without backendNodeId, skip',\n );\n return;\n }\n\n const currentFileChooserHandling = (async () => {\n try {\n await handler({\n accept: async (files: string[]) => {\n const { node } = await this.sendCommandToDebugger<\n CDPTypes.DOM.DescribeNodeResponse,\n CDPTypes.DOM.DescribeNodeRequest\n >('DOM.describeNode', {\n backendNodeId: event.backendNodeId,\n });\n\n const hasWebkitDirectory =\n hasFlatNodeAttribute(node.attributes, 'webkitdirectory') ||\n hasFlatNodeAttribute(node.attributes, 'directory');\n if (hasWebkitDirectory) {\n throw new Error(\n 'Directory upload (webkitdirectory) is not supported in Chrome extension bridge mode. Please use Playwright instead, which supports directory upload since version 1.45.',\n );\n }\n\n if (\n files.length > 1 &&\n !hasFlatNodeAttribute(node.attributes, 'multiple')\n ) {\n throw new Error(\n 'Non-multiple file input can only accept single file',\n );\n }\n\n await this.sendCommandToDebugger('DOM.setFileInputFiles', {\n files,\n backendNodeId: event.backendNodeId,\n });\n },\n });\n } catch (error) {\n capturedError =\n error instanceof Error ? error : new Error(String(error));\n }\n })();\n const previousFileChooserHandling = pendingFileChooserHandling;\n pendingFileChooserHandling = Promise.all([\n previousFileChooserHandling,\n currentFileChooserHandling,\n ]).then(() => {});\n };\n\n this.fileChooserEventHandler = fileChooserEventHandler;\n chrome.debugger.onEvent.addListener(fileChooserEventHandler);\n\n return {\n dispose: () => {\n if (this.fileChooserEventHandler !== fileChooserEventHandler) {\n return;\n }\n chrome.debugger.onEvent.removeListener(fileChooserEventHandler);\n this.fileChooserEventHandler = undefined;\n Promise.resolve()\n .then(() => {\n if (this.fileChooserRegistrationVersion !== registrationVersion) {\n return;\n }\n return this.sendCommandToDebugger(\n 'Page.setInterceptFileChooserDialog',\n {\n enabled: false,\n },\n );\n })\n .catch((error) => {\n debug('failed to disable file chooser interception: %O', error);\n });\n },\n getError: async () => {\n await pendingFileChooserHandling;\n return capturedError;\n },\n };\n }\n\n async registerFileChooserAccept(files: string[]): Promise<void> {\n this.clearFileChooserAccept();\n const { dispose, getError } = await this.registerFileChooserListener(\n async (chooser) => {\n await chooser.accept(files);\n },\n );\n this.bridgeFileChooserDispose = dispose;\n this.bridgeFileChooserGetError = getError;\n }\n\n clearFileChooserAccept(): void {\n this.bridgeFileChooserDispose?.();\n this.bridgeFileChooserDispose = undefined;\n this.bridgeFileChooserGetError = undefined;\n }\n\n async getFileChooserError(): Promise<\n { message: string; name?: string; stack?: string } | undefined\n > {\n const error = await this.bridgeFileChooserGetError?.();\n return error ? serializeError(error) : undefined;\n }\n\n async beforeInvokeAction(): Promise<void> {\n // current implementation is wait until domReadyState is complete\n try {\n await this.waitUntilNetworkIdle();\n } catch (error) {\n // console.warn('Failed to wait until network idle', error);\n }\n }\n\n private async waitUntilNetworkIdle() {\n const timeout = 10000;\n const startTime = Date.now();\n let lastReadyState = '';\n while (Date.now() - startTime < timeout) {\n let result: any;\n try {\n result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: 'document.readyState',\n });\n } catch (error) {\n // Navigation can replace the target between tabs.update() and this\n // probe. Chrome occasionally reports that race as an empty object,\n // which cannot be recognised by sendCommandToDebugger's message-based\n // detach detection. Reattach and keep waiting for the settled page.\n debug('Failed to probe document readyState; retrying after attach', {\n error,\n });\n try {\n await this.ensureDebuggerAttached();\n } catch (attachError) {\n debug('Failed to reattach debugger while waiting for navigation', {\n error: attachError,\n });\n }\n await sleep(300);\n continue;\n }\n lastReadyState = result.result.value;\n if (lastReadyState === 'complete') {\n await new Promise((resolve) => setTimeout(resolve, 300));\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, 300));\n }\n throw new Error(\n `Failed to wait until network idle, last readyState: ${lastReadyState}`,\n );\n }\n\n // @deprecated\n async getElementsInfo() {\n const tree = await this.getElementsNodeTree();\n return treeToList(tree);\n }\n\n async getXpathsByPoint(point: Point, isOrderSensitive = false) {\n const script = await getHtmlElementScript();\n\n await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: script,\n });\n\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `window.midscene_element_inspector.getXpathsByPoint({left: ${point.left}, top: ${point.top}}, ${isOrderSensitive})`,\n returnByValue: true,\n });\n return result.result.value;\n }\n\n async getElementInfoByXpath(xpath: string) {\n const script = await getHtmlElementScript();\n\n // check tab url\n await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: script,\n });\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `window.midscene_element_inspector.getElementInfoByXpath(${JSON.stringify(xpath)})`,\n returnByValue: true,\n });\n return result.result.value;\n }\n\n async cacheFeatureForPoint(\n center: [number, number],\n options?: CacheFeatureOptions,\n ): Promise<ElementCacheFeature> {\n const point: Point = { left: center[0], top: center[1] };\n\n try {\n const isOrderSensitive = await judgeOrderSensitive(options, debug);\n const xpaths = await this.getXpathsByPoint(point, isOrderSensitive);\n return { xpaths: sanitizeXpaths(xpaths) };\n } catch (error) {\n debug('cacheFeatureForPoint failed: %O', error);\n return { xpaths: [] };\n }\n }\n\n async rectMatchesCacheFeature(feature: ElementCacheFeature): Promise<Rect> {\n const xpaths = sanitizeXpaths((feature as WebElementCacheFeature).xpaths);\n\n for (const xpath of xpaths) {\n try {\n const elementInfo = await this.getElementInfoByXpath(xpath);\n if (elementInfo?.rect) {\n return buildRectFromElementInfo(elementInfo);\n }\n } catch (error) {\n debug('rectMatchesCacheFeature failed for xpath %s: %O', xpath, error);\n }\n }\n\n throw new Error(\n `No matching element rect found for cache feature (tried ${xpaths.length} xpath(s))`,\n );\n }\n\n async getElementsNodeTree() {\n await this.hideMousePointer();\n const content = await this.getPageContentByCDP();\n if (content?.size) {\n this.viewportSize = content.size;\n }\n\n return content?.tree || { node: null, children: [] };\n }\n\n async size() {\n if (this.viewportSize) return this.viewportSize;\n\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: '({width: window.innerWidth, height: window.innerHeight})',\n returnByValue: true,\n });\n\n const sizeInfo: Size = result.result.value;\n console.log('sizeInfo', sizeInfo);\n\n this.viewportSize = sizeInfo;\n return sizeInfo;\n }\n\n async screenshotBase64() {\n // screenshot by cdp\n await this.hideMousePointer();\n const format = 'jpeg';\n const base64 = await this.sendCommandToDebugger('Page.captureScreenshot', {\n format,\n quality: 90,\n });\n return createImgBase64ByFormat(format, base64.data);\n }\n\n async url() {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n const url = await chrome.tabs.get(tabId).then((tab) => tab.url);\n return url || '';\n }\n\n async navigate(url: string): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n const updatedTab = await chrome.tabs.update(tabId, { url });\n await waitForTabNavigationComplete(tabId, url, updatedTab);\n // Wait for navigation to complete. The tab-level wait above avoids sending\n // CDP commands during cross-origin target replacement.\n await this.waitUntilNetworkIdle();\n }\n\n async reload(): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n await chrome.tabs.reload(tabId);\n // Wait for reload to complete\n await this.waitUntilNetworkIdle();\n }\n\n async goBack(): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n await chrome.tabs.goBack(tabId);\n // Wait for navigation to complete\n await this.waitUntilNetworkIdle();\n }\n\n async goForward(): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n await chrome.tabs.goForward(tabId);\n // Wait for navigation to complete\n await this.waitUntilNetworkIdle();\n }\n\n async stopLoading(): Promise<void> {\n await this.sendCommandToDebugger('Page.stopLoading', {});\n }\n\n async navigationState(): Promise<{ isLoading: boolean }> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n const tab = await chrome.tabs.get(tabId);\n return { isLoading: tab.status === 'loading' };\n }\n\n async scrollUntilTop(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(0, -9999999);\n }\n\n async scrollUntilBottom(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(0, 9999999);\n }\n\n async scrollUntilLeft(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(-9999999, 0);\n }\n\n async scrollUntilRight(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(9999999, 0);\n }\n\n async scrollUp(distance?: number, startingPoint?: Point) {\n const { height } = await this.size();\n const scrollDistance = distance || height * 0.7;\n return this.mouse.wheel(\n 0,\n -scrollDistance,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async scrollDown(distance?: number, startingPoint?: Point) {\n const { height } = await this.size();\n const scrollDistance = distance || height * 0.7;\n return this.mouse.wheel(\n 0,\n scrollDistance,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async scrollLeft(distance?: number, startingPoint?: Point) {\n const { width } = await this.size();\n const scrollDistance = distance || width * 0.7;\n return this.mouse.wheel(\n -scrollDistance,\n 0,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async scrollRight(distance?: number, startingPoint?: Point) {\n const { width } = await this.size();\n const scrollDistance = distance || width * 0.7;\n return this.mouse.wheel(\n scrollDistance,\n 0,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async clearInput(element: ElementInfo) {\n if (!element) {\n console.warn('No element to clear input');\n return;\n }\n\n await this.mouse.click(element.center[0], element.center[1]);\n\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyDown',\n commands: ['selectAll'],\n });\n\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyUp',\n commands: ['selectAll'],\n });\n\n await sleep(100);\n\n await this.keyboard.press({\n key: 'Backspace',\n });\n }\n\n async selectAllInput(element?: ElementInfo) {\n if (element) {\n await this.mouse.click(element.center[0], element.center[1]);\n }\n const selectionResult = await this.sendCommandToDebugger(\n 'Runtime.evaluate',\n {\n expression: selectAllInputScript,\n returnByValue: true,\n },\n );\n if (selectionResult?.result?.value === true) {\n return;\n }\n\n if (!element) {\n throw new Error('Replacing text requires a focused editable field');\n }\n\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyDown',\n commands: ['selectAll'],\n });\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyUp',\n commands: ['selectAll'],\n });\n }\n\n private latestMouseX = 100;\n private latestMouseY = 100;\n\n mouse = {\n click: async (\n x: number,\n y: number,\n options?: { button?: MouseButton; count?: number },\n ) => {\n const { button = 'left', count = 1 } = options || {};\n await this.mouse.move(x, y);\n // detect if the page is in mobile emulation mode\n if (this.isMobileEmulation === null) {\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);\n })()`,\n returnByValue: true,\n });\n this.isMobileEmulation = result?.result?.value;\n }\n\n if (this.isMobileEmulation && button === 'left') {\n // in mobile emulation mode, directly inject click event\n const touchPoints = [{ x: Math.round(x), y: Math.round(y) }];\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints,\n modifiers: 0,\n });\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n } else {\n // standard mousePressed + mouseReleased\n for (let i = 0; i < count; i++) {\n const clickCount = i + 1;\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x,\n y,\n button,\n clickCount,\n });\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x,\n y,\n button,\n clickCount,\n });\n if (i < count - 1) {\n await sleep(50);\n }\n }\n }\n },\n wheel: async (\n deltaX: number,\n deltaY: number,\n startX?: number,\n startY?: number,\n ) => {\n const finalX = startX || this.latestMouseX;\n const finalY = startY || this.latestMouseY;\n await this.showMousePointer(finalX, finalY);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseWheel',\n x: finalX,\n y: finalY,\n deltaX,\n deltaY,\n });\n this.latestMouseX = finalX;\n this.latestMouseY = finalY;\n },\n move: async (x: number, y: number) => {\n await this.showMousePointer(x, y);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseMoved',\n x,\n y,\n });\n this.latestMouseX = x;\n this.latestMouseY = y;\n },\n drag: async (\n from: { x: number; y: number },\n to: { x: number; y: number },\n ) => {\n await this.mouse.move(from.x, from.y);\n\n await sleep(200);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x: from.x,\n y: from.y,\n button: 'left',\n // CDP uses `buttons` to represent the currently pressed mouse buttons.\n // HTML5 drag/drop needs this state to treat following moves as dragging.\n buttons: 1,\n clickCount: 1,\n });\n\n await sleep(300);\n\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseMoved',\n x: to.x,\n y: to.y,\n button: 'left',\n buttons: 1,\n });\n\n await sleep(500);\n\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x: to.x,\n y: to.y,\n button: 'left',\n buttons: 0,\n clickCount: 1,\n });\n\n await sleep(200);\n\n await this.mouse.move(to.x, to.y);\n },\n };\n\n keyboard = {\n type: async (text: string) => {\n const cdpKeyboard = new CdpKeyboard({\n send: this.sendCommandToDebugger.bind(this),\n });\n await cdpKeyboard.type(text, { delay: 0 });\n },\n insertText: async (text: string) => {\n await this.sendCommandToDebugger('Input.insertText', { text });\n },\n press: async (\n action:\n | { key: KeyInput; command?: string }\n | { key: KeyInput; command?: string }[],\n ) => {\n const cdpKeyboard = new CdpKeyboard({\n send: this.sendCommandToDebugger.bind(this),\n });\n const keys = Array.isArray(action) ? action : [action];\n for (const k of keys) {\n const commands = k.command ? [k.command] : [];\n await cdpKeyboard.down(k.key, { commands });\n }\n for (const k of [...keys].reverse()) {\n await cdpKeyboard.up(k.key);\n }\n },\n };\n\n async destroy(): Promise<void> {\n this.destroyed = true;\n this.clearFileChooserAccept();\n const tabIdToDetach = this.activeTabId;\n this.activeTabId = null;\n if (tabIdToDetach) {\n await this.detachDebugger(tabIdToDetach);\n }\n }\n\n async longPress(x: number, y: number, duration?: number) {\n duration = duration || 500;\n // Keep a lower bound so the press is registered as a long press rather than\n // a click, but never cap the upper bound: the duration is the caller's\n // intent (e.g. \"hold for 6 seconds\").\n const MIN_LONG_PRESS_DURATION = 300;\n if (duration < MIN_LONG_PRESS_DURATION) {\n duration = MIN_LONG_PRESS_DURATION;\n }\n await this.mouse.move(x, y);\n\n if (this.isMobileEmulation === null) {\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);\n })()`,\n returnByValue: true,\n });\n this.isMobileEmulation = result?.result?.value;\n }\n\n if (this.isMobileEmulation) {\n const touchPoints = [{ x: Math.round(x), y: Math.round(y) }];\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints,\n modifiers: 0,\n });\n await new Promise((res) => setTimeout(res, duration));\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n } else {\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x,\n y,\n button: 'left',\n clickCount: 1,\n });\n await new Promise((res) => setTimeout(res, duration));\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x,\n y,\n button: 'left',\n clickCount: 1,\n });\n }\n this.latestMouseX = x;\n this.latestMouseY = y;\n }\n\n async swipe(\n from: { x: number; y: number },\n to: { x: number; y: number },\n duration?: number,\n ) {\n const LONG_PRESS_THRESHOLD = 500;\n const MIN_PRESS_THRESHOLD = 150;\n duration = duration || 300;\n if (duration < MIN_PRESS_THRESHOLD) {\n duration = MIN_PRESS_THRESHOLD;\n }\n if (duration > LONG_PRESS_THRESHOLD) {\n duration = LONG_PRESS_THRESHOLD;\n }\n\n if (this.isMobileEmulation === null) {\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);\n })()`,\n returnByValue: true,\n });\n this.isMobileEmulation = result?.result?.value;\n }\n\n const steps = 30;\n const delay = duration / steps;\n\n if (this.isMobileEmulation) {\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints: [{ x: Math.round(from.x), y: Math.round(from.y) }],\n modifiers: 0,\n });\n\n for (let i = 1; i <= steps; i++) {\n const x = from.x + (to.x - from.x) * (i / steps);\n const y = from.y + (to.y - from.y) * (i / steps);\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchMove',\n touchPoints: [{ x: Math.round(x), y: Math.round(y) }],\n modifiers: 0,\n });\n await new Promise((res) => setTimeout(res, delay));\n }\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n } else {\n await this.mouse.move(from.x, from.y);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x: from.x,\n y: from.y,\n button: 'left',\n clickCount: 1,\n });\n\n for (let i = 1; i <= steps; i++) {\n const x = from.x + (to.x - from.x) * (i / steps);\n const y = from.y + (to.y - from.y) * (i / steps);\n await this.mouse.move(x, y);\n await new Promise((res) => setTimeout(res, delay));\n }\n\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x: to.x,\n y: to.y,\n button: 'left',\n clickCount: 1,\n });\n }\n\n this.latestMouseX = to.x;\n this.latestMouseY = to.y;\n }\n\n async pinch(\n centerX: number,\n centerY: number,\n startDistance: number,\n endDistance: number,\n duration = 500,\n ): Promise<void> {\n const steps = 30;\n const delay = duration / steps;\n\n const halfStart = startDistance / 2;\n const halfEnd = endDistance / 2;\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints: [\n {\n x: Math.round(centerX),\n y: Math.round(centerY - halfStart),\n id: 0,\n },\n {\n x: Math.round(centerX),\n y: Math.round(centerY + halfStart),\n id: 1,\n },\n ],\n modifiers: 0,\n });\n\n for (let i = 1; i <= steps; i++) {\n const progress = i / steps;\n const currentHalf = halfStart + (halfEnd - halfStart) * progress;\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchMove',\n touchPoints: [\n {\n x: Math.round(centerX),\n y: Math.round(centerY - currentHalf),\n id: 0,\n },\n {\n x: Math.round(centerX),\n y: Math.round(centerY + currentHalf),\n id: 1,\n },\n ],\n modifiers: 0,\n });\n await new Promise((res) => setTimeout(res, delay));\n }\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","sleep","ms","Promise","resolve","setTimeout","NAVIGATION_COMPLETE_TIMEOUT_MS","isBlankUrl","url","waitForTabNavigationComplete","tabId","targetUrl","updatedTab","timeoutMs","settled","finish","chrome","onUpdated","clearTimeout","timer","isTargetTab","tab","isReady","navigationUpdateObserved","currentUrl","isExpectedUrlKind","id","info","hasFlatNodeAttribute","attributes","name","i","serializeError","error","ChromeExtensionProxyPage","commonWebActionsForWebPage","options","Error","tabs","assert","console","errorMsg","err","x","y","pointerScript","tabIdToDetach","limitOpenNewTabScript","script","injectWaterFlowAnimation","injectStopWaterFlowAnimation","enabled","command","params","retryCount","MAX_RETRIES","result","isDetachError","getHtmlElementScript","expression","tree","window","document","returnValue","errorDescription","handler","registrationVersion","undefined","capturedError","pendingFileChooserHandling","fileChooserEventHandler","source","method","event","currentFileChooserHandling","files","node","hasWebkitDirectory","String","previousFileChooserHandling","dispose","getError","chooser","timeout","startTime","Date","lastReadyState","attachError","treeToList","point","isOrderSensitive","xpath","JSON","center","judgeOrderSensitive","xpaths","sanitizeXpaths","feature","elementInfo","buildRectFromElementInfo","content","sizeInfo","format","base64","createImgBase64ByFormat","startingPoint","distance","height","scrollDistance","width","element","selectionResult","selectAllInputScript","duration","MIN_LONG_PRESS_DURATION","touchPoints","Math","res","from","to","LONG_PRESS_THRESHOLD","MIN_PRESS_THRESHOLD","steps","delay","centerX","centerY","startDistance","endDistance","halfStart","halfEnd","progress","currentHalf","forceSameTabNavigation","inputOptions","button","count","clickCount","deltaX","deltaY","startX","startY","finalX","finalY","text","cdpKeyboard","CdpKeyboard","action","keys","Array","k","commands"],"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,WAA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CAAC,oBAAoB;oBAAEA;gBAAK;YAC9D;YACA,OAAO,OACLG;gBAIA,MAAMF,cAAc,IAAIC,qCAAAA,WAAWA,CAAC;oBAClC,MAAM,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI;gBAC5C;gBACA,MAAME,OAAOC,MAAM,OAAO,CAACF,UAAUA,SAAS;oBAACA;iBAAO;gBACtD,KAAK,MAAMG,KAAKF,KAAM;oBACpB,MAAMG,WAAWD,EAAE,OAAO,GAAG;wBAACA,EAAE,OAAO;qBAAC,GAAG,EAAE;oBAC7C,MAAML,YAAY,IAAI,CAACK,EAAE,GAAG,EAAE;wBAAEC;oBAAS;gBAC3C;gBACA,KAAK,MAAMD,KAAK;uBAAIF;iBAAK,CAAC,OAAO,GAC/B,MAAMH,YAAY,EAAE,CAACK,EAAE,GAAG;YAE9B;QACF;QAr8BE,IAAI,CAAC,sBAAsB,GAAGjB;QAC9B,IAAI,CAAC,iBAAiB,GAAGC,cAAc;QACvC,IAAI,CAAC,aAAa,GAAGA,cAAc;IACrC;AAgpCF"}
|
|
1
|
+
{"version":3,"file":"chrome-extension/page.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/chrome-extension/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};","/// <reference types=\"chrome\" />\n\n/*\n It is used to interact with the page tab from the chrome extension.\n The page must be active when interacting with it.\n*/\n\nimport { limitOpenNewTabScript } from '@/web-element';\nimport type {\n ElementCacheFeature,\n ElementTreeNode,\n Point,\n Rect,\n Size,\n} from '@midscene/core';\nimport type {\n AbstractInterface,\n DeviceAction,\n FileChooserHandler,\n FileChooserRegistration,\n TextInputOptions,\n} from '@midscene/core/device';\nimport type { ElementInfo } from '@midscene/shared/extractor';\nimport { treeToList } from '@midscene/shared/extractor';\nimport { createImgBase64ByFormat } from '@midscene/shared/img';\nimport { getDebug } from '@midscene/shared/logger';\nimport { assert } from '@midscene/shared/utils';\nimport type { Protocol as CDPTypes } from 'devtools-protocol';\nimport {\n type CacheFeatureOptions,\n type WebElementCacheFeature,\n buildRectFromElementInfo,\n judgeOrderSensitive,\n sanitizeXpaths,\n} from '../common/cache-helper';\nimport { selectAllInputScript } from '../common/input-scripts';\nimport {\n type KeyInput,\n type MouseButton,\n commonWebActionsForWebPage,\n} from '../web-page';\nimport { CdpKeyboard } from './cdpInput';\nimport {\n getHtmlElementScript,\n injectStopWaterFlowAnimation,\n injectWaterFlowAnimation,\n} from './dynamic-scripts';\n\nconst debug = getDebug('web:chrome-extension:page');\n\nfunction sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nconst NAVIGATION_COMPLETE_TIMEOUT_MS = 30_000;\n\nfunction isBlankUrl(url: string | undefined): boolean {\n if (!url) return true;\n return url === 'about:blank' || url.startsWith('chrome://newtab');\n}\n\n/**\n * Wait for the browser target to settle before sending CDP commands to it.\n *\n * A cross-origin redirect can replace the target after `tabs.update()`\n * resolves. Sending `Runtime.evaluate` during that hand-off intermittently\n * fails because Chrome has detached the debugger from the old target.\n */\nfunction waitForTabNavigationComplete(\n tabId: number,\n targetUrl: string,\n updatedTab?: chrome.tabs.Tab,\n timeoutMs = NAVIGATION_COMPLETE_TIMEOUT_MS,\n): Promise<void> {\n return new Promise((resolve) => {\n let settled = false;\n const finish = () => {\n if (settled) return;\n settled = true;\n chrome.tabs.onUpdated.removeListener(onUpdated);\n clearTimeout(timer);\n resolve();\n };\n\n const isTargetTab = (tab: chrome.tabs.Tab | undefined): boolean => {\n if (!tab) return false;\n return tab.url === targetUrl || tab.pendingUrl === targetUrl;\n };\n\n const isReady = (\n tab: chrome.tabs.Tab | undefined,\n navigationUpdateObserved: boolean,\n ): boolean => {\n if (!tab || tab.status !== 'complete') return false;\n const currentUrl = tab.url || tab.pendingUrl || '';\n const isExpectedUrlKind = isBlankUrl(targetUrl)\n ? isBlankUrl(currentUrl)\n : !isBlankUrl(currentUrl);\n return (\n isExpectedUrlKind && (navigationUpdateObserved || isTargetTab(tab))\n );\n };\n\n const onUpdated = (\n id: number,\n info: chrome.tabs.TabChangeInfo,\n tab: chrome.tabs.Tab,\n ) => {\n // This listener is registered after tabs.update(), so a completion\n // event received here belongs to the navigation we initiated.\n if (id === tabId && isReady(tab, info.status === 'complete')) finish();\n };\n\n chrome.tabs.onUpdated.addListener(onUpdated);\n const timer = setTimeout(finish, timeoutMs);\n\n // tabs.update() returns the updated target. A completed returned tab is\n // already a settled result of this navigation, including a fast redirect.\n if (isReady(updatedTab, true)) {\n finish();\n return;\n }\n\n // The tab may have completed before the listener was added. Only accept\n // the requested target here: a previous complete HTTPS page is not proof\n // that this navigation has settled.\n chrome.tabs\n .get(tabId)\n .then((tab) => {\n if (isReady(tab, false)) finish();\n })\n .catch(() => {});\n });\n}\n\nfunction hasFlatNodeAttribute(\n attributes: string[] | undefined,\n name: string,\n): boolean {\n if (!attributes) return false;\n for (let i = 0; i < attributes.length; i += 2) {\n if (attributes[i] === name) return true;\n }\n return false;\n}\n\nfunction serializeError(error: Error): {\n message: string;\n name?: string;\n stack?: string;\n} {\n return {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n}\n\nexport default class ChromeExtensionProxyPage implements AbstractInterface {\n interfaceType = 'chrome-extension-proxy';\n\n public forceSameTabNavigation: boolean;\n\n readonly keyboardTypeDelay?: number;\n\n readonly inputStrategy?: TextInputOptions['inputStrategy'];\n\n private viewportSize?: Size;\n\n private activeTabId: number | null = null;\n\n private destroyed = false;\n\n private fileChooserEventHandler?: Parameters<\n typeof chrome.debugger.onEvent.addListener\n >[0];\n\n private fileChooserRegistrationVersion = 0;\n\n private bridgeFileChooserDispose?: () => void;\n\n private bridgeFileChooserGetError?: FileChooserRegistration['getError'];\n\n private isMobileEmulation: boolean | null = null;\n\n protected waterFlowAnimationEnabled = true;\n\n public _continueWhenFailedToAttachDebugger = false;\n\n constructor(\n forceSameTabNavigation: boolean,\n inputOptions?: TextInputOptions,\n ) {\n this.forceSameTabNavigation = forceSameTabNavigation;\n this.keyboardTypeDelay = inputOptions?.keyboardTypeDelay;\n this.inputStrategy = inputOptions?.inputStrategy;\n }\n\n actionSpace(): DeviceAction[] {\n return commonWebActionsForWebPage(this);\n }\n\n /**\n * Set the tab currently used by Midscene and optionally activate it in Chrome.\n */\n public async setActiveTabId(\n tabId: number,\n options: { activate?: boolean } = {},\n ) {\n if (this.activeTabId) {\n throw new Error(\n `Active tab id is already set, which is ${this.activeTabId}, cannot set it to ${tabId}`,\n );\n }\n if (options.activate !== false) {\n await chrome.tabs.update(tabId, { active: true });\n }\n this.activeTabId = tabId;\n }\n\n public async getActiveTabId() {\n return this.activeTabId;\n }\n\n /**\n * Get a list of current tabs\n * @returns {Promise<Array<{id: number, title: string, url: string}>>}\n */\n public async getBrowserTabList(): Promise<\n { id: string; title: string; url: string; currentActiveTab: boolean }[]\n > {\n const tabs = await chrome.tabs.query({ currentWindow: true });\n return tabs\n .map((tab) => ({\n id: `${tab.id}`,\n title: tab.title,\n url: tab.url,\n currentActiveTab: tab.active,\n }))\n .filter((tab) => tab.id && tab.title && tab.url) as {\n id: string;\n title: string;\n url: string;\n currentActiveTab: boolean;\n }[];\n }\n\n public async getTabIdOrConnectToCurrentTab() {\n if (this.activeTabId) {\n // Always reuse the controlled tab to avoid switching to a tab activated later by the user.\n return this.activeTabId;\n }\n const tabId = await chrome.tabs\n .query({ active: true, currentWindow: true })\n .then((tabs) => tabs[0]?.id);\n this.activeTabId = tabId || 0;\n return this.activeTabId;\n }\n\n /**\n * Ensure debugger is attached to the current tab.\n * Uses lazy attach pattern - only attaches when needed.\n */\n private async ensureDebuggerAttached() {\n assert(!this.destroyed, 'Page is destroyed');\n\n const url = await this.url();\n if (url.startsWith('chrome://')) {\n throw new Error(\n 'Cannot attach debugger to chrome:// pages, please use Midscene in a normal page with http://, https:// or file://',\n );\n }\n\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n try {\n await chrome.debugger.attach({ tabId }, '1.3');\n console.log('Debugger attached to tab:', tabId);\n } catch (error) {\n const errorMsg = (error as Error)?.message || '';\n // Already attached is OK, we can continue\n if (errorMsg.includes('Another debugger is already attached')) {\n console.log('Debugger already attached to tab:', tabId);\n return;\n }\n\n if (this._continueWhenFailedToAttachDebugger) {\n console.warn(\n 'Failed to attach debugger, but continuing due to _continueWhenFailedToAttachDebugger flag',\n error,\n );\n return;\n }\n\n throw error;\n }\n\n // Wait for debugger banner in Chrome to appear\n await sleep(500);\n\n // Enable water flow animation. Non-fatal: this is a purely visual\n // overlay, and Chrome can briefly detach the debugger between\n // attach() and the eval below (cross-origin navigation / Site\n // Isolation race). If we awaited it and it threw \"Debugger is not\n // attached\", the error would propagate out of the catch block in\n // sendCommandToDebugger, preventing the actual CDP command from\n // ever being retried. Fire-and-forget here so the lazy-attach\n // retry can succeed even when the animation fails.\n this.enableWaterFlowAnimation().catch((err) => {\n console.warn('Failed to enable water flow animation:', err);\n });\n }\n\n private async showMousePointer(x: number, y: number) {\n if (!this.waterFlowAnimationEnabled) return;\n\n // update mouse pointer while redirecting\n const pointerScript = `(() => {\n if(typeof window.midsceneWaterFlowAnimation !== 'undefined') {\n window.midsceneWaterFlowAnimation.enable();\n window.midsceneWaterFlowAnimation.showMousePointer(${x}, ${y});\n } else {\n console.log('midsceneWaterFlowAnimation is not defined');\n }\n })()`;\n\n await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `${pointerScript}`,\n });\n }\n\n private async hideMousePointer() {\n await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n if(typeof window.midsceneWaterFlowAnimation !== 'undefined') {\n window.midsceneWaterFlowAnimation.hideMousePointer();\n }\n })()`,\n });\n }\n\n /**\n * Public method to detach debugger without destroying the page instance.\n * Useful for error recovery scenarios where we want to remove the debugger banner\n * without completely destroying the page.\n */\n public async detachDebugger(tabId?: number) {\n const tabIdToDetach = tabId || (await this.getTabIdOrConnectToCurrentTab());\n console.log('detaching debugger from tab:', tabIdToDetach);\n\n try {\n await this.disableWaterFlowAnimation(tabIdToDetach);\n await sleep(200); // wait for the animation to stop\n } catch (error) {\n console.warn('Failed to disable water flow animation', error);\n }\n\n try {\n await chrome.debugger.detach({ tabId: tabIdToDetach });\n console.log('Debugger detached successfully from tab:', tabIdToDetach);\n } catch (error) {\n // Tab might be closed or debugger already detached - this is OK\n console.warn(\n 'Failed to detach debugger (may already be detached):',\n error,\n );\n }\n }\n\n private async enableWaterFlowAnimation() {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n // limit open page in new tab\n if (this.forceSameTabNavigation) {\n await chrome.debugger.sendCommand({ tabId }, 'Runtime.evaluate', {\n expression: limitOpenNewTabScript,\n });\n }\n\n if (!this.waterFlowAnimationEnabled) {\n return;\n }\n\n const script = await injectWaterFlowAnimation();\n // we will call this function in sendCommandToDebugger, so we have to use the chrome.debugger.sendCommand\n await chrome.debugger.sendCommand({ tabId }, 'Runtime.evaluate', {\n expression: script,\n });\n }\n\n private async disableWaterFlowAnimation(tabId: number) {\n const script = await injectStopWaterFlowAnimation();\n\n await chrome.debugger.sendCommand({ tabId }, 'Runtime.evaluate', {\n expression: script,\n });\n }\n\n public async setWaterFlowAnimationEnabled(enabled: boolean) {\n this.waterFlowAnimationEnabled = enabled;\n if (!enabled) {\n const script = await injectStopWaterFlowAnimation();\n await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: script,\n });\n }\n }\n\n /**\n * Returns the current water-flow animation enabled flag.\n */\n public getWaterFlowAnimationEnabled(): boolean {\n return this.waterFlowAnimationEnabled;\n }\n\n /**\n * Send a command to the debugger with automatic attach and retry on detachment.\n * Uses lazy attach pattern - will automatically attach if not already attached.\n */\n private async sendCommandToDebugger<ResponseType = any, RequestType = any>(\n command: string,\n params: RequestType,\n retryCount = 0,\n ): Promise<ResponseType> {\n const MAX_RETRIES = 2;\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n try {\n // Try to send command directly first\n const result = (await chrome.debugger.sendCommand(\n { tabId },\n command,\n params as any,\n )) as ResponseType;\n\n // Enable water flow animation after successful command (don't await)\n this.enableWaterFlowAnimation().catch((err) => {\n console.warn('Failed to enable water flow animation:', err);\n });\n\n return result;\n } catch (error) {\n // If command failed, check if it's because debugger is not attached\n const errorMsg = (error as Error)?.message || '';\n const isDetachError =\n errorMsg.includes('Debugger is not attached') ||\n errorMsg.includes('Cannot access a Target') ||\n errorMsg.includes('No target with given id');\n\n if (isDetachError && retryCount < MAX_RETRIES) {\n console.log(\n `Debugger not attached for command \"${command}\", attempting to attach (retry ${retryCount + 1}/${MAX_RETRIES})`,\n );\n\n // Try to attach and retry\n await this.ensureDebuggerAttached();\n\n return this.sendCommandToDebugger<ResponseType, RequestType>(\n command,\n params,\n retryCount + 1,\n );\n }\n\n // Not a detach error or out of retries\n throw error;\n }\n }\n\n private async getPageContentByCDP() {\n const script = await getHtmlElementScript();\n\n // check tab url\n await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: script,\n });\n\n const expression = () => {\n const tree = (\n window as any\n ).midscene_element_inspector.webExtractNodeTree();\n\n return {\n tree,\n size: {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n },\n };\n };\n const returnValue = await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: `(${expression.toString()})()`,\n returnByValue: true,\n });\n\n if (!returnValue.result.value) {\n const errorDescription =\n returnValue.exceptionDetails?.exception?.description || '';\n if (!errorDescription) {\n console.error('returnValue from cdp', returnValue);\n }\n throw new Error(\n `Failed to get page content from page, error: ${errorDescription}`,\n );\n }\n\n return returnValue.result.value as {\n tree: ElementTreeNode<ElementInfo>;\n size: Size;\n };\n }\n\n public async evaluateJavaScript(script: string) {\n return this.sendCommandToDebugger('Runtime.evaluate', {\n expression: script,\n awaitPromise: true,\n });\n }\n\n async registerFileChooserListener(\n handler: (chooser: FileChooserHandler) => Promise<void>,\n ): Promise<FileChooserRegistration> {\n const registrationVersion = ++this.fileChooserRegistrationVersion;\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n\n await this.ensureDebuggerAttached();\n await this.sendCommandToDebugger('Page.enable', {});\n await this.sendCommandToDebugger('DOM.enable', {});\n await this.sendCommandToDebugger('Page.setInterceptFileChooserDialog', {\n enabled: true,\n });\n\n if (this.fileChooserEventHandler) {\n chrome.debugger.onEvent.removeListener(this.fileChooserEventHandler);\n this.fileChooserEventHandler = undefined;\n }\n\n let capturedError: Error | undefined;\n let pendingFileChooserHandling = Promise.resolve();\n\n const fileChooserEventHandler: Parameters<\n typeof chrome.debugger.onEvent.addListener\n >[0] = (source, method, params) => {\n if (source.tabId !== tabId || method !== 'Page.fileChooserOpened') {\n return;\n }\n\n const event = params as CDPTypes.Page.FileChooserOpenedEvent;\n if (event.backendNodeId === undefined) {\n debug(\n 'chrome extension file chooser opened without backendNodeId, skip',\n );\n return;\n }\n\n const currentFileChooserHandling = (async () => {\n try {\n await handler({\n accept: async (files: string[]) => {\n const { node } = await this.sendCommandToDebugger<\n CDPTypes.DOM.DescribeNodeResponse,\n CDPTypes.DOM.DescribeNodeRequest\n >('DOM.describeNode', {\n backendNodeId: event.backendNodeId,\n });\n\n const hasWebkitDirectory =\n hasFlatNodeAttribute(node.attributes, 'webkitdirectory') ||\n hasFlatNodeAttribute(node.attributes, 'directory');\n if (hasWebkitDirectory) {\n throw new Error(\n 'Directory upload (webkitdirectory) is not supported in Chrome extension bridge mode. Please use Playwright instead, which supports directory upload since version 1.45.',\n );\n }\n\n if (\n files.length > 1 &&\n !hasFlatNodeAttribute(node.attributes, 'multiple')\n ) {\n throw new Error(\n 'Non-multiple file input can only accept single file',\n );\n }\n\n await this.sendCommandToDebugger('DOM.setFileInputFiles', {\n files,\n backendNodeId: event.backendNodeId,\n });\n },\n });\n } catch (error) {\n capturedError =\n error instanceof Error ? error : new Error(String(error));\n }\n })();\n const previousFileChooserHandling = pendingFileChooserHandling;\n pendingFileChooserHandling = Promise.all([\n previousFileChooserHandling,\n currentFileChooserHandling,\n ]).then(() => {});\n };\n\n this.fileChooserEventHandler = fileChooserEventHandler;\n chrome.debugger.onEvent.addListener(fileChooserEventHandler);\n\n return {\n dispose: () => {\n if (this.fileChooserEventHandler !== fileChooserEventHandler) {\n return;\n }\n chrome.debugger.onEvent.removeListener(fileChooserEventHandler);\n this.fileChooserEventHandler = undefined;\n Promise.resolve()\n .then(() => {\n if (this.fileChooserRegistrationVersion !== registrationVersion) {\n return;\n }\n return this.sendCommandToDebugger(\n 'Page.setInterceptFileChooserDialog',\n {\n enabled: false,\n },\n );\n })\n .catch((error) => {\n debug('failed to disable file chooser interception: %O', error);\n });\n },\n getError: async () => {\n await pendingFileChooserHandling;\n return capturedError;\n },\n };\n }\n\n async registerFileChooserAccept(files: string[]): Promise<void> {\n this.clearFileChooserAccept();\n const { dispose, getError } = await this.registerFileChooserListener(\n async (chooser) => {\n await chooser.accept(files);\n },\n );\n this.bridgeFileChooserDispose = dispose;\n this.bridgeFileChooserGetError = getError;\n }\n\n clearFileChooserAccept(): void {\n this.bridgeFileChooserDispose?.();\n this.bridgeFileChooserDispose = undefined;\n this.bridgeFileChooserGetError = undefined;\n }\n\n async getFileChooserError(): Promise<\n { message: string; name?: string; stack?: string } | undefined\n > {\n const error = await this.bridgeFileChooserGetError?.();\n return error ? serializeError(error) : undefined;\n }\n\n async beforeInvokeAction(): Promise<void> {\n // current implementation is wait until domReadyState is complete\n try {\n await this.waitUntilNetworkIdle();\n } catch (error) {\n // console.warn('Failed to wait until network idle', error);\n }\n }\n\n private async waitUntilNetworkIdle() {\n const timeout = 10000;\n const startTime = Date.now();\n let lastReadyState = '';\n while (Date.now() - startTime < timeout) {\n let result: any;\n try {\n result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: 'document.readyState',\n });\n } catch (error) {\n // Navigation can replace the target between tabs.update() and this\n // probe. Chrome occasionally reports that race as an empty object,\n // which cannot be recognised by sendCommandToDebugger's message-based\n // detach detection. Reattach and keep waiting for the settled page.\n debug('Failed to probe document readyState; retrying after attach', {\n error,\n });\n try {\n await this.ensureDebuggerAttached();\n } catch (attachError) {\n debug('Failed to reattach debugger while waiting for navigation', {\n error: attachError,\n });\n }\n await sleep(300);\n continue;\n }\n lastReadyState = result.result.value;\n if (lastReadyState === 'complete') {\n await new Promise((resolve) => setTimeout(resolve, 300));\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, 300));\n }\n throw new Error(\n `Failed to wait until network idle, last readyState: ${lastReadyState}`,\n );\n }\n\n // @deprecated\n async getElementsInfo() {\n const tree = await this.getElementsNodeTree();\n return treeToList(tree);\n }\n\n async getXpathsByPoint(point: Point, isOrderSensitive = false) {\n const script = await getHtmlElementScript();\n\n await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: script,\n });\n\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `window.midscene_element_inspector.getXpathsByPoint({left: ${point.left}, top: ${point.top}}, ${isOrderSensitive})`,\n returnByValue: true,\n });\n return result.result.value;\n }\n\n async getElementInfoByXpath(xpath: string) {\n const script = await getHtmlElementScript();\n\n // check tab url\n await this.sendCommandToDebugger<\n CDPTypes.Runtime.EvaluateResponse,\n CDPTypes.Runtime.EvaluateRequest\n >('Runtime.evaluate', {\n expression: script,\n });\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `window.midscene_element_inspector.getElementInfoByXpath(${JSON.stringify(xpath)})`,\n returnByValue: true,\n });\n return result.result.value;\n }\n\n async cacheFeatureForPoint(\n center: [number, number],\n options?: CacheFeatureOptions,\n ): Promise<ElementCacheFeature> {\n const point: Point = { left: center[0], top: center[1] };\n\n try {\n const isOrderSensitive = await judgeOrderSensitive(options, debug);\n const xpaths = await this.getXpathsByPoint(point, isOrderSensitive);\n return { xpaths: sanitizeXpaths(xpaths) };\n } catch (error) {\n debug('cacheFeatureForPoint failed: %O', error);\n return { xpaths: [] };\n }\n }\n\n async rectMatchesCacheFeature(feature: ElementCacheFeature): Promise<Rect> {\n const xpaths = sanitizeXpaths((feature as WebElementCacheFeature).xpaths);\n\n for (const xpath of xpaths) {\n try {\n const elementInfo = await this.getElementInfoByXpath(xpath);\n if (elementInfo?.rect) {\n return buildRectFromElementInfo(elementInfo);\n }\n } catch (error) {\n debug('rectMatchesCacheFeature failed for xpath %s: %O', xpath, error);\n }\n }\n\n throw new Error(\n `No matching element rect found for cache feature (tried ${xpaths.length} xpath(s))`,\n );\n }\n\n async getElementsNodeTree() {\n await this.hideMousePointer();\n const content = await this.getPageContentByCDP();\n if (content?.size) {\n this.viewportSize = content.size;\n }\n\n return content?.tree || { node: null, children: [] };\n }\n\n async size() {\n if (this.viewportSize) return this.viewportSize;\n\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: '({width: window.innerWidth, height: window.innerHeight})',\n returnByValue: true,\n });\n\n const sizeInfo: Size = result.result.value;\n console.log('sizeInfo', sizeInfo);\n\n this.viewportSize = sizeInfo;\n return sizeInfo;\n }\n\n async screenshotBase64() {\n // screenshot by cdp\n await this.hideMousePointer();\n const format = 'jpeg';\n const base64 = await this.sendCommandToDebugger('Page.captureScreenshot', {\n format,\n quality: 90,\n });\n return createImgBase64ByFormat(format, base64.data);\n }\n\n async url() {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n const url = await chrome.tabs.get(tabId).then((tab) => tab.url);\n return url || '';\n }\n\n async navigate(url: string): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n const updatedTab = await chrome.tabs.update(tabId, { url });\n await waitForTabNavigationComplete(tabId, url, updatedTab);\n // Wait for navigation to complete. The tab-level wait above avoids sending\n // CDP commands during cross-origin target replacement.\n await this.waitUntilNetworkIdle();\n }\n\n async reload(): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n await chrome.tabs.reload(tabId);\n // Wait for reload to complete\n await this.waitUntilNetworkIdle();\n }\n\n async goBack(): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n await chrome.tabs.goBack(tabId);\n // Wait for navigation to complete\n await this.waitUntilNetworkIdle();\n }\n\n async goForward(): Promise<void> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n await chrome.tabs.goForward(tabId);\n // Wait for navigation to complete\n await this.waitUntilNetworkIdle();\n }\n\n async stopLoading(): Promise<void> {\n await this.sendCommandToDebugger('Page.stopLoading', {});\n }\n\n async navigationState(): Promise<{ isLoading: boolean }> {\n const tabId = await this.getTabIdOrConnectToCurrentTab();\n const tab = await chrome.tabs.get(tabId);\n return { isLoading: tab.status === 'loading' };\n }\n\n async scrollUntilTop(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(0, -9999999);\n }\n\n async scrollUntilBottom(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(0, 9999999);\n }\n\n async scrollUntilLeft(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(-9999999, 0);\n }\n\n async scrollUntilRight(startingPoint?: Point) {\n if (startingPoint) {\n await this.mouse.move(startingPoint.left, startingPoint.top);\n }\n return this.mouse.wheel(9999999, 0);\n }\n\n async scrollUp(distance?: number, startingPoint?: Point) {\n const { height } = await this.size();\n const scrollDistance = distance || height * 0.7;\n return this.mouse.wheel(\n 0,\n -scrollDistance,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async scrollDown(distance?: number, startingPoint?: Point) {\n const { height } = await this.size();\n const scrollDistance = distance || height * 0.7;\n return this.mouse.wheel(\n 0,\n scrollDistance,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async scrollLeft(distance?: number, startingPoint?: Point) {\n const { width } = await this.size();\n const scrollDistance = distance || width * 0.7;\n return this.mouse.wheel(\n -scrollDistance,\n 0,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async scrollRight(distance?: number, startingPoint?: Point) {\n const { width } = await this.size();\n const scrollDistance = distance || width * 0.7;\n return this.mouse.wheel(\n scrollDistance,\n 0,\n startingPoint?.left,\n startingPoint?.top,\n );\n }\n\n async clearInput(element: ElementInfo) {\n if (!element) {\n console.warn('No element to clear input');\n return;\n }\n\n await this.mouse.click(element.center[0], element.center[1]);\n\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyDown',\n commands: ['selectAll'],\n });\n\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyUp',\n commands: ['selectAll'],\n });\n\n await sleep(100);\n\n await this.keyboard.press({\n key: 'Backspace',\n });\n }\n\n async selectAllInput(element?: ElementInfo) {\n if (element) {\n await this.mouse.click(element.center[0], element.center[1]);\n }\n const selectionResult = await this.sendCommandToDebugger(\n 'Runtime.evaluate',\n {\n expression: selectAllInputScript,\n returnByValue: true,\n },\n );\n if (selectionResult?.result?.value === true) {\n return;\n }\n\n if (!element) {\n throw new Error('Replacing text requires a focused editable field');\n }\n\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyDown',\n commands: ['selectAll'],\n });\n await this.sendCommandToDebugger('Input.dispatchKeyEvent', {\n type: 'keyUp',\n commands: ['selectAll'],\n });\n }\n\n private latestMouseX = 100;\n private latestMouseY = 100;\n\n mouse = {\n click: async (\n x: number,\n y: number,\n options?: { button?: MouseButton; count?: number },\n ) => {\n const { button = 'left', count = 1 } = options || {};\n await this.mouse.move(x, y);\n // detect if the page is in mobile emulation mode\n if (this.isMobileEmulation === null) {\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);\n })()`,\n returnByValue: true,\n });\n this.isMobileEmulation = result?.result?.value;\n }\n\n if (this.isMobileEmulation && button === 'left') {\n // in mobile emulation mode, directly inject click event\n const touchPoints = [{ x: Math.round(x), y: Math.round(y) }];\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints,\n modifiers: 0,\n });\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n } else {\n // standard mousePressed + mouseReleased\n for (let i = 0; i < count; i++) {\n const clickCount = i + 1;\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x,\n y,\n button,\n clickCount,\n });\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x,\n y,\n button,\n clickCount,\n });\n if (i < count - 1) {\n await sleep(50);\n }\n }\n }\n },\n wheel: async (\n deltaX: number,\n deltaY: number,\n startX?: number,\n startY?: number,\n ) => {\n const finalX = startX || this.latestMouseX;\n const finalY = startY || this.latestMouseY;\n await this.showMousePointer(finalX, finalY);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseWheel',\n x: finalX,\n y: finalY,\n deltaX,\n deltaY,\n });\n this.latestMouseX = finalX;\n this.latestMouseY = finalY;\n },\n move: async (x: number, y: number) => {\n await this.showMousePointer(x, y);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseMoved',\n x,\n y,\n });\n this.latestMouseX = x;\n this.latestMouseY = y;\n },\n drag: async (\n from: { x: number; y: number },\n to: { x: number; y: number },\n ) => {\n await this.mouse.move(from.x, from.y);\n\n await sleep(200);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x: from.x,\n y: from.y,\n button: 'left',\n // CDP uses `buttons` to represent the currently pressed mouse buttons.\n // HTML5 drag/drop needs this state to treat following moves as dragging.\n buttons: 1,\n clickCount: 1,\n });\n\n await sleep(300);\n\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseMoved',\n x: to.x,\n y: to.y,\n button: 'left',\n buttons: 1,\n });\n\n await sleep(500);\n\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x: to.x,\n y: to.y,\n button: 'left',\n buttons: 0,\n clickCount: 1,\n });\n\n await sleep(200);\n\n await this.mouse.move(to.x, to.y);\n },\n };\n\n keyboard = {\n type: async (text: string) => {\n const cdpKeyboard = new CdpKeyboard({\n send: this.sendCommandToDebugger.bind(this),\n });\n await cdpKeyboard.type(text, { delay: 0 });\n },\n insertText: async (text: string) => {\n await this.sendCommandToDebugger('Input.insertText', { text });\n },\n press: async (\n action:\n | { key: KeyInput; command?: string }\n | { key: KeyInput; command?: string }[],\n ) => {\n const cdpKeyboard = new CdpKeyboard({\n send: this.sendCommandToDebugger.bind(this),\n });\n const keys = Array.isArray(action) ? action : [action];\n for (const k of keys) {\n const commands = k.command ? [k.command] : [];\n await cdpKeyboard.down(k.key, { commands });\n }\n for (const k of [...keys].reverse()) {\n await cdpKeyboard.up(k.key);\n }\n },\n };\n\n async destroy(): Promise<void> {\n this.destroyed = true;\n this.clearFileChooserAccept();\n const tabIdToDetach = this.activeTabId;\n this.activeTabId = null;\n if (tabIdToDetach) {\n await this.detachDebugger(tabIdToDetach);\n }\n }\n\n async longPress(x: number, y: number, duration?: number) {\n duration = duration || 500;\n // Keep a lower bound so the press is registered as a long press rather than\n // a click, but never cap the upper bound: the duration is the caller's\n // intent (e.g. \"hold for 6 seconds\").\n const MIN_LONG_PRESS_DURATION = 300;\n if (duration < MIN_LONG_PRESS_DURATION) {\n duration = MIN_LONG_PRESS_DURATION;\n }\n await this.mouse.move(x, y);\n\n if (this.isMobileEmulation === null) {\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);\n })()`,\n returnByValue: true,\n });\n this.isMobileEmulation = result?.result?.value;\n }\n\n if (this.isMobileEmulation) {\n const touchPoints = [{ x: Math.round(x), y: Math.round(y) }];\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints,\n modifiers: 0,\n });\n await new Promise((res) => setTimeout(res, duration));\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n } else {\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x,\n y,\n button: 'left',\n clickCount: 1,\n });\n await new Promise((res) => setTimeout(res, duration));\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x,\n y,\n button: 'left',\n clickCount: 1,\n });\n }\n this.latestMouseX = x;\n this.latestMouseY = y;\n }\n\n async swipe(\n from: { x: number; y: number },\n to: { x: number; y: number },\n duration?: number,\n ) {\n const LONG_PRESS_THRESHOLD = 500;\n const MIN_PRESS_THRESHOLD = 150;\n duration = duration || 300;\n if (duration < MIN_PRESS_THRESHOLD) {\n duration = MIN_PRESS_THRESHOLD;\n }\n if (duration > LONG_PRESS_THRESHOLD) {\n duration = LONG_PRESS_THRESHOLD;\n }\n\n if (this.isMobileEmulation === null) {\n const result = await this.sendCommandToDebugger('Runtime.evaluate', {\n expression: `(() => {\n return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);\n })()`,\n returnByValue: true,\n });\n this.isMobileEmulation = result?.result?.value;\n }\n\n const steps = 30;\n const delay = duration / steps;\n\n if (this.isMobileEmulation) {\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints: [{ x: Math.round(from.x), y: Math.round(from.y) }],\n modifiers: 0,\n });\n\n for (let i = 1; i <= steps; i++) {\n const x = from.x + (to.x - from.x) * (i / steps);\n const y = from.y + (to.y - from.y) * (i / steps);\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchMove',\n touchPoints: [{ x: Math.round(x), y: Math.round(y) }],\n modifiers: 0,\n });\n await new Promise((res) => setTimeout(res, delay));\n }\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n } else {\n await this.mouse.move(from.x, from.y);\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x: from.x,\n y: from.y,\n button: 'left',\n clickCount: 1,\n });\n\n for (let i = 1; i <= steps; i++) {\n const x = from.x + (to.x - from.x) * (i / steps);\n const y = from.y + (to.y - from.y) * (i / steps);\n await this.mouse.move(x, y);\n await new Promise((res) => setTimeout(res, delay));\n }\n\n await this.sendCommandToDebugger('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x: to.x,\n y: to.y,\n button: 'left',\n clickCount: 1,\n });\n }\n\n this.latestMouseX = to.x;\n this.latestMouseY = to.y;\n }\n\n async pinch(\n centerX: number,\n centerY: number,\n startDistance: number,\n endDistance: number,\n duration = 500,\n ): Promise<void> {\n const steps = 30;\n const delay = duration / steps;\n\n const halfStart = startDistance / 2;\n const halfEnd = endDistance / 2;\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints: [\n {\n x: Math.round(centerX),\n y: Math.round(centerY - halfStart),\n id: 0,\n },\n {\n x: Math.round(centerX),\n y: Math.round(centerY + halfStart),\n id: 1,\n },\n ],\n modifiers: 0,\n });\n\n for (let i = 1; i <= steps; i++) {\n const progress = i / steps;\n const currentHalf = halfStart + (halfEnd - halfStart) * progress;\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchMove',\n touchPoints: [\n {\n x: Math.round(centerX),\n y: Math.round(centerY - currentHalf),\n id: 0,\n },\n {\n x: Math.round(centerX),\n y: Math.round(centerY + currentHalf),\n id: 1,\n },\n ],\n modifiers: 0,\n });\n await new Promise((res) => setTimeout(res, delay));\n }\n\n await this.sendCommandToDebugger('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [],\n modifiers: 0,\n });\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","sleep","ms","Promise","resolve","setTimeout","NAVIGATION_COMPLETE_TIMEOUT_MS","isBlankUrl","url","waitForTabNavigationComplete","tabId","targetUrl","updatedTab","timeoutMs","settled","finish","chrome","onUpdated","clearTimeout","timer","isTargetTab","tab","isReady","navigationUpdateObserved","currentUrl","isExpectedUrlKind","id","info","hasFlatNodeAttribute","attributes","name","i","serializeError","error","ChromeExtensionProxyPage","commonWebActionsForWebPage","options","Error","tabs","assert","console","errorMsg","err","x","y","pointerScript","tabIdToDetach","limitOpenNewTabScript","script","injectWaterFlowAnimation","injectStopWaterFlowAnimation","enabled","command","params","retryCount","MAX_RETRIES","result","isDetachError","getHtmlElementScript","expression","tree","window","document","returnValue","errorDescription","handler","registrationVersion","undefined","capturedError","pendingFileChooserHandling","fileChooserEventHandler","source","method","event","currentFileChooserHandling","files","node","hasWebkitDirectory","String","previousFileChooserHandling","dispose","getError","chooser","timeout","startTime","Date","lastReadyState","attachError","treeToList","point","isOrderSensitive","xpath","JSON","center","judgeOrderSensitive","xpaths","sanitizeXpaths","feature","elementInfo","buildRectFromElementInfo","content","sizeInfo","format","base64","createImgBase64ByFormat","startingPoint","distance","height","scrollDistance","width","element","selectionResult","selectAllInputScript","duration","MIN_LONG_PRESS_DURATION","touchPoints","Math","res","from","to","LONG_PRESS_THRESHOLD","MIN_PRESS_THRESHOLD","steps","delay","centerX","centerY","startDistance","endDistance","halfStart","halfEnd","progress","currentHalf","forceSameTabNavigation","inputOptions","button","count","clickCount","deltaX","deltaY","startX","startY","finalX","finalY","text","cdpKeyboard","CdpKeyboard","action","keys","Array","k","commands"],"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,MAAlB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0CA,MAAMI,QAAQC,AAAAA,IAAAA,uBAAAA,QAAAA,AAAAA,EAAS;AAEvB,SAASC,MAAMC,EAAU;IACvB,OAAO,IAAIC,QAAQ,CAACC,UAAYC,WAAWD,SAASF;AACtD;AAEA,MAAMI,iCAAiC;AAEvC,SAASC,WAAWC,GAAuB;IACzC,IAAI,CAACA,KAAK,OAAO;IACjB,OAAOA,AAAQ,kBAARA,OAAyBA,IAAI,UAAU,CAAC;AACjD;AASA,SAASC,6BACPC,KAAa,EACbC,SAAiB,EACjBC,UAA4B,EAC5BC,YAAYP,8BAA8B;IAE1C,OAAO,IAAIH,QAAQ,CAACC;QAClB,IAAIU,UAAU;QACd,MAAMC,SAAS;YACb,IAAID,SAAS;YACbA,UAAU;YACVE,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAACC;YACrCC,aAAaC;YACbf;QACF;QAEA,MAAMgB,cA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
CHANGED
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-options.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/cli-options.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 { CLIError } from '@midscene/shared/cli';\nimport {\n type ViewportSize,\n defaultPuppeteerWindowViewportSize,\n resolveViewportSize,\n} from './common/viewport';\n\nconst viewportWidthFlag = '--viewport-width';\nconst viewportHeightFlag = '--viewport-height';\n\nexport interface ParsedWebCliOptions {\n argv: string[];\n mode: 'bridge' | 'cdp' | 'puppeteer';\n cdpEndpoint?: string;\n viewport?: ViewportSize;\n}\n\nfunction isLikelyCdpEndpoint(value: string | undefined): boolean {\n return !!value && /^(wss?):\\/\\//.test(value);\n}\n\nfunction parsePositiveIntegerOption(flag: string, rawValue: string): number {\n const value = Number(rawValue);\n if (!Number.isInteger(value) || value <= 0) {\n throw new CLIError(\n `Invalid value for \"${flag}\": expected a positive integer, got \"${rawValue}\".`,\n );\n }\n\n return value;\n}\n\nfunction readRequiredOptionValue(\n args: string[],\n index: number,\n flag: string,\n): { value: string; nextIndex: number } {\n const currentArg = args[index];\n const inlinePrefix = `${flag}=`;\n if (currentArg.startsWith(inlinePrefix)) {\n return {\n value: currentArg.slice(inlinePrefix.length),\n nextIndex: index,\n };\n }\n\n const nextArg = args[index + 1];\n if (!nextArg || nextArg.startsWith('--')) {\n throw new CLIError(`Option \"${flag}\" requires a value.`);\n }\n\n return {\n value: nextArg,\n nextIndex: index + 1,\n };\n}\n\nfunction readOptionalCdpEndpoint(\n args: string[],\n index: number,\n): { value?: string; nextIndex: number } {\n const currentArg = args[index];\n const inlinePrefix = '--cdp=';\n if (currentArg.startsWith(inlinePrefix)) {\n return {\n value: currentArg.slice(inlinePrefix.length),\n nextIndex: index,\n };\n }\n\n const nextArg = args[index + 1];\n if (!isLikelyCdpEndpoint(nextArg)) {\n return { nextIndex: index };\n }\n\n return {\n value: nextArg,\n nextIndex: index + 1,\n };\n}\n\nexport function parseWebCliOptions(\n rawArgs: string[],\n env: NodeJS.ProcessEnv = process.env,\n): ParsedWebCliOptions {\n const argv: string[] = [];\n let isBridge = false;\n let isCdp = false;\n let viewportWidth: number | undefined;\n let viewportHeight: number | undefined;\n let cdpEndpoint: string | undefined;\n\n for (let index = 0; index < rawArgs.length; index += 1) {\n const arg = rawArgs[index];\n\n if (arg === '--bridge') {\n isBridge = true;\n continue;\n }\n\n if (arg === '--cdp' || arg.startsWith('--cdp=')) {\n isCdp = true;\n const parsed = readOptionalCdpEndpoint(rawArgs, index);\n cdpEndpoint = parsed.value ?? cdpEndpoint;\n index = parsed.nextIndex;\n continue;\n }\n\n if (arg === viewportWidthFlag || arg.startsWith(`${viewportWidthFlag}=`)) {\n const parsed = readRequiredOptionValue(rawArgs, index, viewportWidthFlag);\n viewportWidth = parsePositiveIntegerOption(\n viewportWidthFlag,\n parsed.value,\n );\n index = parsed.nextIndex;\n continue;\n }\n\n if (\n arg === viewportHeightFlag ||\n arg.startsWith(`${viewportHeightFlag}=`)\n ) {\n const parsed = readRequiredOptionValue(\n rawArgs,\n index,\n viewportHeightFlag,\n );\n viewportHeight = parsePositiveIntegerOption(\n viewportHeightFlag,\n parsed.value,\n );\n index = parsed.nextIndex;\n continue;\n }\n\n argv.push(arg);\n }\n\n if (isBridge && isCdp) {\n throw new CLIError(\n '--bridge and --cdp are mutually exclusive. Please specify only one.',\n );\n }\n\n const mode = isBridge ? 'bridge' : isCdp ? 'cdp' : 'puppeteer';\n\n if (mode !== 'puppeteer') {\n if (viewportWidth !== undefined || viewportHeight !== undefined) {\n throw new CLIError(\n 'Viewport options are only supported in the default Puppeteer mode.',\n );\n }\n }\n\n if (mode === 'cdp') {\n cdpEndpoint = cdpEndpoint ?? env.MIDSCENE_CDP_ENDPOINT;\n if (!cdpEndpoint) {\n throw new CLIError(\n 'CDP endpoint is required. Provide it as: --cdp <ws-endpoint> or set MIDSCENE_CDP_ENDPOINT environment variable.',\n );\n }\n }\n\n const hasViewportOverride =\n viewportWidth !== undefined || viewportHeight !== undefined;\n\n return {\n argv,\n mode,\n cdpEndpoint,\n viewport: hasViewportOverride\n ? resolveViewportSize(\n {\n width: viewportWidth,\n height: viewportHeight,\n },\n defaultPuppeteerWindowViewportSize,\n )\n : undefined,\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","viewportWidthFlag","viewportHeightFlag","isLikelyCdpEndpoint","value","parsePositiveIntegerOption","flag","rawValue","Number","CLIError","readRequiredOptionValue","args","index","currentArg","inlinePrefix","nextArg","readOptionalCdpEndpoint","parseWebCliOptions","rawArgs","env","process","argv","isBridge","isCdp","viewportWidth","viewportHeight","cdpEndpoint","arg","parsed","mode","undefined","hasViewportOverride","resolveViewportSize","defaultPuppeteerWindowViewportSize"],"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,
|
|
1
|
+
{"version":3,"file":"cli-options.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/cli-options.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 { CLIError } from '@midscene/shared/cli';\nimport {\n type ViewportSize,\n defaultPuppeteerWindowViewportSize,\n resolveViewportSize,\n} from './common/viewport';\n\nconst viewportWidthFlag = '--viewport-width';\nconst viewportHeightFlag = '--viewport-height';\n\nexport interface ParsedWebCliOptions {\n argv: string[];\n mode: 'bridge' | 'cdp' | 'puppeteer';\n cdpEndpoint?: string;\n viewport?: ViewportSize;\n}\n\nfunction isLikelyCdpEndpoint(value: string | undefined): boolean {\n return !!value && /^(wss?):\\/\\//.test(value);\n}\n\nfunction parsePositiveIntegerOption(flag: string, rawValue: string): number {\n const value = Number(rawValue);\n if (!Number.isInteger(value) || value <= 0) {\n throw new CLIError(\n `Invalid value for \"${flag}\": expected a positive integer, got \"${rawValue}\".`,\n );\n }\n\n return value;\n}\n\nfunction readRequiredOptionValue(\n args: string[],\n index: number,\n flag: string,\n): { value: string; nextIndex: number } {\n const currentArg = args[index];\n const inlinePrefix = `${flag}=`;\n if (currentArg.startsWith(inlinePrefix)) {\n return {\n value: currentArg.slice(inlinePrefix.length),\n nextIndex: index,\n };\n }\n\n const nextArg = args[index + 1];\n if (!nextArg || nextArg.startsWith('--')) {\n throw new CLIError(`Option \"${flag}\" requires a value.`);\n }\n\n return {\n value: nextArg,\n nextIndex: index + 1,\n };\n}\n\nfunction readOptionalCdpEndpoint(\n args: string[],\n index: number,\n): { value?: string; nextIndex: number } {\n const currentArg = args[index];\n const inlinePrefix = '--cdp=';\n if (currentArg.startsWith(inlinePrefix)) {\n return {\n value: currentArg.slice(inlinePrefix.length),\n nextIndex: index,\n };\n }\n\n const nextArg = args[index + 1];\n if (!isLikelyCdpEndpoint(nextArg)) {\n return { nextIndex: index };\n }\n\n return {\n value: nextArg,\n nextIndex: index + 1,\n };\n}\n\nexport function parseWebCliOptions(\n rawArgs: string[],\n env: NodeJS.ProcessEnv = process.env,\n): ParsedWebCliOptions {\n const argv: string[] = [];\n let isBridge = false;\n let isCdp = false;\n let viewportWidth: number | undefined;\n let viewportHeight: number | undefined;\n let cdpEndpoint: string | undefined;\n\n for (let index = 0; index < rawArgs.length; index += 1) {\n const arg = rawArgs[index];\n\n if (arg === '--bridge') {\n isBridge = true;\n continue;\n }\n\n if (arg === '--cdp' || arg.startsWith('--cdp=')) {\n isCdp = true;\n const parsed = readOptionalCdpEndpoint(rawArgs, index);\n cdpEndpoint = parsed.value ?? cdpEndpoint;\n index = parsed.nextIndex;\n continue;\n }\n\n if (arg === viewportWidthFlag || arg.startsWith(`${viewportWidthFlag}=`)) {\n const parsed = readRequiredOptionValue(rawArgs, index, viewportWidthFlag);\n viewportWidth = parsePositiveIntegerOption(\n viewportWidthFlag,\n parsed.value,\n );\n index = parsed.nextIndex;\n continue;\n }\n\n if (\n arg === viewportHeightFlag ||\n arg.startsWith(`${viewportHeightFlag}=`)\n ) {\n const parsed = readRequiredOptionValue(\n rawArgs,\n index,\n viewportHeightFlag,\n );\n viewportHeight = parsePositiveIntegerOption(\n viewportHeightFlag,\n parsed.value,\n );\n index = parsed.nextIndex;\n continue;\n }\n\n argv.push(arg);\n }\n\n if (isBridge && isCdp) {\n throw new CLIError(\n '--bridge and --cdp are mutually exclusive. Please specify only one.',\n );\n }\n\n const mode = isBridge ? 'bridge' : isCdp ? 'cdp' : 'puppeteer';\n\n if (mode !== 'puppeteer') {\n if (viewportWidth !== undefined || viewportHeight !== undefined) {\n throw new CLIError(\n 'Viewport options are only supported in the default Puppeteer mode.',\n );\n }\n }\n\n if (mode === 'cdp') {\n cdpEndpoint = cdpEndpoint ?? env.MIDSCENE_CDP_ENDPOINT;\n if (!cdpEndpoint) {\n throw new CLIError(\n 'CDP endpoint is required. Provide it as: --cdp <ws-endpoint> or set MIDSCENE_CDP_ENDPOINT environment variable.',\n );\n }\n }\n\n const hasViewportOverride =\n viewportWidth !== undefined || viewportHeight !== undefined;\n\n return {\n argv,\n mode,\n cdpEndpoint,\n viewport: hasViewportOverride\n ? resolveViewportSize(\n {\n width: viewportWidth,\n height: viewportHeight,\n },\n defaultPuppeteerWindowViewportSize,\n )\n : undefined,\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","viewportWidthFlag","viewportHeightFlag","isLikelyCdpEndpoint","value","parsePositiveIntegerOption","flag","rawValue","Number","CLIError","readRequiredOptionValue","args","index","currentArg","inlinePrefix","nextArg","readOptionalCdpEndpoint","parseWebCliOptions","rawArgs","env","process","argv","isBridge","isCdp","viewportWidth","viewportHeight","cdpEndpoint","arg","parsed","mode","undefined","hasViewportOverride","resolveViewportSize","defaultPuppeteerWindowViewportSize"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBA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YACA,MAAM0B,SAASlB,wBACbQ,SACAN,OACAV;YAEFuB,iBAAiBpB,2BACfH,oBACA0B,OAAO,KAAK;YAEdhB,QAAQgB,OAAO,SAAS;YACxB;QACF;QAEAP,KAAK,IAAI,CAACM;IACZ;IAEA,IAAIL,YAAYC,OACd,MAAM,IAAId,oBAAAA,QAAQA,CAChB;IAIJ,MAAMoB,OAAOP,WAAW,WAAWC,QAAQ,QAAQ;IAEnD,IAAIM,AAAS,gBAATA,MACF;QAAA,IAAIL,AAAkBM,WAAlBN,iBAA+BC,AAAmBK,WAAnBL,gBACjC,MAAM,IAAIhB,oBAAAA,QAAQA,CAChB;IAEJ;IAGF,IAAIoB,AAAS,UAATA,MAAgB;QAClBH,cAAcA,eAAeP,IAAI,qBAAqB;QACtD,IAAI,CAACO,aACH,MAAM,IAAIjB,oBAAAA,QAAQA,CAChB;IAGN;IAEA,MAAMsB,sBACJP,AAAkBM,WAAlBN,iBAA+BC,AAAmBK,WAAnBL;IAEjC,OAAO;QACLJ;QACAQ;QACAH;QACA,UAAUK,sBACNC,AAAAA,IAAAA,4BAAAA,mBAAAA,AAAAA,EACE;YACE,OAAOR;YACP,QAAQC;QACV,GACAQ,4BAAAA,kCAAkCA,IAEpCH;IACN;AACF"}
|
package/dist/lib/cli.js
CHANGED
|
@@ -42,7 +42,7 @@ Promise.resolve().then(()=>{
|
|
|
42
42
|
return (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-web', {
|
|
43
43
|
stripPrefix: 'web_',
|
|
44
44
|
argv: parsedOptions.argv,
|
|
45
|
-
version: "1.17.8
|
|
45
|
+
version: "1.17.8",
|
|
46
46
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
47
47
|
});
|
|
48
48
|
}).catch((e)=>{
|
|
@@ -22,7 +22,7 @@ var __webpack_require__ = {};
|
|
|
22
22
|
})();
|
|
23
23
|
(()=>{
|
|
24
24
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
26
|
value: 'Module'
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports1, '__esModule', {
|