browxai 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/THIRD_PARTY_NOTICES.md +45 -0
- package/dist/cli/chrome.d.ts +1 -0
- package/dist/cli/chrome.js +130 -0
- package/dist/cli/command-registry.d.ts +15 -0
- package/dist/cli/command-registry.js +35 -0
- package/dist/cli/doctor-plugins.d.ts +18 -0
- package/dist/cli/doctor-plugins.js +338 -0
- package/dist/cli/doctor.d.ts +9 -0
- package/dist/cli/doctor.js +407 -0
- package/dist/cli/init.d.ts +1 -0
- package/dist/cli/init.js +200 -0
- package/dist/cli/register-commands.d.ts +1 -0
- package/dist/cli/register-commands.js +22 -0
- package/dist/cli/serve.d.ts +14 -0
- package/dist/cli/serve.js +151 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +129 -0
- package/dist/engine/adapters/adb.d.ts +72 -0
- package/dist/engine/adapters/adb.js +200 -0
- package/dist/engine/adapters/android-cdp.d.ts +54 -0
- package/dist/engine/adapters/android-cdp.js +110 -0
- package/dist/engine/adapters/android.engine.d.ts +1 -0
- package/dist/engine/adapters/android.engine.js +31 -0
- package/dist/engine/adapters/chromium.engine.d.ts +1 -0
- package/dist/engine/adapters/chromium.engine.js +44 -0
- package/dist/engine/adapters/firefox.engine.d.ts +1 -0
- package/dist/engine/adapters/firefox.engine.js +43 -0
- package/dist/engine/adapters/playwright-chromium.d.ts +43 -0
- package/dist/engine/adapters/playwright-chromium.js +56 -0
- package/dist/engine/adapters/playwright-firefox.d.ts +52 -0
- package/dist/engine/adapters/playwright-firefox.js +97 -0
- package/dist/engine/adapters/playwright-webkit.d.ts +40 -0
- package/dist/engine/adapters/playwright-webkit.js +79 -0
- package/dist/engine/adapters/safari/bidi-client.d.ts +46 -0
- package/dist/engine/adapters/safari/bidi-client.js +130 -0
- package/dist/engine/adapters/safari/launch.d.ts +56 -0
- package/dist/engine/adapters/safari/launch.js +104 -0
- package/dist/engine/adapters/safari/webdriver-client.d.ts +102 -0
- package/dist/engine/adapters/safari/webdriver-client.js +175 -0
- package/dist/engine/adapters/safari.engine.d.ts +1 -0
- package/dist/engine/adapters/safari.engine.js +52 -0
- package/dist/engine/adapters/safaridriver-hybrid.d.ts +56 -0
- package/dist/engine/adapters/safaridriver-hybrid.js +127 -0
- package/dist/engine/adapters/webkit.engine.d.ts +1 -0
- package/dist/engine/adapters/webkit.engine.js +47 -0
- package/dist/engine/capabilities.d.ts +53 -0
- package/dist/engine/capabilities.js +122 -0
- package/dist/engine/capability-registry.d.ts +9 -0
- package/dist/engine/capability-registry.js +20 -0
- package/dist/engine/index.d.ts +18 -0
- package/dist/engine/index.js +14 -0
- package/dist/engine/register-engines.d.ts +5 -0
- package/dist/engine/register-engines.js +16 -0
- package/dist/engine/registry.d.ts +145 -0
- package/dist/engine/registry.js +67 -0
- package/dist/engine/select.d.ts +48 -0
- package/dist/engine/select.js +128 -0
- package/dist/engine/session-cdp.d.ts +13 -0
- package/dist/engine/session-cdp.js +22 -0
- package/dist/engine/tool-gate.d.ts +19 -0
- package/dist/engine/tool-gate.js +226 -0
- package/dist/engine/types.d.ts +71 -0
- package/dist/engine/types.js +16 -0
- package/dist/helper/bridge.d.ts +48 -0
- package/dist/helper/bridge.js +200 -0
- package/dist/helper/browx-page.d.ts +1 -0
- package/dist/helper/browx-page.js +47 -0
- package/dist/helper/overlay-hide.d.ts +9 -0
- package/dist/helper/overlay-hide.js +49 -0
- package/dist/helper/stealth.d.ts +10 -0
- package/dist/helper/stealth.js +88 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +15 -0
- package/dist/page/a11y.d.ts +81 -0
- package/dist/page/a11y.js +219 -0
- package/dist/page/action-substrate.d.ts +64 -0
- package/dist/page/action-substrate.js +118 -0
- package/dist/page/actionresult-blocks.d.ts +99 -0
- package/dist/page/actionresult-blocks.js +144 -0
- package/dist/page/actionresult-shape.d.ts +48 -0
- package/dist/page/actionresult-shape.js +155 -0
- package/dist/page/actionresult-types.d.ts +368 -0
- package/dist/page/actionresult-types.js +4 -0
- package/dist/page/actionresult.d.ts +4 -0
- package/dist/page/actionresult.js +299 -0
- package/dist/page/actions-probe.d.ts +32 -0
- package/dist/page/actions-probe.js +294 -0
- package/dist/page/actions-scroll.d.ts +40 -0
- package/dist/page/actions-scroll.js +53 -0
- package/dist/page/actions.d.ts +132 -0
- package/dist/page/actions.js +453 -0
- package/dist/page/archive-assets.d.ts +39 -0
- package/dist/page/archive-assets.js +187 -0
- package/dist/page/archive.d.ts +47 -0
- package/dist/page/archive.js +349 -0
- package/dist/page/asset-export.d.ts +122 -0
- package/dist/page/asset-export.js +376 -0
- package/dist/page/await_network.d.ts +16 -0
- package/dist/page/await_network.js +23 -0
- package/dist/page/bbox.d.ts +37 -0
- package/dist/page/bbox.js +115 -0
- package/dist/page/canvas-capture.d.ts +82 -0
- package/dist/page/canvas-capture.js +257 -0
- package/dist/page/canvas-diff.d.ts +51 -0
- package/dist/page/canvas-diff.js +131 -0
- package/dist/page/canvas-gesture.d.ts +53 -0
- package/dist/page/canvas-gesture.js +167 -0
- package/dist/page/canvas-transform.d.ts +96 -0
- package/dist/page/canvas-transform.js +150 -0
- package/dist/page/canvas.d.ts +8 -0
- package/dist/page/canvas.js +50 -0
- package/dist/page/capture-substrate.d.ts +111 -0
- package/dist/page/capture-substrate.js +139 -0
- package/dist/page/clipboard.d.ts +25 -0
- package/dist/page/clipboard.js +50 -0
- package/dist/page/clock.d.ts +36 -0
- package/dist/page/clock.js +167 -0
- package/dist/page/compose.d.ts +55 -0
- package/dist/page/compose.js +169 -0
- package/dist/page/console.d.ts +39 -0
- package/dist/page/console.js +73 -0
- package/dist/page/coverage.d.ts +97 -0
- package/dist/page/coverage.js +280 -0
- package/dist/page/dom-export.d.ts +41 -0
- package/dist/page/dom-export.js +193 -0
- package/dist/page/dom-walk.d.ts +91 -0
- package/dist/page/dom-walk.js +267 -0
- package/dist/page/dom_diff.d.ts +48 -0
- package/dist/page/dom_diff.js +121 -0
- package/dist/page/downloads.d.ts +80 -0
- package/dist/page/downloads.js +244 -0
- package/dist/page/drop-files.d.ts +78 -0
- package/dist/page/drop-files.js +310 -0
- package/dist/page/element-export-discovery.d.ts +64 -0
- package/dist/page/element-export-discovery.js +346 -0
- package/dist/page/element-export.d.ts +46 -0
- package/dist/page/element-export.js +251 -0
- package/dist/page/emulation-substrate.d.ts +53 -0
- package/dist/page/emulation-substrate.js +87 -0
- package/dist/page/emulation.d.ts +60 -0
- package/dist/page/emulation.js +162 -0
- package/dist/page/export-playwright-script.d.ts +47 -0
- package/dist/page/export-playwright-script.js +304 -0
- package/dist/page/extract-resolve.d.ts +22 -0
- package/dist/page/extract-resolve.js +341 -0
- package/dist/page/extract-schema.d.ts +20 -0
- package/dist/page/extract-schema.js +200 -0
- package/dist/page/extract-types.d.ts +127 -0
- package/dist/page/extract-types.js +8 -0
- package/dist/page/extract-warnings.d.ts +8 -0
- package/dist/page/extract-warnings.js +56 -0
- package/dist/page/extract.d.ts +9 -0
- package/dist/page/extract.js +174 -0
- package/dist/page/fill-form.d.ts +58 -0
- package/dist/page/fill-form.js +261 -0
- package/dist/page/find.d.ts +158 -0
- package/dist/page/find.js +470 -0
- package/dist/page/frames.d.ts +45 -0
- package/dist/page/frames.js +133 -0
- package/dist/page/generate-locator.d.ts +57 -0
- package/dist/page/generate-locator.js +136 -0
- package/dist/page/gestures.d.ts +128 -0
- package/dist/page/gestures.js +198 -0
- package/dist/page/har.d.ts +91 -0
- package/dist/page/har.js +174 -0
- package/dist/page/heap.d.ts +97 -0
- package/dist/page/heap.js +285 -0
- package/dist/page/inspect.d.ts +34 -0
- package/dist/page/inspect.js +75 -0
- package/dist/page/layout-thrash.d.ts +34 -0
- package/dist/page/layout-thrash.js +232 -0
- package/dist/page/learning.d.ts +21 -0
- package/dist/page/learning.js +84 -0
- package/dist/page/locator.d.ts +54 -0
- package/dist/page/locator.js +142 -0
- package/dist/page/memory-diff.d.ts +48 -0
- package/dist/page/memory-diff.js +105 -0
- package/dist/page/network-mask.d.ts +8 -0
- package/dist/page/network-mask.js +18 -0
- package/dist/page/network-playwright.d.ts +96 -0
- package/dist/page/network-playwright.js +353 -0
- package/dist/page/network-substrate-select.d.ts +18 -0
- package/dist/page/network-substrate-select.js +32 -0
- package/dist/page/network-substrate.d.ts +109 -0
- package/dist/page/network-substrate.js +161 -0
- package/dist/page/network-ws.d.ts +46 -0
- package/dist/page/network-ws.js +113 -0
- package/dist/page/network.d.ts +194 -0
- package/dist/page/network.js +415 -0
- package/dist/page/overflow-detect.d.ts +102 -0
- package/dist/page/overflow-detect.js +449 -0
- package/dist/page/pdf.d.ts +69 -0
- package/dist/page/pdf.js +109 -0
- package/dist/page/perf-audit-analysers.d.ts +40 -0
- package/dist/page/perf-audit-analysers.js +369 -0
- package/dist/page/perf-audit-runner.d.ts +20 -0
- package/dist/page/perf-audit-runner.js +195 -0
- package/dist/page/perf-audit-types.d.ts +41 -0
- package/dist/page/perf-audit-types.js +5 -0
- package/dist/page/perf-audit.d.ts +37 -0
- package/dist/page/perf-audit.js +377 -0
- package/dist/page/perf.d.ts +127 -0
- package/dist/page/perf.js +373 -0
- package/dist/page/plan.d.ts +192 -0
- package/dist/page/plan.js +308 -0
- package/dist/page/point_probe.d.ts +46 -0
- package/dist/page/point_probe.js +99 -0
- package/dist/page/recording.d.ts +67 -0
- package/dist/page/recording.js +172 -0
- package/dist/page/refs.d.ts +92 -0
- package/dist/page/refs.js +134 -0
- package/dist/page/regions.d.ts +23 -0
- package/dist/page/regions.js +32 -0
- package/dist/page/routes.d.ts +40 -0
- package/dist/page/routes.js +87 -0
- package/dist/page/safari-actions.d.ts +12 -0
- package/dist/page/safari-actions.js +144 -0
- package/dist/page/sample.d.ts +64 -0
- package/dist/page/sample.js +216 -0
- package/dist/page/screenshot-on.d.ts +51 -0
- package/dist/page/screenshot-on.js +150 -0
- package/dist/page/screenshot-save.d.ts +36 -0
- package/dist/page/screenshot-save.js +53 -0
- package/dist/page/screenshot-schedule.d.ts +50 -0
- package/dist/page/screenshot-schedule.js +155 -0
- package/dist/page/script-substrate.d.ts +32 -0
- package/dist/page/script-substrate.js +47 -0
- package/dist/page/seed-random.d.ts +45 -0
- package/dist/page/seed-random.js +144 -0
- package/dist/page/set-of-marks.d.ts +96 -0
- package/dist/page/set-of-marks.js +245 -0
- package/dist/page/shadow.d.ts +136 -0
- package/dist/page/shadow.js +400 -0
- package/dist/page/shortcut.d.ts +50 -0
- package/dist/page/shortcut.js +147 -0
- package/dist/page/snapshot-substrate-safari.d.ts +30 -0
- package/dist/page/snapshot-substrate-safari.js +84 -0
- package/dist/page/snapshot-substrate-select.d.ts +24 -0
- package/dist/page/snapshot-substrate-select.js +34 -0
- package/dist/page/snapshot-substrate.d.ts +58 -0
- package/dist/page/snapshot-substrate.js +135 -0
- package/dist/page/snapshot.d.ts +24 -0
- package/dist/page/snapshot.js +162 -0
- package/dist/page/solve-captcha.d.ts +76 -0
- package/dist/page/solve-captcha.js +286 -0
- package/dist/page/storage-substrate-types.d.ts +221 -0
- package/dist/page/storage-substrate-types.js +6 -0
- package/dist/page/storage-substrate.d.ts +215 -0
- package/dist/page/storage-substrate.js +280 -0
- package/dist/page/structural.d.ts +9 -0
- package/dist/page/structural.js +152 -0
- package/dist/page/substrate-bundle-safari.d.ts +8 -0
- package/dist/page/substrate-bundle-safari.js +42 -0
- package/dist/page/substrate-bundle.d.ts +6 -0
- package/dist/page/substrate-bundle.js +53 -0
- package/dist/page/text_search.d.ts +44 -0
- package/dist/page/text_search.js +90 -0
- package/dist/page/upload.d.ts +28 -0
- package/dist/page/upload.js +62 -0
- package/dist/page/verify.d.ts +63 -0
- package/dist/page/verify.js +451 -0
- package/dist/page/video.d.ts +115 -0
- package/dist/page/video.js +169 -0
- package/dist/page/visibility.d.ts +22 -0
- package/dist/page/visibility.js +94 -0
- package/dist/page/watch.d.ts +29 -0
- package/dist/page/watch.js +99 -0
- package/dist/page/workers.d.ts +126 -0
- package/dist/page/workers.js +490 -0
- package/dist/page/ws-interactive.d.ts +82 -0
- package/dist/page/ws-interactive.js +318 -0
- package/dist/plugin/cli.d.ts +45 -0
- package/dist/plugin/cli.js +496 -0
- package/dist/plugin/command-registry.d.ts +9 -0
- package/dist/plugin/command-registry.js +23 -0
- package/dist/plugin/depgraph.d.ts +37 -0
- package/dist/plugin/depgraph.js +186 -0
- package/dist/plugin/manifest.d.ts +182 -0
- package/dist/plugin/manifest.js +219 -0
- package/dist/plugin/package-manager.d.ts +22 -0
- package/dist/plugin/package-manager.js +40 -0
- package/dist/plugin/resolver.d.ts +85 -0
- package/dist/plugin/resolver.js +166 -0
- package/dist/plugin/runtime.d.ts +77 -0
- package/dist/plugin/runtime.js +402 -0
- package/dist/plugin/types.d.ts +113 -0
- package/dist/plugin/types.js +4 -0
- package/dist/policy/confirm.d.ts +76 -0
- package/dist/policy/confirm.js +162 -0
- package/dist/policy/origin.d.ts +17 -0
- package/dist/policy/origin.js +79 -0
- package/dist/sdk/client.d.ts +21 -0
- package/dist/sdk/client.js +174 -0
- package/dist/sdk/index.d.ts +32 -0
- package/dist/sdk/index.js +61 -0
- package/dist/sdk/plugin-types.d.ts +33 -0
- package/dist/sdk/plugin-types.js +22 -0
- package/dist/sdk/registry.d.ts +17 -0
- package/dist/sdk/registry.js +94 -0
- package/dist/sdk/socket-transport.d.ts +20 -0
- package/dist/sdk/socket-transport.js +90 -0
- package/dist/sdk/tool-types.d.ts +634 -0
- package/dist/sdk/tool-types.js +28 -0
- package/dist/sdk/transport-in-process.d.ts +21 -0
- package/dist/sdk/transport-in-process.js +44 -0
- package/dist/sdk/transport-registry.d.ts +19 -0
- package/dist/sdk/transport-registry.js +31 -0
- package/dist/sdk/transport-socket.d.ts +12 -0
- package/dist/sdk/transport-socket.js +77 -0
- package/dist/sdk/transport-stdio-child.d.ts +10 -0
- package/dist/sdk/transport-stdio-child.js +47 -0
- package/dist/sdk/transport.d.ts +10 -0
- package/dist/sdk/transport.js +35 -0
- package/dist/sdk/types.d.ts +176 -0
- package/dist/sdk/types.js +10 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +327 -0
- package/dist/session/artifacts.d.ts +52 -0
- package/dist/session/artifacts.js +177 -0
- package/dist/session/byob-attach.d.ts +26 -0
- package/dist/session/byob-attach.js +187 -0
- package/dist/session/byob.d.ts +8 -0
- package/dist/session/byob.js +20 -0
- package/dist/session/cache-storage.d.ts +100 -0
- package/dist/session/cache-storage.js +166 -0
- package/dist/session/device-emu.d.ts +149 -0
- package/dist/session/device-emu.js +545 -0
- package/dist/session/device.d.ts +14 -0
- package/dist/session/device.js +44 -0
- package/dist/session/dialog.d.ts +62 -0
- package/dist/session/dialog.js +164 -0
- package/dist/session/emulation.d.ts +69 -0
- package/dist/session/emulation.js +168 -0
- package/dist/session/extensions.d.ts +113 -0
- package/dist/session/extensions.js +237 -0
- package/dist/session/fs-picker.d.ts +144 -0
- package/dist/session/fs-picker.js +666 -0
- package/dist/session/idb-storage.d.ts +86 -0
- package/dist/session/idb-storage.js +229 -0
- package/dist/session/incognito.d.ts +3 -0
- package/dist/session/incognito.js +20 -0
- package/dist/session/launch-options.d.ts +41 -0
- package/dist/session/launch-options.js +200 -0
- package/dist/session/managed.d.ts +3 -0
- package/dist/session/managed.js +16 -0
- package/dist/session/metrics.d.ts +45 -0
- package/dist/session/metrics.js +75 -0
- package/dist/session/notification.d.ts +122 -0
- package/dist/session/notification.js +426 -0
- package/dist/session/permission.d.ts +144 -0
- package/dist/session/permission.js +600 -0
- package/dist/session/playwright-post-wire.d.ts +8 -0
- package/dist/session/playwright-post-wire.js +148 -0
- package/dist/session/policy-buffer.d.ts +21 -0
- package/dist/session/policy-buffer.js +47 -0
- package/dist/session/profile-snapshot.d.ts +11 -0
- package/dist/session/profile-snapshot.js +53 -0
- package/dist/session/registry.d.ts +365 -0
- package/dist/session/registry.js +98 -0
- package/dist/session/safari-post-wire.d.ts +8 -0
- package/dist/session/safari-post-wire.js +28 -0
- package/dist/session/safari-session.d.ts +10 -0
- package/dist/session/safari-session.js +39 -0
- package/dist/session/storage.d.ts +148 -0
- package/dist/session/storage.js +350 -0
- package/dist/session/types.d.ts +113 -0
- package/dist/session/types.js +5 -0
- package/dist/session/wedge.d.ts +15 -0
- package/dist/session/wedge.js +41 -0
- package/dist/tools/action-core-tools.d.ts +13 -0
- package/dist/tools/action-core-tools.js +156 -0
- package/dist/tools/action-form-tools.d.ts +12 -0
- package/dist/tools/action-form-tools.js +179 -0
- package/dist/tools/action-gesture-tools.d.ts +9 -0
- package/dist/tools/action-gesture-tools.js +115 -0
- package/dist/tools/action-history-tools.d.ts +8 -0
- package/dist/tools/action-history-tools.js +67 -0
- package/dist/tools/action-tool.d.ts +42 -0
- package/dist/tools/action-tool.js +58 -0
- package/dist/tools/action-tools.d.ts +20 -0
- package/dist/tools/action-tools.js +28 -0
- package/dist/tools/batch-act-tools.d.ts +10 -0
- package/dist/tools/batch-act-tools.js +276 -0
- package/dist/tools/batch-human-tools.d.ts +8 -0
- package/dist/tools/batch-human-tools.js +148 -0
- package/dist/tools/canvas-tools.d.ts +40 -0
- package/dist/tools/canvas-tools.js +368 -0
- package/dist/tools/capture-report-diagnostics-tools.d.ts +7 -0
- package/dist/tools/capture-report-diagnostics-tools.js +318 -0
- package/dist/tools/capture-report-element-export-tools.d.ts +8 -0
- package/dist/tools/capture-report-element-export-tools.js +197 -0
- package/dist/tools/capture-report-export-tools.d.ts +8 -0
- package/dist/tools/capture-report-export-tools.js +246 -0
- package/dist/tools/capture-report-marks-tools.d.ts +9 -0
- package/dist/tools/capture-report-marks-tools.js +221 -0
- package/dist/tools/capture-report-upload-tools.d.ts +8 -0
- package/dist/tools/capture-report-upload-tools.js +277 -0
- package/dist/tools/config-approval-tools.d.ts +8 -0
- package/dist/tools/config-approval-tools.js +166 -0
- package/dist/tools/deep-coverage-tools.d.ts +8 -0
- package/dist/tools/deep-coverage-tools.js +325 -0
- package/dist/tools/deep-determinism-tools.d.ts +8 -0
- package/dist/tools/deep-determinism-tools.js +276 -0
- package/dist/tools/deep-perf-tools.d.ts +19 -0
- package/dist/tools/deep-perf-tools.js +324 -0
- package/dist/tools/device-emulation-tools.d.ts +9 -0
- package/dist/tools/device-emulation-tools.js +137 -0
- package/dist/tools/extensions-batch-tools.d.ts +18 -0
- package/dist/tools/extensions-batch-tools.js +24 -0
- package/dist/tools/extensions-rebuild.d.ts +22 -0
- package/dist/tools/extensions-rebuild.js +208 -0
- package/dist/tools/extensions-tools.d.ts +2 -0
- package/dist/tools/extensions-tools.js +331 -0
- package/dist/tools/forms-fill-tools.d.ts +8 -0
- package/dist/tools/forms-fill-tools.js +109 -0
- package/dist/tools/forms-plan-tools.d.ts +7 -0
- package/dist/tools/forms-plan-tools.js +159 -0
- package/dist/tools/forms-recording-mode-tools.d.ts +8 -0
- package/dist/tools/forms-recording-mode-tools.js +71 -0
- package/dist/tools/forms-recording-tools.d.ts +14 -0
- package/dist/tools/forms-recording-tools.js +22 -0
- package/dist/tools/forms-refs-tools.d.ts +8 -0
- package/dist/tools/forms-refs-tools.js +90 -0
- package/dist/tools/gesture-coord-tools.d.ts +8 -0
- package/dist/tools/gesture-coord-tools.js +168 -0
- package/dist/tools/gesture-emulation-tools.d.ts +8 -0
- package/dist/tools/gesture-emulation-tools.js +135 -0
- package/dist/tools/gesture-network-tools.d.ts +17 -0
- package/dist/tools/gesture-network-tools.js +27 -0
- package/dist/tools/gesture-route-tools.d.ts +8 -0
- package/dist/tools/gesture-route-tools.js +142 -0
- package/dist/tools/gesture-websocket-tools.d.ts +8 -0
- package/dist/tools/gesture-websocket-tools.js +122 -0
- package/dist/tools/gesture-worker-tools.d.ts +9 -0
- package/dist/tools/gesture-worker-tools.js +200 -0
- package/dist/tools/host-build.d.ts +76 -0
- package/dist/tools/host-build.js +516 -0
- package/dist/tools/host.d.ts +287 -0
- package/dist/tools/host.js +1 -0
- package/dist/tools/input-tools.d.ts +10 -0
- package/dist/tools/input-tools.js +176 -0
- package/dist/tools/live-emulation-tools.d.ts +9 -0
- package/dist/tools/live-emulation-tools.js +353 -0
- package/dist/tools/plugin-runtime.d.ts +36 -0
- package/dist/tools/plugin-runtime.js +274 -0
- package/dist/tools/read-observe-buffer-tools.d.ts +9 -0
- package/dist/tools/read-observe-buffer-tools.js +385 -0
- package/dist/tools/read-observe-capture-tools.d.ts +12 -0
- package/dist/tools/read-observe-capture-tools.js +376 -0
- package/dist/tools/read-observe-dom-tools.d.ts +8 -0
- package/dist/tools/read-observe-dom-tools.js +308 -0
- package/dist/tools/read-observe-extract-tools.d.ts +8 -0
- package/dist/tools/read-observe-extract-tools.js +232 -0
- package/dist/tools/read-observe-verify-tools.d.ts +8 -0
- package/dist/tools/read-observe-verify-tools.js +316 -0
- package/dist/tools/schemas.d.ts +29 -0
- package/dist/tools/schemas.js +58 -0
- package/dist/tools/secrets-captcha-tools.d.ts +9 -0
- package/dist/tools/secrets-captcha-tools.js +231 -0
- package/dist/tools/session-dialog-permission-tools.d.ts +9 -0
- package/dist/tools/session-dialog-permission-tools.js +287 -0
- package/dist/tools/session-lifecycle-tools.d.ts +8 -0
- package/dist/tools/session-lifecycle-tools.js +314 -0
- package/dist/tools/session-notification-device-tools.d.ts +9 -0
- package/dist/tools/session-notification-device-tools.js +156 -0
- package/dist/tools/session-policy-tools.d.ts +16 -0
- package/dist/tools/session-policy-tools.js +22 -0
- package/dist/tools/session-registry.d.ts +28 -0
- package/dist/tools/session-registry.js +427 -0
- package/dist/tools/storage-artifact-har-video-tools.d.ts +8 -0
- package/dist/tools/storage-artifact-har-video-tools.js +311 -0
- package/dist/tools/storage-cache-idb-tools.d.ts +8 -0
- package/dist/tools/storage-cache-idb-tools.js +347 -0
- package/dist/tools/storage-state-cookies-tools.d.ts +8 -0
- package/dist/tools/storage-state-cookies-tools.js +223 -0
- package/dist/tools/storage-tools.d.ts +17 -0
- package/dist/tools/storage-tools.js +25 -0
- package/dist/tools/storage-web-auth-tools.d.ts +10 -0
- package/dist/tools/storage-web-auth-tools.js +230 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/dist/tools/tool-metadata.js +185 -0
- package/dist/util/batch.d.ts +83 -0
- package/dist/util/batch.js +191 -0
- package/dist/util/capabilities.d.ts +504 -0
- package/dist/util/capabilities.js +254 -0
- package/dist/util/config-store.d.ts +103 -0
- package/dist/util/config-store.js +206 -0
- package/dist/util/config.d.ts +11 -0
- package/dist/util/config.js +28 -0
- package/dist/util/credentials.d.ts +136 -0
- package/dist/util/credentials.js +622 -0
- package/dist/util/deadline.d.ts +22 -0
- package/dist/util/deadline.js +62 -0
- package/dist/util/diagnostics.d.ts +161 -0
- package/dist/util/diagnostics.js +579 -0
- package/dist/util/egress-sanitiser.d.ts +29 -0
- package/dist/util/egress-sanitiser.js +52 -0
- package/dist/util/failure.d.ts +8 -0
- package/dist/util/failure.js +50 -0
- package/dist/util/flake-check.d.ts +109 -0
- package/dist/util/flake-check.js +342 -0
- package/dist/util/invariant.d.ts +25 -0
- package/dist/util/invariant.js +66 -0
- package/dist/util/logging.d.ts +6 -0
- package/dist/util/logging.js +12 -0
- package/dist/util/predicates.d.ts +62 -0
- package/dist/util/predicates.js +340 -0
- package/dist/util/secrets.d.ts +104 -0
- package/dist/util/secrets.js +219 -0
- package/dist/util/tokens.d.ts +6 -0
- package/dist/util/tokens.js +24 -0
- package/dist/util/url-sanitizer.d.ts +19 -0
- package/dist/util/url-sanitizer.js +70 -0
- package/dist/util/version.d.ts +2 -0
- package/dist/util/version.js +21 -0
- package/dist/util/workspace.d.ts +7 -0
- package/dist/util/workspace.js +22 -0
- package/package.json +120 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Locator, Page } from "playwright-core";
|
|
2
|
+
import type { ElementProbe, HitPoint } from "./actionresult.js";
|
|
3
|
+
import type { ActionTarget } from "./locator.js";
|
|
4
|
+
export interface PreProbeData {
|
|
5
|
+
ownerLabel?: string;
|
|
6
|
+
ownerText?: string;
|
|
7
|
+
container?: {
|
|
8
|
+
kind: string;
|
|
9
|
+
rowKey?: string;
|
|
10
|
+
rowText?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Capture the pre-action state of the owning control and the enclosing repeated
|
|
15
|
+
* container, so the post-action probe can emit `changed` flags without the
|
|
16
|
+
* caller re-snapshotting. Exported for unit tests; runs at the DOM level.
|
|
17
|
+
*/
|
|
18
|
+
export declare function preProbe(loc: Locator): Promise<PreProbeData>;
|
|
19
|
+
/**
|
|
20
|
+
* Always read post-action DOM state so callers can confirm a write landed
|
|
21
|
+
* without a follow-up `snapshot`/`screenshot` round-trip. We deliberately do not
|
|
22
|
+
* echo back `valueRequested` as `value` — the probe reports what the DOM actually
|
|
23
|
+
* holds, not what the caller asked for. Exported for unit tests.
|
|
24
|
+
*/
|
|
25
|
+
export declare function probe(loc: Locator, target: ActionTarget, valueRequested?: string, pre?: PreProbeData): Promise<ElementProbe>;
|
|
26
|
+
/** Coordinate-action evidence helper: read `document.elementFromPoint` at (x,y)
|
|
27
|
+
* with role/text/ancestor context. Returns null when nothing's there. */
|
|
28
|
+
export declare function captureHit(page: Page, x: number, y: number): Promise<HitPoint | null>;
|
|
29
|
+
/** Best-effort identity for the active element so we can report whether focus
|
|
30
|
+
* shifted during a coord action. Returns a stable-ish key (tag + id + role +
|
|
31
|
+
* testid + first text). */
|
|
32
|
+
export declare function captureFocusedRef(page: Page): Promise<string | null>;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// Post-action element probing — `preProbe` / `probe` capture the DOM state of
|
|
2
|
+
// the targeted element (and its owning control / repeated container) before and
|
|
3
|
+
// after an action, plus the coord-action evidence helpers `captureHit` /
|
|
4
|
+
// `captureFocusedRef`. Split out of actions.ts so that file stays under the size
|
|
5
|
+
// budget; behavior-identical to the prior inline form.
|
|
6
|
+
//
|
|
7
|
+
// These functions are stringified and executed in the browser, where TS's DOM
|
|
8
|
+
// lib is intentionally NOT in scope (tsconfig `lib: ["ES2022"]`). Rather than
|
|
9
|
+
// fall back to `any`, the precise structural shape each in-page script touches is
|
|
10
|
+
// described and `unknown` runtime values are narrowed into it via real
|
|
11
|
+
// `typeof`/`in` guards. Behaviour is unchanged — these types are erased.
|
|
12
|
+
// Post-action probe runs MULTIPLE `loc.evaluate()` calls — each defaults to
|
|
13
|
+
// Playwright's 30s timeout. On busy SPAs where re-renders re-attach the element
|
|
14
|
+
// handle constantly, a probe evaluate can hang far longer than makes sense for a
|
|
15
|
+
// read-only check. Bound each evaluate to PROBE_EVAL_MS so a stuck probe returns
|
|
16
|
+
// partial data instead of consuming the whole action deadline.
|
|
17
|
+
const PROBE_EVAL_MS = 1500;
|
|
18
|
+
/** In-page: post-action checkbox/radio checked state (or "mixed"). */
|
|
19
|
+
const checkedScript = (el) => {
|
|
20
|
+
const tag = el.tagName?.toLowerCase();
|
|
21
|
+
const type = el.type?.toLowerCase();
|
|
22
|
+
if (tag !== "input" || (type !== "checkbox" && type !== "radio"))
|
|
23
|
+
return undefined;
|
|
24
|
+
if (el.indeterminate)
|
|
25
|
+
return "mixed";
|
|
26
|
+
return el.checked === true;
|
|
27
|
+
};
|
|
28
|
+
/** In-page: visible-wrapper text for controls that render state outside
|
|
29
|
+
* `input.value` (chip selects, combobox displays, badge pickers). Walks up to 4
|
|
30
|
+
* ancestors for a labelled node (role attr or `data-testid|test|cy|qa`); falls
|
|
31
|
+
* back to the immediate parent's innerText. Capped at 200 chars. */
|
|
32
|
+
const displayTextScript = (el) => {
|
|
33
|
+
const DOC_BODY_TAG = "BODY";
|
|
34
|
+
const isElement = (n) => !!n && typeof n === "object";
|
|
35
|
+
const isLabelled = (e) => {
|
|
36
|
+
const role = e.getAttribute?.("role") || null;
|
|
37
|
+
const ds = e.dataset || {};
|
|
38
|
+
return !!(role || ds.testid || ds.test || ds.cy || ds.qa);
|
|
39
|
+
};
|
|
40
|
+
const cappedText = (e) => {
|
|
41
|
+
const t = (e.innerText || "").trim();
|
|
42
|
+
return t ? t.slice(0, 200) : null;
|
|
43
|
+
};
|
|
44
|
+
let cur = isElement(el) ? el : null;
|
|
45
|
+
for (let i = 0; i < 4 && cur; i++) {
|
|
46
|
+
const next = cur.parentElement;
|
|
47
|
+
if (!isElement(next) || next.tagName === DOC_BODY_TAG)
|
|
48
|
+
break;
|
|
49
|
+
cur = next;
|
|
50
|
+
if (isLabelled(cur))
|
|
51
|
+
return cappedText(cur);
|
|
52
|
+
}
|
|
53
|
+
if (isElement(el) && isElement(el.parentElement))
|
|
54
|
+
return cappedText(el.parentElement);
|
|
55
|
+
return null;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Capture the pre-action state of the owning control and the enclosing repeated
|
|
59
|
+
* container, so the post-action probe can emit `changed` flags without the
|
|
60
|
+
* caller re-snapshotting. Exported for unit tests; runs at the DOM level.
|
|
61
|
+
*/
|
|
62
|
+
export async function preProbe(loc) {
|
|
63
|
+
// Same 1.5s bound as `probe` — see PROBE_EVAL_MS rationale.
|
|
64
|
+
try {
|
|
65
|
+
const count = await loc.count();
|
|
66
|
+
if (count === 0)
|
|
67
|
+
return {};
|
|
68
|
+
return await loc.evaluate(probeAncestorsScript, undefined, { timeout: 1500 }).catch(() => ({}));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Read the post-action value (input.value / contenteditable text / null). */
|
|
75
|
+
async function readProbeValue(loc) {
|
|
76
|
+
const inputValue = await loc.inputValue({ timeout: PROBE_EVAL_MS }).catch(() => undefined);
|
|
77
|
+
if (inputValue !== undefined)
|
|
78
|
+
return inputValue;
|
|
79
|
+
return loc
|
|
80
|
+
.evaluate((el) => el.isContentEditable ? (el.textContent ?? "") : null, undefined, { timeout: PROBE_EVAL_MS })
|
|
81
|
+
.catch(() => null);
|
|
82
|
+
}
|
|
83
|
+
/** Fold the post-action owner/container ancestor state into the probe, composing
|
|
84
|
+
* `changed` deltas against the pre-action snapshot when one was supplied. */
|
|
85
|
+
function applyAncestorState(out, pre, post) {
|
|
86
|
+
if (pre && (pre.ownerText !== undefined || post.ownerText !== undefined)) {
|
|
87
|
+
const before = pre.ownerText;
|
|
88
|
+
const after = post.ownerText;
|
|
89
|
+
const oc = { changed: before !== after };
|
|
90
|
+
if (post.ownerLabel ?? pre.ownerLabel)
|
|
91
|
+
oc.label = post.ownerLabel ?? pre.ownerLabel;
|
|
92
|
+
if (before !== undefined)
|
|
93
|
+
oc.displayTextBefore = before;
|
|
94
|
+
if (after !== undefined)
|
|
95
|
+
oc.displayTextAfter = after;
|
|
96
|
+
out.ownerControl = oc;
|
|
97
|
+
}
|
|
98
|
+
if (post.container) {
|
|
99
|
+
const cont = {
|
|
100
|
+
kind: post.container.kind,
|
|
101
|
+
...(post.container.rowKey ? { rowKey: post.container.rowKey } : {}),
|
|
102
|
+
...(post.container.rowText !== undefined ? { rowText: post.container.rowText } : {}),
|
|
103
|
+
};
|
|
104
|
+
if (pre?.container)
|
|
105
|
+
cont.changed = pre.container.rowText !== post.container.rowText;
|
|
106
|
+
out.container = cont;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Always read post-action DOM state so callers can confirm a write landed
|
|
111
|
+
* without a follow-up `snapshot`/`screenshot` round-trip. We deliberately do not
|
|
112
|
+
* echo back `valueRequested` as `value` — the probe reports what the DOM actually
|
|
113
|
+
* holds, not what the caller asked for. Exported for unit tests.
|
|
114
|
+
*/
|
|
115
|
+
export async function probe(loc, target, valueRequested, pre) {
|
|
116
|
+
const ref = target.ref;
|
|
117
|
+
try {
|
|
118
|
+
const count = await loc.count();
|
|
119
|
+
if (count === 0)
|
|
120
|
+
return { ref, stillAttached: false };
|
|
121
|
+
const focused = await loc
|
|
122
|
+
.evaluate((el) => el === el.ownerDocument?.activeElement, undefined, { timeout: PROBE_EVAL_MS })
|
|
123
|
+
.catch(() => false);
|
|
124
|
+
const value = await readProbeValue(loc);
|
|
125
|
+
const checked = await loc
|
|
126
|
+
.evaluate(checkedScript, undefined, { timeout: PROBE_EVAL_MS })
|
|
127
|
+
.catch(() => undefined);
|
|
128
|
+
const displayText = await loc
|
|
129
|
+
.evaluate(displayTextScript, undefined, { timeout: PROBE_EVAL_MS })
|
|
130
|
+
.catch(() => null);
|
|
131
|
+
const out = { ref, stillAttached: true, focused, value: value ?? null };
|
|
132
|
+
if (checked !== undefined)
|
|
133
|
+
out.checked = checked;
|
|
134
|
+
if (valueRequested !== undefined)
|
|
135
|
+
out.valueRequested = valueRequested;
|
|
136
|
+
if (displayText !== null)
|
|
137
|
+
out.displayText = displayText;
|
|
138
|
+
// post-action owner/container state. Always read; compose deltas against
|
|
139
|
+
// `pre` when supplied. Same in-page script as preProbe, so directly comparable.
|
|
140
|
+
const post = await loc
|
|
141
|
+
.evaluate(probeAncestorsScript, undefined, { timeout: PROBE_EVAL_MS })
|
|
142
|
+
.catch(() => ({}));
|
|
143
|
+
applyAncestorState(out, pre, post);
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return { ref, stillAttached: false };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const OWNER_ROLES = new Set(["combobox", "listbox", "radiogroup", "group", "menu", "tablist"]);
|
|
151
|
+
const ROW_ROLES = new Set(["row", "listitem", "article"]);
|
|
152
|
+
const ROW_TAGS = new Set(["tr", "li"]);
|
|
153
|
+
/**
|
|
154
|
+
* In-page script used by `preProbe` and the post-action half of `probe`. Walks up
|
|
155
|
+
* the target's ancestor chain for the nearest owning form control (combobox /
|
|
156
|
+
* listbox / radiogroup / labelled `data-test*` wrapper) and the nearest repeated
|
|
157
|
+
* container (`role=row`/`listitem`/`article`, or `<tr>`/`<li>`). Capped at 6
|
|
158
|
+
* ancestor steps and 200 chars per text field. Returns {} when nothing matches.
|
|
159
|
+
*
|
|
160
|
+
* Defined as a plain function (not an arrow) so Playwright can stringify it
|
|
161
|
+
* across the CDP boundary cleanly. `el` is typed `unknown` and narrowed to the
|
|
162
|
+
* precise structural `AncestorEl` shape — the leading runtime check makes the
|
|
163
|
+
* narrowing sound. The per-concern matchers are nested so the whole thing stays
|
|
164
|
+
* one self-contained serializable literal.
|
|
165
|
+
*/
|
|
166
|
+
const probeAncestorsScript = function probeAncestors(el) {
|
|
167
|
+
if (!el || typeof el !== "object")
|
|
168
|
+
return {};
|
|
169
|
+
function attr(cur, name) {
|
|
170
|
+
return cur.getAttribute ? cur.getAttribute(name) : null;
|
|
171
|
+
}
|
|
172
|
+
function isFieldOwner(cur, role, ariaLabel) {
|
|
173
|
+
const ds = cur.dataset || {};
|
|
174
|
+
const hasTestAttr = !!(ds.testid || ds.test || ds.cy || ds.qa);
|
|
175
|
+
if (role && OWNER_ROLES.has(role))
|
|
176
|
+
return true;
|
|
177
|
+
return hasTestAttr && !!(role || ariaLabel);
|
|
178
|
+
}
|
|
179
|
+
function matchOwner(cur) {
|
|
180
|
+
const role = attr(cur, "role");
|
|
181
|
+
const ariaLabel = attr(cur, "aria-label");
|
|
182
|
+
if (!isFieldOwner(cur, role, ariaLabel))
|
|
183
|
+
return null;
|
|
184
|
+
const txt = (cur.innerText || "").trim();
|
|
185
|
+
const res = {};
|
|
186
|
+
if (txt)
|
|
187
|
+
res.ownerText = txt.length > 200 ? txt.slice(0, 199) + "…" : txt;
|
|
188
|
+
if (ariaLabel)
|
|
189
|
+
res.ownerLabel = ariaLabel;
|
|
190
|
+
return res;
|
|
191
|
+
}
|
|
192
|
+
function matchContainer(cur) {
|
|
193
|
+
const role = cur.getAttribute ? cur.getAttribute("role") : null;
|
|
194
|
+
const tag = cur.tagName ? cur.tagName.toLowerCase() : "";
|
|
195
|
+
if (!((role && ROW_ROLES.has(role)) || ROW_TAGS.has(tag)))
|
|
196
|
+
return null;
|
|
197
|
+
const kind = role && ROW_ROLES.has(role) ? role : tag;
|
|
198
|
+
const rowText = (cur.innerText || "").trim().replace(/\s+/g, " ");
|
|
199
|
+
const capped = rowText.length > 200 ? rowText.slice(0, 199) + "…" : rowText;
|
|
200
|
+
const firstText = (cur.innerText || "")
|
|
201
|
+
.trim()
|
|
202
|
+
.split("\n")
|
|
203
|
+
.find((s) => s.trim().length > 0);
|
|
204
|
+
const out = { kind };
|
|
205
|
+
if (firstText) {
|
|
206
|
+
const t = firstText.trim();
|
|
207
|
+
out.rowKey = t.length > 80 ? t.slice(0, 79) + "…" : t;
|
|
208
|
+
}
|
|
209
|
+
if (capped)
|
|
210
|
+
out.rowText = capped;
|
|
211
|
+
return out;
|
|
212
|
+
}
|
|
213
|
+
const out = {};
|
|
214
|
+
let cur = el.parentElement;
|
|
215
|
+
for (let i = 0; i < 6 && cur && cur.tagName !== "BODY" && cur.tagName !== "HTML"; i++) {
|
|
216
|
+
if (!out.ownerText) {
|
|
217
|
+
const owner = matchOwner(cur);
|
|
218
|
+
if (owner) {
|
|
219
|
+
if (owner.ownerText)
|
|
220
|
+
out.ownerText = owner.ownerText;
|
|
221
|
+
if (owner.ownerLabel)
|
|
222
|
+
out.ownerLabel = owner.ownerLabel;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (!out.container) {
|
|
226
|
+
const container = matchContainer(cur);
|
|
227
|
+
if (container)
|
|
228
|
+
out.container = container;
|
|
229
|
+
}
|
|
230
|
+
if (out.ownerText && out.container)
|
|
231
|
+
break;
|
|
232
|
+
cur = cur.parentElement;
|
|
233
|
+
}
|
|
234
|
+
return out;
|
|
235
|
+
};
|
|
236
|
+
/** Coordinate-action evidence helper: read `document.elementFromPoint` at (x,y)
|
|
237
|
+
* with role/text/ancestor context. Returns null when nothing's there. */
|
|
238
|
+
export async function captureHit(page, x, y) {
|
|
239
|
+
return page
|
|
240
|
+
.evaluate(({ x, y }) => {
|
|
241
|
+
const g = globalThis;
|
|
242
|
+
const doc = g.document;
|
|
243
|
+
if (!doc)
|
|
244
|
+
return null;
|
|
245
|
+
const el = doc.elementFromPoint(x, y);
|
|
246
|
+
if (!el)
|
|
247
|
+
return null;
|
|
248
|
+
const tag = (el.tagName || "").toLowerCase();
|
|
249
|
+
const role = el.getAttribute
|
|
250
|
+
? el.getAttribute("role") || undefined
|
|
251
|
+
: undefined;
|
|
252
|
+
const text = (el.textContent || "").trim().replace(/\s+/g, " ").slice(0, 120);
|
|
253
|
+
const parent = el.parentElement;
|
|
254
|
+
const ancestorText = parent
|
|
255
|
+
? (parent.innerText || "").trim().replace(/\s+/g, " ").slice(0, 200)
|
|
256
|
+
: undefined;
|
|
257
|
+
const out = { tag };
|
|
258
|
+
if (role)
|
|
259
|
+
out.role = role;
|
|
260
|
+
if (text)
|
|
261
|
+
out.text = text;
|
|
262
|
+
if (ancestorText)
|
|
263
|
+
out.ancestorText = ancestorText;
|
|
264
|
+
return out;
|
|
265
|
+
}, { x, y })
|
|
266
|
+
.catch(() => null);
|
|
267
|
+
}
|
|
268
|
+
/** Best-effort identity for the active element so we can report whether focus
|
|
269
|
+
* shifted during a coord action. Returns a stable-ish key (tag + id + role +
|
|
270
|
+
* testid + first text). */
|
|
271
|
+
export async function captureFocusedRef(page) {
|
|
272
|
+
return page
|
|
273
|
+
.evaluate(() => {
|
|
274
|
+
const g = globalThis;
|
|
275
|
+
const doc = g.document;
|
|
276
|
+
if (!doc)
|
|
277
|
+
return null;
|
|
278
|
+
const a = doc.activeElement;
|
|
279
|
+
if (!a)
|
|
280
|
+
return null;
|
|
281
|
+
const id = a.id || "";
|
|
282
|
+
const role = a.getAttribute ? a.getAttribute("role") || "" : "";
|
|
283
|
+
const testid = a.getAttribute
|
|
284
|
+
? a.getAttribute("data-testid") ||
|
|
285
|
+
a.getAttribute("data-test") ||
|
|
286
|
+
a.getAttribute("data-cy") ||
|
|
287
|
+
""
|
|
288
|
+
: "";
|
|
289
|
+
const tag = (a.tagName || "").toLowerCase();
|
|
290
|
+
const txt = (a.textContent || "").trim().slice(0, 60);
|
|
291
|
+
return `${tag}#${id}@${role}[${testid}]:${txt}`;
|
|
292
|
+
})
|
|
293
|
+
.catch(() => null);
|
|
294
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Locator, Page } from "playwright-core";
|
|
2
|
+
import type { ElementProbe } from "./actionresult.js";
|
|
3
|
+
/** Minimal structural view of an element exposing scroll geometry/mutators. */
|
|
4
|
+
export interface ScrollContainerEl {
|
|
5
|
+
scrollTop: number;
|
|
6
|
+
scrollLeft: number;
|
|
7
|
+
readonly scrollHeight: number;
|
|
8
|
+
readonly scrollWidth: number;
|
|
9
|
+
readonly clientHeight: number;
|
|
10
|
+
readonly clientWidth: number;
|
|
11
|
+
scrollBy: (x: number, y: number) => void;
|
|
12
|
+
}
|
|
13
|
+
/** Minimal structural view of the scrolling element read by the geometry probes. */
|
|
14
|
+
export interface ScrollingEl {
|
|
15
|
+
readonly scrollTop: number;
|
|
16
|
+
readonly scrollLeft: number;
|
|
17
|
+
readonly scrollHeight: number;
|
|
18
|
+
readonly scrollWidth: number;
|
|
19
|
+
readonly clientHeight: number;
|
|
20
|
+
readonly clientWidth: number;
|
|
21
|
+
}
|
|
22
|
+
/** Minimal structural view of `document` as used by the scroll geometry scripts. */
|
|
23
|
+
interface DocumentLike {
|
|
24
|
+
readonly documentElement?: ScrollingEl;
|
|
25
|
+
readonly scrollingElement?: ScrollingEl | null;
|
|
26
|
+
}
|
|
27
|
+
/** Minimal structural view of `window`/`globalThis` as used by the scroll script. */
|
|
28
|
+
export interface WindowLike {
|
|
29
|
+
readonly document?: DocumentLike;
|
|
30
|
+
readonly scrollX: number;
|
|
31
|
+
readonly scrollY: number;
|
|
32
|
+
scrollTo: (x: number, y: number) => void;
|
|
33
|
+
scrollBy: (x: number, y: number) => void;
|
|
34
|
+
}
|
|
35
|
+
export type ScrollGeometry = NonNullable<ElementProbe["scroll"]>;
|
|
36
|
+
/** Post-scroll geometry of the document/window scroller. */
|
|
37
|
+
export declare function windowScrollGeometry(page: Page): Promise<ScrollGeometry | undefined>;
|
|
38
|
+
/** Post-scroll geometry of a scroll-container element. */
|
|
39
|
+
export declare function elementScrollGeometry(loc: Locator): Promise<ScrollGeometry | undefined>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Scroll geometry helpers for the `scroll` action — post-scroll geometry of the
|
|
2
|
+
// window/document scroller and of a scroll-container element. Split out of
|
|
3
|
+
// actions.ts so that file stays under the size budget; behavior-identical.
|
|
4
|
+
//
|
|
5
|
+
// These scripts run in the browser where TS's DOM lib is intentionally NOT in
|
|
6
|
+
// scope, so the structural shape each one touches is described precisely and
|
|
7
|
+
// `unknown` runtime values are narrowed via real guards.
|
|
8
|
+
/** Post-scroll geometry of the document/window scroller. */
|
|
9
|
+
export async function windowScrollGeometry(page) {
|
|
10
|
+
return page
|
|
11
|
+
.evaluate(() => {
|
|
12
|
+
const g = globalThis;
|
|
13
|
+
const w = g;
|
|
14
|
+
const d = w.document;
|
|
15
|
+
const s = d?.scrollingElement || d?.documentElement;
|
|
16
|
+
if (!s)
|
|
17
|
+
return undefined;
|
|
18
|
+
const x = w.scrollX ?? s.scrollLeft ?? 0;
|
|
19
|
+
const y = w.scrollY ?? s.scrollTop ?? 0;
|
|
20
|
+
return {
|
|
21
|
+
x,
|
|
22
|
+
y,
|
|
23
|
+
scrollWidth: s.scrollWidth,
|
|
24
|
+
scrollHeight: s.scrollHeight,
|
|
25
|
+
clientWidth: s.clientWidth,
|
|
26
|
+
clientHeight: s.clientHeight,
|
|
27
|
+
atTop: y <= 1,
|
|
28
|
+
atBottom: y + s.clientHeight >= s.scrollHeight - 1,
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
.catch(() => undefined);
|
|
32
|
+
}
|
|
33
|
+
/** Post-scroll geometry of a scroll-container element. */
|
|
34
|
+
export async function elementScrollGeometry(loc) {
|
|
35
|
+
return loc
|
|
36
|
+
.evaluate((el) => {
|
|
37
|
+
const e = el;
|
|
38
|
+
if (!e)
|
|
39
|
+
return undefined;
|
|
40
|
+
const y = e.scrollTop ?? 0;
|
|
41
|
+
return {
|
|
42
|
+
x: e.scrollLeft ?? 0,
|
|
43
|
+
y,
|
|
44
|
+
scrollWidth: e.scrollWidth,
|
|
45
|
+
scrollHeight: e.scrollHeight,
|
|
46
|
+
clientWidth: e.clientWidth,
|
|
47
|
+
clientHeight: e.clientHeight,
|
|
48
|
+
atTop: y <= 1,
|
|
49
|
+
atBottom: y + e.clientHeight >= e.scrollHeight - 1,
|
|
50
|
+
};
|
|
51
|
+
})
|
|
52
|
+
.catch(() => undefined);
|
|
53
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { type ActionContext, type ActionResult, type ActionWindowOptions, type ElementProbe } from "./actionresult.js";
|
|
2
|
+
import { type ActionTarget } from "./locator.js";
|
|
3
|
+
export interface ClickArgs extends ActionWindowOptions {
|
|
4
|
+
target: ActionTarget;
|
|
5
|
+
button?: "left" | "right" | "middle";
|
|
6
|
+
force?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function click(ctx: ActionContext, args: ClickArgs): Promise<ActionResult>;
|
|
9
|
+
export interface FillArgs extends ActionWindowOptions {
|
|
10
|
+
target: ActionTarget;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function fill(ctx: ActionContext, args: FillArgs): Promise<ActionResult>;
|
|
14
|
+
export interface NavigateArgs extends ActionWindowOptions {
|
|
15
|
+
url: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function navigate(ctx: ActionContext, args: NavigateArgs): Promise<ActionResult>;
|
|
18
|
+
export interface PressArgs extends ActionWindowOptions {
|
|
19
|
+
target?: ActionTarget;
|
|
20
|
+
key: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function press(ctx: ActionContext, args: PressArgs): Promise<ActionResult>;
|
|
23
|
+
export interface HoverArgs extends ActionWindowOptions {
|
|
24
|
+
target: ActionTarget;
|
|
25
|
+
}
|
|
26
|
+
export declare function hover(ctx: ActionContext, args: HoverArgs): Promise<ActionResult>;
|
|
27
|
+
export interface SelectArgs extends ActionWindowOptions {
|
|
28
|
+
target: ActionTarget;
|
|
29
|
+
values: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare function select(ctx: ActionContext, args: SelectArgs): Promise<ActionResult>;
|
|
32
|
+
export interface WaitForArgs extends ActionWindowOptions {
|
|
33
|
+
/** Element-visibility wait (mutually exclusive with `text`). */
|
|
34
|
+
target?: ActionTarget;
|
|
35
|
+
/** SPA-readiness wait — poll until this visible text appears anywhere
|
|
36
|
+
* in the page. The non-target gating mode real apps need after a reload /
|
|
37
|
+
* nav. NO arbitrary-JS predicate mode by design — that stays `eval_js`'s
|
|
38
|
+
* domain (the single `eval`-gated loophole). */
|
|
39
|
+
text?: string;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}
|
|
42
|
+
export declare function waitFor(ctx: ActionContext, args: WaitForArgs): Promise<ActionResult>;
|
|
43
|
+
export type ScrollEdge = "top" | "bottom" | "left" | "right";
|
|
44
|
+
export interface ScrollArgs extends ActionWindowOptions {
|
|
45
|
+
/** What to scroll. Omitted → the page/window. A ref/selector/named element
|
|
46
|
+
* is either scrolled *into view* (default) or scrolled *within* (when it's
|
|
47
|
+
* a scroll container and `to`/`by` is given). A coords target does a wheel
|
|
48
|
+
* scroll at that point (canvas / map panning). */
|
|
49
|
+
target?: ActionTarget;
|
|
50
|
+
/** Scroll to an edge of the page (or the targeted container). */
|
|
51
|
+
to?: ScrollEdge;
|
|
52
|
+
/** Wheel-style delta in CSS px. Positive y = down, positive x = right. */
|
|
53
|
+
by?: {
|
|
54
|
+
x?: number;
|
|
55
|
+
y?: number;
|
|
56
|
+
};
|
|
57
|
+
/** When `target` is an element: scroll it into view. Defaults to true when a
|
|
58
|
+
* target is given and neither `to` nor `by` is set. */
|
|
59
|
+
intoView?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export type ScrollMode = {
|
|
62
|
+
kind: "into-view";
|
|
63
|
+
} | {
|
|
64
|
+
kind: "container";
|
|
65
|
+
} | {
|
|
66
|
+
kind: "wheel-at";
|
|
67
|
+
} | {
|
|
68
|
+
kind: "window";
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Resolve which of the four scroll behaviours a `ScrollArgs` selects, or throw
|
|
72
|
+
* a clear error for a no-op call. Pure — exported for unit tests.
|
|
73
|
+
*
|
|
74
|
+
* - target + (no to/by) | intoView:true → scroll the element into view
|
|
75
|
+
* - target + (to|by) + intoView:false → scroll *within* the container
|
|
76
|
+
* - coords target → wheel scroll at the point
|
|
77
|
+
* - no target + (to|by) → window scroll
|
|
78
|
+
*/
|
|
79
|
+
export declare function scrollMode(args: ScrollArgs): ScrollMode;
|
|
80
|
+
export declare function scroll(ctx: ActionContext, args: ScrollArgs): Promise<ActionResult>;
|
|
81
|
+
export interface SetViewportArgs extends ActionWindowOptions {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
}
|
|
85
|
+
/** mid-session viewport resize. `page.setViewportSize` re-lays-out and
|
|
86
|
+
* often triggers responsive re-render / lazy-load — wrapped in the action
|
|
87
|
+
* window so `structure` / `network` / `snapshotDelta` show what changed.
|
|
88
|
+
* Device emulation (isMobile/touch/UA/DPR) is creation-time only; this only
|
|
89
|
+
* changes the size. */
|
|
90
|
+
export declare function setViewport(ctx: ActionContext, args: SetViewportArgs): Promise<ActionResult>;
|
|
91
|
+
export interface ChooseOptionArgs extends ActionWindowOptions {
|
|
92
|
+
target: ActionTarget;
|
|
93
|
+
option: string;
|
|
94
|
+
exact?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `choose_option` primitive. Generic combobox/listbox/menu selection
|
|
98
|
+
* for custom controls that aren't native `<select>` (so the existing `select`
|
|
99
|
+
* tool can't drive them). The pattern: open the target control, wait for a
|
|
100
|
+
* visible listbox/menu/portal, find the option element by exact text, click
|
|
101
|
+
* it, return the probe on the *trigger* so `ownerControl.displayText`
|
|
102
|
+
* shows the committed selection.
|
|
103
|
+
*
|
|
104
|
+
* Falls back across `role=option` → `role=menuitem` → `getByText` so works
|
|
105
|
+
* on any reasonable combobox shape. Does **not** simulate keyboard navigation
|
|
106
|
+
* (type-and-press-Enter) — that's a different primitive and prone to picking
|
|
107
|
+
* the wrong option in dense lists.
|
|
108
|
+
*/
|
|
109
|
+
export declare function chooseOption(ctx: ActionContext, args: ChooseOptionArgs): Promise<ActionResult>;
|
|
110
|
+
export type GoBackArgs = ActionWindowOptions;
|
|
111
|
+
export declare function goBack(ctx: ActionContext, args?: GoBackArgs): Promise<ActionResult>;
|
|
112
|
+
export type GoForwardArgs = ActionWindowOptions;
|
|
113
|
+
export declare function goForward(ctx: ActionContext, args?: GoForwardArgs): Promise<ActionResult>;
|
|
114
|
+
/** Dispatch-side secret materialisation. Wraps `SecretRegistry.materialize`
|
|
115
|
+
* with a no-registry fallback so non-secrets callers don't need to feature-
|
|
116
|
+
* detect. Exported for composing primitives (e.g. multi-field fill). */
|
|
117
|
+
export declare function materialiseValue(ctx: ActionContext, raw: string): {
|
|
118
|
+
ok: true;
|
|
119
|
+
value: string;
|
|
120
|
+
alias?: string;
|
|
121
|
+
} | {
|
|
122
|
+
ok: false;
|
|
123
|
+
error: string;
|
|
124
|
+
};
|
|
125
|
+
/** Post-probe defence-in-depth: mask any registered real-value that leaked
|
|
126
|
+
* into the probe's `value` / `displayText` / `ownerControl` / `container`
|
|
127
|
+
* string fields. The fill / press path is the canonical source of these
|
|
128
|
+
* leaks — the field's DOM value reflects what we just typed.
|
|
129
|
+
* Exported for composing primitives (e.g. multi-field fill). */
|
|
130
|
+
export declare function maskProbe(probed: ElementProbe | void, ctx: ActionContext): ElementProbe | void;
|
|
131
|
+
export type { PreProbeData } from "./actions-probe.js";
|
|
132
|
+
export { preProbe, probe, captureHit, captureFocusedRef } from "./actions-probe.js";
|