pure-patchright 1.52.5__py3-none-any.whl
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.
- patchright/__init__.py +5 -0
- patchright/__main__.py +18 -0
- patchright/_impl/__init__.py +0 -0
- patchright/_impl/__pyinstaller/__init__.py +20 -0
- patchright/_impl/__pyinstaller/hook-playwright.async_api.py +3 -0
- patchright/_impl/__pyinstaller/hook-playwright.sync_api.py +3 -0
- patchright/_impl/_accessibility.py +50 -0
- patchright/_impl/_api_structures.py +277 -0
- patchright/_impl/_artifact.py +45 -0
- patchright/_impl/_assertions.py +867 -0
- patchright/_impl/_async_base.py +92 -0
- patchright/_impl/_browser.py +248 -0
- patchright/_impl/_browser_context.py +743 -0
- patchright/_impl/_browser_type.py +276 -0
- patchright/_impl/_cdp_session.py +21 -0
- patchright/_impl/_clock.py +57 -0
- patchright/_impl/_connection.py +562 -0
- patchright/_impl/_console_message.py +45 -0
- patchright/_impl/_dialog.py +40 -0
- patchright/_impl/_download.py +50 -0
- patchright/_impl/_driver.py +24 -0
- patchright/_impl/_element_handle.py +376 -0
- patchright/_impl/_errors.py +44 -0
- patchright/_impl/_event_context_manager.py +20 -0
- patchright/_impl/_fetch.py +518 -0
- patchright/_impl/_file_chooser.py +43 -0
- patchright/_impl/_frame.py +779 -0
- patchright/_impl/_glob.py +46 -0
- patchright/_impl/_greenlets.py +39 -0
- patchright/_impl/_har_router.py +99 -0
- patchright/_impl/_helper.py +481 -0
- patchright/_impl/_impl_to_api_mapping.py +123 -0
- patchright/_impl/_input.py +71 -0
- patchright/_impl/_js_handle.py +300 -0
- patchright/_impl/_json_pipe.py +56 -0
- patchright/_impl/_local_utils.py +73 -0
- patchright/_impl/_locator.py +814 -0
- patchright/_impl/_map.py +19 -0
- patchright/_impl/_network.py +958 -0
- patchright/_impl/_object_factory.py +91 -0
- patchright/_impl/_page.py +1485 -0
- patchright/_impl/_path_utils.py +11 -0
- patchright/_impl/_playwright.py +51 -0
- patchright/_impl/_selectors.py +62 -0
- patchright/_impl/_set_input_files_helpers.py +135 -0
- patchright/_impl/_str_utils.py +57 -0
- patchright/_impl/_stream.py +32 -0
- patchright/_impl/_sync_base.py +134 -0
- patchright/_impl/_tracing.py +110 -0
- patchright/_impl/_transport.py +150 -0
- patchright/_impl/_video.py +57 -0
- patchright/_impl/_waiter.py +142 -0
- patchright/_impl/_web_error.py +27 -0
- patchright/_impl/_writable_stream.py +27 -0
- patchright/_repo_version.py +1 -0
- patchright/async_api/__init__.py +179 -0
- patchright/async_api/_context_manager.py +39 -0
- patchright/async_api/_generated.py +20416 -0
- patchright/driver/README.md +1 -0
- patchright/driver/package/README.md +3 -0
- patchright/driver/package/ThirdPartyNotices.txt +1560 -0
- patchright/driver/package/bin/install_media_pack.ps1 +5 -0
- patchright/driver/package/bin/reinstall_chrome_beta_linux.sh +42 -0
- patchright/driver/package/bin/reinstall_chrome_beta_mac.sh +13 -0
- patchright/driver/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- patchright/driver/package/bin/reinstall_chrome_stable_linux.sh +42 -0
- patchright/driver/package/bin/reinstall_chrome_stable_mac.sh +12 -0
- patchright/driver/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- patchright/driver/package/bin/reinstall_msedge_beta_linux.sh +48 -0
- patchright/driver/package/bin/reinstall_msedge_beta_mac.sh +11 -0
- patchright/driver/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- patchright/driver/package/bin/reinstall_msedge_dev_linux.sh +48 -0
- patchright/driver/package/bin/reinstall_msedge_dev_mac.sh +11 -0
- patchright/driver/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- patchright/driver/package/bin/reinstall_msedge_stable_linux.sh +48 -0
- patchright/driver/package/bin/reinstall_msedge_stable_mac.sh +11 -0
- patchright/driver/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- patchright/driver/package/browsers.json +80 -0
- patchright/driver/package/cli.js +18 -0
- patchright/driver/package/index.js +32 -0
- patchright/driver/package/index.mjs +28 -0
- patchright/driver/package/lib/androidServerImpl.js +63 -0
- patchright/driver/package/lib/browserServerImpl.js +88 -0
- patchright/driver/package/lib/cli/driver.js +97 -0
- patchright/driver/package/lib/cli/program.js +567 -0
- patchright/driver/package/lib/cli/programWithTestStub.js +74 -0
- patchright/driver/package/lib/client/accessibility.js +49 -0
- patchright/driver/package/lib/client/android.js +365 -0
- patchright/driver/package/lib/client/api.js +137 -0
- patchright/driver/package/lib/client/artifact.js +79 -0
- patchright/driver/package/lib/client/browser.js +136 -0
- patchright/driver/package/lib/client/browserContext.js +539 -0
- patchright/driver/package/lib/client/browserType.js +193 -0
- patchright/driver/package/lib/client/cdpSession.js +51 -0
- patchright/driver/package/lib/client/channelOwner.js +205 -0
- patchright/driver/package/lib/client/clientHelper.js +64 -0
- patchright/driver/package/lib/client/clientInstrumentation.js +55 -0
- patchright/driver/package/lib/client/clientStackTrace.js +69 -0
- patchright/driver/package/lib/client/clock.js +68 -0
- patchright/driver/package/lib/client/connection.js +318 -0
- patchright/driver/package/lib/client/consoleMessage.js +55 -0
- patchright/driver/package/lib/client/coverage.js +44 -0
- patchright/driver/package/lib/client/dialog.js +56 -0
- patchright/driver/package/lib/client/download.js +62 -0
- patchright/driver/package/lib/client/electron.js +133 -0
- patchright/driver/package/lib/client/elementHandle.js +284 -0
- patchright/driver/package/lib/client/errors.js +77 -0
- patchright/driver/package/lib/client/eventEmitter.js +314 -0
- patchright/driver/package/lib/client/events.js +98 -0
- patchright/driver/package/lib/client/fetch.js +367 -0
- patchright/driver/package/lib/client/fileChooser.js +46 -0
- patchright/driver/package/lib/client/fileUtils.js +34 -0
- patchright/driver/package/lib/client/frame.js +386 -0
- patchright/driver/package/lib/client/harRouter.js +87 -0
- patchright/driver/package/lib/client/input.js +82 -0
- patchright/driver/package/lib/client/jsHandle.js +105 -0
- patchright/driver/package/lib/client/jsonPipe.js +39 -0
- patchright/driver/package/lib/client/localUtils.js +61 -0
- patchright/driver/package/lib/client/locator.js +362 -0
- patchright/driver/package/lib/client/network.js +751 -0
- patchright/driver/package/lib/client/page.js +709 -0
- patchright/driver/package/lib/client/platform.js +74 -0
- patchright/driver/package/lib/client/playwright.js +85 -0
- patchright/driver/package/lib/client/selectors.js +75 -0
- patchright/driver/package/lib/client/stream.js +39 -0
- patchright/driver/package/lib/client/timeoutSettings.js +75 -0
- patchright/driver/package/lib/client/tracing.js +114 -0
- patchright/driver/package/lib/client/types.js +28 -0
- patchright/driver/package/lib/client/video.js +59 -0
- patchright/driver/package/lib/client/waiter.js +142 -0
- patchright/driver/package/lib/client/webError.js +39 -0
- patchright/driver/package/lib/client/webSocket.js +111 -0
- patchright/driver/package/lib/client/worker.js +63 -0
- patchright/driver/package/lib/client/writableStream.js +39 -0
- patchright/driver/package/lib/generated/clockSource.js +28 -0
- patchright/driver/package/lib/generated/consoleApiSource.js +28 -0
- patchright/driver/package/lib/generated/injectedScriptSource.js +28 -0
- patchright/driver/package/lib/generated/pollingRecorderSource.js +28 -0
- patchright/driver/package/lib/generated/utilityScriptSource.js +28 -0
- patchright/driver/package/lib/generated/webSocketMockSource.js +374 -0
- patchright/driver/package/lib/inProcessFactory.js +59 -0
- patchright/driver/package/lib/inprocess.js +3 -0
- patchright/driver/package/lib/outofprocess.js +78 -0
- patchright/driver/package/lib/protocol/debug.js +211 -0
- patchright/driver/package/lib/protocol/serializers.js +192 -0
- patchright/driver/package/lib/protocol/validator.js +2832 -0
- patchright/driver/package/lib/protocol/validatorPrimitives.js +179 -0
- patchright/driver/package/lib/remote/playwrightConnection.js +266 -0
- patchright/driver/package/lib/remote/playwrightServer.js +139 -0
- patchright/driver/package/lib/server/accessibility.js +69 -0
- patchright/driver/package/lib/server/android/android.js +451 -0
- patchright/driver/package/lib/server/android/backendAdb.js +179 -0
- patchright/driver/package/lib/server/artifact.js +127 -0
- patchright/driver/package/lib/server/bidi/bidiBrowser.js +380 -0
- patchright/driver/package/lib/server/bidi/bidiChromium.js +152 -0
- patchright/driver/package/lib/server/bidi/bidiConnection.js +187 -0
- patchright/driver/package/lib/server/bidi/bidiExecutionContext.js +220 -0
- patchright/driver/package/lib/server/bidi/bidiFirefox.js +112 -0
- patchright/driver/package/lib/server/bidi/bidiInput.js +146 -0
- patchright/driver/package/lib/server/bidi/bidiNetworkManager.js +320 -0
- patchright/driver/package/lib/server/bidi/bidiOverCdp.js +102 -0
- patchright/driver/package/lib/server/bidi/bidiPage.js +530 -0
- patchright/driver/package/lib/server/bidi/bidiPdf.js +106 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiDeserializer.js +98 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiProtocol.js +152 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- patchright/driver/package/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- patchright/driver/package/lib/server/browser.js +140 -0
- patchright/driver/package/lib/server/browserContext.js +646 -0
- patchright/driver/package/lib/server/browserType.js +326 -0
- patchright/driver/package/lib/server/callLog.js +82 -0
- patchright/driver/package/lib/server/chromium/appIcon.png +0 -0
- patchright/driver/package/lib/server/chromium/chromium.js +376 -0
- patchright/driver/package/lib/server/chromium/chromiumSwitches.js +89 -0
- patchright/driver/package/lib/server/chromium/crAccessibility.js +263 -0
- patchright/driver/package/lib/server/chromium/crBrowser.js +503 -0
- patchright/driver/package/lib/server/chromium/crConnection.js +203 -0
- patchright/driver/package/lib/server/chromium/crCoverage.js +232 -0
- patchright/driver/package/lib/server/chromium/crDevTools.js +112 -0
- patchright/driver/package/lib/server/chromium/crDragDrop.js +126 -0
- patchright/driver/package/lib/server/chromium/crExecutionContext.js +145 -0
- patchright/driver/package/lib/server/chromium/crInput.js +184 -0
- patchright/driver/package/lib/server/chromium/crNetworkManager.js +742 -0
- patchright/driver/package/lib/server/chromium/crPage.js +1134 -0
- patchright/driver/package/lib/server/chromium/crPdf.js +121 -0
- patchright/driver/package/lib/server/chromium/crProtocolHelper.js +145 -0
- patchright/driver/package/lib/server/chromium/crServiceWorker.js +126 -0
- patchright/driver/package/lib/server/chromium/defaultFontFamilies.js +162 -0
- patchright/driver/package/lib/server/chromium/protocol.d.js +16 -0
- patchright/driver/package/lib/server/chromium/videoRecorder.js +121 -0
- patchright/driver/package/lib/server/clock.js +145 -0
- patchright/driver/package/lib/server/codegen/csharp.js +329 -0
- patchright/driver/package/lib/server/codegen/java.js +270 -0
- patchright/driver/package/lib/server/codegen/javascript.js +268 -0
- patchright/driver/package/lib/server/codegen/jsonl.js +51 -0
- patchright/driver/package/lib/server/codegen/language.js +111 -0
- patchright/driver/package/lib/server/codegen/languages.js +68 -0
- patchright/driver/package/lib/server/codegen/python.js +277 -0
- patchright/driver/package/lib/server/codegen/types.js +16 -0
- patchright/driver/package/lib/server/console.js +53 -0
- patchright/driver/package/lib/server/cookieStore.js +204 -0
- patchright/driver/package/lib/server/debugController.js +185 -0
- patchright/driver/package/lib/server/debugger.js +136 -0
- patchright/driver/package/lib/server/deviceDescriptors.js +39 -0
- patchright/driver/package/lib/server/deviceDescriptorsSource.json +1669 -0
- patchright/driver/package/lib/server/dialog.js +72 -0
- patchright/driver/package/lib/server/dispatchers/androidDispatcher.js +293 -0
- patchright/driver/package/lib/server/dispatchers/artifactDispatcher.js +118 -0
- patchright/driver/package/lib/server/dispatchers/browserContextDispatcher.js +328 -0
- patchright/driver/package/lib/server/dispatchers/browserDispatcher.js +151 -0
- patchright/driver/package/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
- patchright/driver/package/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- patchright/driver/package/lib/server/dispatchers/debugControllerDispatcher.js +87 -0
- patchright/driver/package/lib/server/dispatchers/dialogDispatcher.js +47 -0
- patchright/driver/package/lib/server/dispatchers/dispatcher.js +346 -0
- patchright/driver/package/lib/server/dispatchers/electronDispatcher.js +90 -0
- patchright/driver/package/lib/server/dispatchers/elementHandlerDispatcher.js +191 -0
- patchright/driver/package/lib/server/dispatchers/frameDispatcher.js +230 -0
- patchright/driver/package/lib/server/dispatchers/jsHandleDispatcher.js +80 -0
- patchright/driver/package/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- patchright/driver/package/lib/server/dispatchers/localUtilsDispatcher.js +155 -0
- patchright/driver/package/lib/server/dispatchers/networkDispatchers.js +204 -0
- patchright/driver/package/lib/server/dispatchers/pageDispatcher.js +328 -0
- patchright/driver/package/lib/server/dispatchers/playwrightDispatcher.js +100 -0
- patchright/driver/package/lib/server/dispatchers/selectorsDispatcher.js +40 -0
- patchright/driver/package/lib/server/dispatchers/streamDispatcher.js +60 -0
- patchright/driver/package/lib/server/dispatchers/tracingDispatcher.js +59 -0
- patchright/driver/package/lib/server/dispatchers/webSocketRouteDispatcher.js +154 -0
- patchright/driver/package/lib/server/dispatchers/writableStreamDispatcher.js +73 -0
- patchright/driver/package/lib/server/dom.js +869 -0
- patchright/driver/package/lib/server/download.js +70 -0
- patchright/driver/package/lib/server/electron/electron.js +277 -0
- patchright/driver/package/lib/server/electron/loader.js +29 -0
- patchright/driver/package/lib/server/errors.js +69 -0
- patchright/driver/package/lib/server/fetch.js +640 -0
- patchright/driver/package/lib/server/fileChooser.js +43 -0
- patchright/driver/package/lib/server/fileUploadUtils.js +84 -0
- patchright/driver/package/lib/server/firefox/ffAccessibility.js +238 -0
- patchright/driver/package/lib/server/firefox/ffBrowser.js +404 -0
- patchright/driver/package/lib/server/firefox/ffConnection.js +147 -0
- patchright/driver/package/lib/server/firefox/ffExecutionContext.js +149 -0
- patchright/driver/package/lib/server/firefox/ffInput.js +159 -0
- patchright/driver/package/lib/server/firefox/ffNetworkManager.js +254 -0
- patchright/driver/package/lib/server/firefox/ffPage.js +501 -0
- patchright/driver/package/lib/server/firefox/firefox.js +106 -0
- patchright/driver/package/lib/server/firefox/protocol.d.js +16 -0
- patchright/driver/package/lib/server/formData.js +147 -0
- patchright/driver/package/lib/server/frameSelectors.js +274 -0
- patchright/driver/package/lib/server/frames.js +1834 -0
- patchright/driver/package/lib/server/har/harRecorder.js +147 -0
- patchright/driver/package/lib/server/har/harTracer.js +606 -0
- patchright/driver/package/lib/server/harBackend.js +157 -0
- patchright/driver/package/lib/server/helper.js +100 -0
- patchright/driver/package/lib/server/index.js +61 -0
- patchright/driver/package/lib/server/input.js +280 -0
- patchright/driver/package/lib/server/instrumentation.js +75 -0
- patchright/driver/package/lib/server/javascript.js +315 -0
- patchright/driver/package/lib/server/launchApp.js +110 -0
- patchright/driver/package/lib/server/localUtils.js +211 -0
- patchright/driver/package/lib/server/macEditingCommands.js +143 -0
- patchright/driver/package/lib/server/network.js +583 -0
- patchright/driver/package/lib/server/page.js +775 -0
- patchright/driver/package/lib/server/pageBinding.js +88 -0
- patchright/driver/package/lib/server/pipeTransport.js +89 -0
- patchright/driver/package/lib/server/playwright.js +81 -0
- patchright/driver/package/lib/server/progress.js +104 -0
- patchright/driver/package/lib/server/protocolError.js +52 -0
- patchright/driver/package/lib/server/recorder/chat.js +161 -0
- patchright/driver/package/lib/server/recorder/contextRecorder.js +286 -0
- patchright/driver/package/lib/server/recorder/recorderApp.js +184 -0
- patchright/driver/package/lib/server/recorder/recorderCollection.js +116 -0
- patchright/driver/package/lib/server/recorder/recorderFrontend.js +16 -0
- patchright/driver/package/lib/server/recorder/recorderRunner.js +135 -0
- patchright/driver/package/lib/server/recorder/recorderUtils.js +100 -0
- patchright/driver/package/lib/server/recorder/throttledFile.js +57 -0
- patchright/driver/package/lib/server/recorder.js +360 -0
- patchright/driver/package/lib/server/registry/browserFetcher.js +175 -0
- patchright/driver/package/lib/server/registry/dependencies.js +371 -0
- patchright/driver/package/lib/server/registry/index.js +1271 -0
- patchright/driver/package/lib/server/registry/nativeDeps.js +1105 -0
- patchright/driver/package/lib/server/registry/oopDownloadBrowserMain.js +120 -0
- patchright/driver/package/lib/server/screenshotter.js +332 -0
- patchright/driver/package/lib/server/selectors.js +112 -0
- patchright/driver/package/lib/server/socksClientCertificatesInterceptor.js +321 -0
- patchright/driver/package/lib/server/socksInterceptor.js +95 -0
- patchright/driver/package/lib/server/storageScript.js +154 -0
- patchright/driver/package/lib/server/timeoutSettings.js +89 -0
- patchright/driver/package/lib/server/trace/recorder/snapshotter.js +143 -0
- patchright/driver/package/lib/server/trace/recorder/snapshotterInjected.js +539 -0
- patchright/driver/package/lib/server/trace/recorder/tracing.js +593 -0
- patchright/driver/package/lib/server/trace/test/inMemorySnapshotter.js +87 -0
- patchright/driver/package/lib/server/trace/viewer/traceViewer.js +249 -0
- patchright/driver/package/lib/server/transport.js +183 -0
- patchright/driver/package/lib/server/types.js +28 -0
- patchright/driver/package/lib/server/usKeyboardLayout.js +145 -0
- patchright/driver/package/lib/server/utils/ascii.js +44 -0
- patchright/driver/package/lib/server/utils/comparators.js +161 -0
- patchright/driver/package/lib/server/utils/crypto.js +216 -0
- patchright/driver/package/lib/server/utils/debug.js +47 -0
- patchright/driver/package/lib/server/utils/debugLogger.js +114 -0
- patchright/driver/package/lib/server/utils/env.js +68 -0
- patchright/driver/package/lib/server/utils/eventsHelper.js +39 -0
- patchright/driver/package/lib/server/utils/expectUtils.js +38 -0
- patchright/driver/package/lib/server/utils/fileUtils.js +191 -0
- patchright/driver/package/lib/server/utils/happyEyeballs.js +207 -0
- patchright/driver/package/lib/server/utils/hostPlatform.js +109 -0
- patchright/driver/package/lib/server/utils/httpServer.js +218 -0
- patchright/driver/package/lib/server/utils/image_tools/colorUtils.js +89 -0
- patchright/driver/package/lib/server/utils/image_tools/compare.js +109 -0
- patchright/driver/package/lib/server/utils/image_tools/imageChannel.js +78 -0
- patchright/driver/package/lib/server/utils/image_tools/stats.js +102 -0
- patchright/driver/package/lib/server/utils/linuxUtils.js +71 -0
- patchright/driver/package/lib/server/utils/network.js +217 -0
- patchright/driver/package/lib/server/utils/nodePlatform.js +148 -0
- patchright/driver/package/lib/server/utils/pipeTransport.js +84 -0
- patchright/driver/package/lib/server/utils/processLauncher.js +238 -0
- patchright/driver/package/lib/server/utils/profiler.js +65 -0
- patchright/driver/package/lib/server/utils/socksProxy.js +511 -0
- patchright/driver/package/lib/server/utils/spawnAsync.js +41 -0
- patchright/driver/package/lib/server/utils/task.js +51 -0
- patchright/driver/package/lib/server/utils/userAgent.js +98 -0
- patchright/driver/package/lib/server/utils/wsServer.js +132 -0
- patchright/driver/package/lib/server/utils/zipFile.js +74 -0
- patchright/driver/package/lib/server/utils/zones.js +57 -0
- patchright/driver/package/lib/server/webkit/protocol.d.js +16 -0
- patchright/driver/package/lib/server/webkit/webkit.js +100 -0
- patchright/driver/package/lib/server/webkit/wkAccessibility.js +237 -0
- patchright/driver/package/lib/server/webkit/wkBrowser.js +312 -0
- patchright/driver/package/lib/server/webkit/wkConnection.js +149 -0
- patchright/driver/package/lib/server/webkit/wkExecutionContext.js +153 -0
- patchright/driver/package/lib/server/webkit/wkInput.js +181 -0
- patchright/driver/package/lib/server/webkit/wkInterceptableRequest.js +169 -0
- patchright/driver/package/lib/server/webkit/wkPage.js +1114 -0
- patchright/driver/package/lib/server/webkit/wkProvisionalPage.js +83 -0
- patchright/driver/package/lib/server/webkit/wkWorkers.js +104 -0
- patchright/driver/package/lib/third_party/pixelmatch.js +255 -0
- patchright/driver/package/lib/utils/isomorphic/ariaSnapshot.js +384 -0
- patchright/driver/package/lib/utils/isomorphic/assert.js +31 -0
- patchright/driver/package/lib/utils/isomorphic/builtins.js +86 -0
- patchright/driver/package/lib/utils/isomorphic/colors.js +72 -0
- patchright/driver/package/lib/utils/isomorphic/cssParser.js +246 -0
- patchright/driver/package/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- patchright/driver/package/lib/utils/isomorphic/headers.js +53 -0
- patchright/driver/package/lib/utils/isomorphic/locatorGenerators.js +655 -0
- patchright/driver/package/lib/utils/isomorphic/locatorParser.js +176 -0
- patchright/driver/package/lib/utils/isomorphic/locatorUtils.js +81 -0
- patchright/driver/package/lib/utils/isomorphic/manualPromise.js +115 -0
- patchright/driver/package/lib/utils/isomorphic/mimeType.js +460 -0
- patchright/driver/package/lib/utils/isomorphic/multimap.js +81 -0
- patchright/driver/package/lib/utils/isomorphic/rtti.js +43 -0
- patchright/driver/package/lib/utils/isomorphic/selectorParser.js +387 -0
- patchright/driver/package/lib/utils/isomorphic/semaphore.js +54 -0
- patchright/driver/package/lib/utils/isomorphic/stackTrace.js +158 -0
- patchright/driver/package/lib/utils/isomorphic/stringUtils.js +176 -0
- patchright/driver/package/lib/utils/isomorphic/time.js +44 -0
- patchright/driver/package/lib/utils/isomorphic/timeoutRunner.js +67 -0
- patchright/driver/package/lib/utils/isomorphic/traceUtils.js +59 -0
- patchright/driver/package/lib/utils/isomorphic/types.js +16 -0
- patchright/driver/package/lib/utils/isomorphic/urlMatch.js +167 -0
- patchright/driver/package/lib/utils/isomorphic/utilityScriptSerializers.js +248 -0
- patchright/driver/package/lib/utils.js +101 -0
- patchright/driver/package/lib/utilsBundle.js +106 -0
- patchright/driver/package/lib/utilsBundleImpl/index.js +208 -0
- patchright/driver/package/lib/utilsBundleImpl/xdg-open +1066 -0
- patchright/driver/package/lib/zipBundle.js +34 -0
- patchright/driver/package/lib/zipBundleImpl.js +5 -0
- patchright/driver/package/package.json +44 -0
- patchright/driver/package/protocol.yml +3313 -0
- patchright/py.typed +0 -0
- patchright/sync_api/__init__.py +179 -0
- patchright/sync_api/_context_manager.py +74 -0
- patchright/sync_api/_generated.py +20632 -0
- pure_patchright-1.52.5.dist-info/LICENSE +201 -0
- pure_patchright-1.52.5.dist-info/METADATA +96 -0
- pure_patchright-1.52.5.dist-info/RECORD +381 -0
- pure_patchright-1.52.5.dist-info/WHEEL +4 -0
- pure_patchright-1.52.5.dist-info/entry_points.txt +5 -0
- pure_patchright-1.52.5.dist-info/licenses/LICENSE +202 -0
- pure_patchright-1.52.5.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var recorderRunner_exports = {};
|
|
20
|
+
__export(recorderRunner_exports, {
|
|
21
|
+
performAction: () => performAction,
|
|
22
|
+
toClickOptions: () => toClickOptions
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(recorderRunner_exports);
|
|
25
|
+
var import_utils = require("../../utils");
|
|
26
|
+
var import_language = require("../codegen/language");
|
|
27
|
+
var import_instrumentation = require("../instrumentation");
|
|
28
|
+
var import_recorderUtils = require("./recorderUtils");
|
|
29
|
+
async function performAction(pageAliases, actionInContext) {
|
|
30
|
+
const callMetadata = (0, import_instrumentation.serverSideCallMetadata)();
|
|
31
|
+
const mainFrame = (0, import_recorderUtils.mainFrameForAction)(pageAliases, actionInContext);
|
|
32
|
+
const { action } = actionInContext;
|
|
33
|
+
const kActionTimeout = 5e3;
|
|
34
|
+
if (action.name === "navigate") {
|
|
35
|
+
await mainFrame.goto(callMetadata, action.url, { timeout: kActionTimeout });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (action.name === "openPage")
|
|
39
|
+
throw Error("Not reached");
|
|
40
|
+
if (action.name === "closePage") {
|
|
41
|
+
await mainFrame._page.close(callMetadata);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const selector = (0, import_recorderUtils.buildFullSelector)(actionInContext.frame.framePath, action.selector);
|
|
45
|
+
if (action.name === "click") {
|
|
46
|
+
const options = toClickOptions(action);
|
|
47
|
+
await mainFrame.click(callMetadata, selector, { ...options, timeout: kActionTimeout, strict: true });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (action.name === "press") {
|
|
51
|
+
const modifiers = (0, import_language.toKeyboardModifiers)(action.modifiers);
|
|
52
|
+
const shortcut = [...modifiers, action.key].join("+");
|
|
53
|
+
await mainFrame.press(callMetadata, selector, shortcut, { timeout: kActionTimeout, strict: true });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (action.name === "fill") {
|
|
57
|
+
await mainFrame.fill(callMetadata, selector, action.text, { timeout: kActionTimeout, strict: true });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (action.name === "setInputFiles") {
|
|
61
|
+
await mainFrame.setInputFiles(callMetadata, selector, { selector, payloads: [], timeout: kActionTimeout, strict: true });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (action.name === "check") {
|
|
65
|
+
await mainFrame.check(callMetadata, selector, { timeout: kActionTimeout, strict: true });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (action.name === "uncheck") {
|
|
69
|
+
await mainFrame.uncheck(callMetadata, selector, { timeout: kActionTimeout, strict: true });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (action.name === "select") {
|
|
73
|
+
const values = action.options.map((value) => ({ value }));
|
|
74
|
+
await mainFrame.selectOption(callMetadata, selector, [], values, { timeout: kActionTimeout, strict: true });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (action.name === "assertChecked") {
|
|
78
|
+
await mainFrame.expect(callMetadata, selector, {
|
|
79
|
+
selector,
|
|
80
|
+
expression: "to.be.checked",
|
|
81
|
+
expectedValue: { checked: action.checked },
|
|
82
|
+
isNot: !action.checked,
|
|
83
|
+
timeout: kActionTimeout
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (action.name === "assertText") {
|
|
88
|
+
await mainFrame.expect(callMetadata, selector, {
|
|
89
|
+
selector,
|
|
90
|
+
expression: "to.have.text",
|
|
91
|
+
expectedText: (0, import_utils.serializeExpectedTextValues)([action.text], { matchSubstring: true, normalizeWhiteSpace: true }),
|
|
92
|
+
isNot: false,
|
|
93
|
+
timeout: kActionTimeout
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (action.name === "assertValue") {
|
|
98
|
+
await mainFrame.expect(callMetadata, selector, {
|
|
99
|
+
selector,
|
|
100
|
+
expression: "to.have.value",
|
|
101
|
+
expectedValue: action.value,
|
|
102
|
+
isNot: false,
|
|
103
|
+
timeout: kActionTimeout
|
|
104
|
+
});
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (action.name === "assertVisible") {
|
|
108
|
+
await mainFrame.expect(callMetadata, selector, {
|
|
109
|
+
selector,
|
|
110
|
+
expression: "to.be.visible",
|
|
111
|
+
isNot: false,
|
|
112
|
+
timeout: kActionTimeout
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
throw new Error("Internal error: unexpected action " + action.name);
|
|
117
|
+
}
|
|
118
|
+
function toClickOptions(action) {
|
|
119
|
+
const modifiers = (0, import_language.toKeyboardModifiers)(action.modifiers);
|
|
120
|
+
const options = {};
|
|
121
|
+
if (action.button !== "left")
|
|
122
|
+
options.button = action.button;
|
|
123
|
+
if (modifiers.length)
|
|
124
|
+
options.modifiers = modifiers;
|
|
125
|
+
if (action.clickCount > 1)
|
|
126
|
+
options.clickCount = action.clickCount;
|
|
127
|
+
if (action.position)
|
|
128
|
+
options.position = action.position;
|
|
129
|
+
return options;
|
|
130
|
+
}
|
|
131
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
+
0 && (module.exports = {
|
|
133
|
+
performAction,
|
|
134
|
+
toClickOptions
|
|
135
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var recorderUtils_exports = {};
|
|
20
|
+
__export(recorderUtils_exports, {
|
|
21
|
+
buildFullSelector: () => buildFullSelector,
|
|
22
|
+
collapseActions: () => collapseActions,
|
|
23
|
+
frameForAction: () => frameForAction,
|
|
24
|
+
mainFrameForAction: () => mainFrameForAction,
|
|
25
|
+
metadataToCallLog: () => metadataToCallLog
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(recorderUtils_exports);
|
|
28
|
+
function buildFullSelector(framePath, selector) {
|
|
29
|
+
return [...framePath, selector].join(" >> internal:control=enter-frame >> ");
|
|
30
|
+
}
|
|
31
|
+
function metadataToCallLog(metadata, status) {
|
|
32
|
+
let title = metadata.apiName || metadata.method;
|
|
33
|
+
if (metadata.method === "waitForEventInfo")
|
|
34
|
+
title += `(${metadata.params.info.event})`;
|
|
35
|
+
title = title.replace("object.expect", "expect");
|
|
36
|
+
if (metadata.error)
|
|
37
|
+
status = "error";
|
|
38
|
+
const params = {
|
|
39
|
+
url: metadata.params?.url,
|
|
40
|
+
selector: metadata.params?.selector
|
|
41
|
+
};
|
|
42
|
+
let duration = metadata.endTime ? metadata.endTime - metadata.startTime : void 0;
|
|
43
|
+
if (typeof duration === "number" && metadata.pauseStartTime && metadata.pauseEndTime) {
|
|
44
|
+
duration -= metadata.pauseEndTime - metadata.pauseStartTime;
|
|
45
|
+
duration = Math.max(duration, 0);
|
|
46
|
+
}
|
|
47
|
+
const callLog = {
|
|
48
|
+
id: metadata.id,
|
|
49
|
+
messages: metadata.log,
|
|
50
|
+
title,
|
|
51
|
+
status,
|
|
52
|
+
error: metadata.error?.error?.message,
|
|
53
|
+
params,
|
|
54
|
+
duration
|
|
55
|
+
};
|
|
56
|
+
return callLog;
|
|
57
|
+
}
|
|
58
|
+
function mainFrameForAction(pageAliases, actionInContext) {
|
|
59
|
+
const pageAlias = actionInContext.frame.pageAlias;
|
|
60
|
+
const page = [...pageAliases.entries()].find(([, alias]) => pageAlias === alias)?.[0];
|
|
61
|
+
if (!page)
|
|
62
|
+
throw new Error(`Internal error: page ${pageAlias} not found in [${[...pageAliases.values()]}]`);
|
|
63
|
+
return page.mainFrame();
|
|
64
|
+
}
|
|
65
|
+
async function frameForAction(pageAliases, actionInContext, action) {
|
|
66
|
+
const pageAlias = actionInContext.frame.pageAlias;
|
|
67
|
+
const page = [...pageAliases.entries()].find(([, alias]) => pageAlias === alias)?.[0];
|
|
68
|
+
if (!page)
|
|
69
|
+
throw new Error("Internal error: page not found");
|
|
70
|
+
const fullSelector = buildFullSelector(actionInContext.frame.framePath, action.selector);
|
|
71
|
+
const result = await page.mainFrame().selectors.resolveFrameForSelector(fullSelector);
|
|
72
|
+
if (!result)
|
|
73
|
+
throw new Error("Internal error: frame not found");
|
|
74
|
+
return result.frame;
|
|
75
|
+
}
|
|
76
|
+
function collapseActions(actions) {
|
|
77
|
+
const result = [];
|
|
78
|
+
for (const action of actions) {
|
|
79
|
+
const lastAction = result[result.length - 1];
|
|
80
|
+
const isSameAction = lastAction && lastAction.action.name === action.action.name && lastAction.frame.pageAlias === action.frame.pageAlias && lastAction.frame.framePath.join("|") === action.frame.framePath.join("|");
|
|
81
|
+
const isSameSelector = lastAction && "selector" in lastAction.action && "selector" in action.action && action.action.selector === lastAction.action.selector;
|
|
82
|
+
const shouldMerge = isSameAction && (action.action.name === "navigate" || action.action.name === "fill" && isSameSelector);
|
|
83
|
+
if (!shouldMerge) {
|
|
84
|
+
result.push(action);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const startTime = result[result.length - 1].startTime;
|
|
88
|
+
result[result.length - 1] = action;
|
|
89
|
+
result[result.length - 1].startTime = startTime;
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
buildFullSelector,
|
|
96
|
+
collapseActions,
|
|
97
|
+
frameForAction,
|
|
98
|
+
mainFrameForAction,
|
|
99
|
+
metadataToCallLog
|
|
100
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var throttledFile_exports = {};
|
|
30
|
+
__export(throttledFile_exports, {
|
|
31
|
+
ThrottledFile: () => ThrottledFile
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(throttledFile_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
class ThrottledFile {
|
|
36
|
+
constructor(file) {
|
|
37
|
+
this._file = file;
|
|
38
|
+
}
|
|
39
|
+
setContent(text) {
|
|
40
|
+
this._text = text;
|
|
41
|
+
if (!this._timer)
|
|
42
|
+
this._timer = setTimeout(() => this.flush(), 250);
|
|
43
|
+
}
|
|
44
|
+
flush() {
|
|
45
|
+
if (this._timer) {
|
|
46
|
+
clearTimeout(this._timer);
|
|
47
|
+
this._timer = void 0;
|
|
48
|
+
}
|
|
49
|
+
if (this._text)
|
|
50
|
+
import_fs.default.writeFileSync(this._file, this._text);
|
|
51
|
+
this._text = void 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
ThrottledFile
|
|
57
|
+
});
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var recorder_exports = {};
|
|
30
|
+
__export(recorder_exports, {
|
|
31
|
+
Recorder: () => Recorder
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(recorder_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var consoleApiSource = __toESM(require("../generated/consoleApiSource"));
|
|
36
|
+
var import_utils = require("../utils");
|
|
37
|
+
var import_browserContext = require("./browserContext");
|
|
38
|
+
var import_debugger = require("./debugger");
|
|
39
|
+
var import_contextRecorder = require("./recorder/contextRecorder");
|
|
40
|
+
var import_recorderUtils = require("./recorder/recorderUtils");
|
|
41
|
+
var import_locatorParser = require("../utils/isomorphic/locatorParser");
|
|
42
|
+
var import_selectorParser = require("../utils/isomorphic/selectorParser");
|
|
43
|
+
const recorderSymbol = Symbol("recorderSymbol");
|
|
44
|
+
class Recorder {
|
|
45
|
+
constructor(context, params) {
|
|
46
|
+
this._highlightedElement = {};
|
|
47
|
+
this._overlayState = { offsetX: 0 };
|
|
48
|
+
this._recorderApp = null;
|
|
49
|
+
this._currentCallsMetadata = /* @__PURE__ */ new Map();
|
|
50
|
+
this._recorderSources = [];
|
|
51
|
+
this._userSources = /* @__PURE__ */ new Map();
|
|
52
|
+
this._omitCallTracking = false;
|
|
53
|
+
this._mode = params.mode || "none";
|
|
54
|
+
this.handleSIGINT = params.handleSIGINT;
|
|
55
|
+
this._contextRecorder = new import_contextRecorder.ContextRecorder(context, params, {});
|
|
56
|
+
this._context = context;
|
|
57
|
+
this._omitCallTracking = !!params.omitCallTracking;
|
|
58
|
+
this._debugger = context.debugger();
|
|
59
|
+
context.instrumentation.addListener(this, context);
|
|
60
|
+
this._currentLanguage = this._contextRecorder.languageName();
|
|
61
|
+
if ((0, import_utils.isUnderTest)()) {
|
|
62
|
+
this._overlayState.offsetX = 200;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
static async showInspector(context, params, recorderAppFactory) {
|
|
66
|
+
if ((0, import_utils.isUnderTest)())
|
|
67
|
+
params.language = process.env.TEST_INSPECTOR_LANGUAGE;
|
|
68
|
+
return await Recorder.show(context, recorderAppFactory, params);
|
|
69
|
+
}
|
|
70
|
+
static showInspectorNoReply(context, recorderAppFactory) {
|
|
71
|
+
Recorder.showInspector(context, {}, recorderAppFactory).catch(() => {
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
static show(context, recorderAppFactory, params) {
|
|
75
|
+
let recorderPromise = context[recorderSymbol];
|
|
76
|
+
if (!recorderPromise) {
|
|
77
|
+
recorderPromise = Recorder._create(context, recorderAppFactory, params);
|
|
78
|
+
context[recorderSymbol] = recorderPromise;
|
|
79
|
+
}
|
|
80
|
+
return recorderPromise;
|
|
81
|
+
}
|
|
82
|
+
static async _create(context, recorderAppFactory, params = {}) {
|
|
83
|
+
const recorder = new Recorder(context, params);
|
|
84
|
+
const recorderApp = await recorderAppFactory(recorder);
|
|
85
|
+
await recorder._install(recorderApp);
|
|
86
|
+
return recorder;
|
|
87
|
+
}
|
|
88
|
+
async _install(recorderApp) {
|
|
89
|
+
this._recorderApp = recorderApp;
|
|
90
|
+
recorderApp.once("close", () => {
|
|
91
|
+
this._debugger.resume(false);
|
|
92
|
+
this._recorderApp = null;
|
|
93
|
+
});
|
|
94
|
+
recorderApp.on("event", (data) => {
|
|
95
|
+
if (data.event === "setMode") {
|
|
96
|
+
this.setMode(data.params.mode);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (data.event === "highlightRequested") {
|
|
100
|
+
if (data.params.selector)
|
|
101
|
+
this.setHighlightedSelector(this._currentLanguage, data.params.selector);
|
|
102
|
+
if (data.params.ariaTemplate)
|
|
103
|
+
this.setHighlightedAriaTemplate(data.params.ariaTemplate);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (data.event === "step") {
|
|
107
|
+
this._debugger.resume(true);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (data.event === "fileChanged") {
|
|
111
|
+
this._currentLanguage = this._contextRecorder.languageName(data.params.file);
|
|
112
|
+
this._refreshOverlay();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (data.event === "resume") {
|
|
116
|
+
this._debugger.resume(false);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (data.event === "pause") {
|
|
120
|
+
this._debugger.pauseOnNextStatement();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (data.event === "clear") {
|
|
124
|
+
this._contextRecorder.clearScript();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (data.event === "runTask") {
|
|
128
|
+
this._contextRecorder.runTask(data.params.task);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
await Promise.all([
|
|
133
|
+
recorderApp.setMode(this._mode),
|
|
134
|
+
recorderApp.setPaused(this._debugger.isPaused()),
|
|
135
|
+
this._pushAllSources()
|
|
136
|
+
]);
|
|
137
|
+
this._context.once(import_browserContext.BrowserContext.Events.Close, () => {
|
|
138
|
+
this._contextRecorder.dispose();
|
|
139
|
+
this._context.instrumentation.removeListener(this);
|
|
140
|
+
this._recorderApp?.close().catch(() => {
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
this._contextRecorder.on(import_contextRecorder.ContextRecorder.Events.Change, (data) => {
|
|
144
|
+
this._recorderSources = data.sources;
|
|
145
|
+
recorderApp.setActions(data.actions, data.sources);
|
|
146
|
+
recorderApp.setRunningFile(void 0);
|
|
147
|
+
this._pushAllSources();
|
|
148
|
+
});
|
|
149
|
+
await this._context.exposeBinding("__pw_recorderState", false, async (source) => {
|
|
150
|
+
let actionSelector;
|
|
151
|
+
let actionPoint;
|
|
152
|
+
const hasActiveScreenshotCommand = [...this._currentCallsMetadata.keys()].some(isScreenshotCommand);
|
|
153
|
+
if (!hasActiveScreenshotCommand) {
|
|
154
|
+
actionSelector = await this._scopeHighlightedSelectorToFrame(source.frame);
|
|
155
|
+
for (const [metadata, sdkObject] of this._currentCallsMetadata) {
|
|
156
|
+
if (source.page === sdkObject.attribution.page) {
|
|
157
|
+
actionPoint = metadata.point || actionPoint;
|
|
158
|
+
actionSelector = actionSelector || metadata.params.selector;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const uiState = {
|
|
163
|
+
mode: this._mode,
|
|
164
|
+
actionPoint,
|
|
165
|
+
actionSelector,
|
|
166
|
+
ariaTemplate: this._highlightedElement.ariaTemplate,
|
|
167
|
+
language: this._currentLanguage,
|
|
168
|
+
testIdAttributeName: this._contextRecorder.testIdAttributeName(),
|
|
169
|
+
overlay: this._overlayState
|
|
170
|
+
};
|
|
171
|
+
return uiState;
|
|
172
|
+
});
|
|
173
|
+
await this._context.exposeBinding("__pw_recorderElementPicked", false, async ({ frame }, elementInfo) => {
|
|
174
|
+
const selectorChain = await (0, import_contextRecorder.generateFrameSelector)(frame);
|
|
175
|
+
await this._recorderApp?.elementPicked({ selector: (0, import_recorderUtils.buildFullSelector)(selectorChain, elementInfo.selector), ariaSnapshot: elementInfo.ariaSnapshot }, true);
|
|
176
|
+
});
|
|
177
|
+
await this._context.exposeBinding("__pw_recorderSetMode", false, async ({ frame }, mode) => {
|
|
178
|
+
if (frame.parentFrame())
|
|
179
|
+
return;
|
|
180
|
+
this.setMode(mode);
|
|
181
|
+
});
|
|
182
|
+
await this._context.exposeBinding("__pw_recorderSetOverlayState", false, async ({ frame }, state) => {
|
|
183
|
+
if (frame.parentFrame())
|
|
184
|
+
return;
|
|
185
|
+
this._overlayState = state;
|
|
186
|
+
});
|
|
187
|
+
await this._context.exposeBinding("__pw_resume", false, () => {
|
|
188
|
+
this._debugger.resume(false);
|
|
189
|
+
});
|
|
190
|
+
await this._context.extendInjectedScript(consoleApiSource.source);
|
|
191
|
+
await this._contextRecorder.install();
|
|
192
|
+
if (this._debugger.isPaused())
|
|
193
|
+
this._pausedStateChanged();
|
|
194
|
+
this._debugger.on(import_debugger.Debugger.Events.PausedStateChanged, () => this._pausedStateChanged());
|
|
195
|
+
this._context.recorderAppForTest = this._recorderApp;
|
|
196
|
+
}
|
|
197
|
+
_pausedStateChanged() {
|
|
198
|
+
for (const { metadata, sdkObject } of this._debugger.pausedDetails()) {
|
|
199
|
+
if (!this._currentCallsMetadata.has(metadata))
|
|
200
|
+
this.onBeforeCall(sdkObject, metadata);
|
|
201
|
+
}
|
|
202
|
+
this._recorderApp?.setPaused(this._debugger.isPaused());
|
|
203
|
+
this._updateUserSources();
|
|
204
|
+
this.updateCallLog([...this._currentCallsMetadata.keys()]);
|
|
205
|
+
}
|
|
206
|
+
setMode(mode) {
|
|
207
|
+
if (this._mode === mode)
|
|
208
|
+
return;
|
|
209
|
+
this._highlightedElement = {};
|
|
210
|
+
this._mode = mode;
|
|
211
|
+
this._recorderApp?.setMode(this._mode);
|
|
212
|
+
this._contextRecorder.setEnabled(this._isRecording());
|
|
213
|
+
this._debugger.setMuted(this._isRecording());
|
|
214
|
+
if (this._mode !== "none" && this._mode !== "standby" && this._context.pages().length === 1)
|
|
215
|
+
this._context.pages()[0].bringToFront().catch(() => {
|
|
216
|
+
});
|
|
217
|
+
this._refreshOverlay();
|
|
218
|
+
}
|
|
219
|
+
resume() {
|
|
220
|
+
this._debugger.resume(false);
|
|
221
|
+
}
|
|
222
|
+
mode() {
|
|
223
|
+
return this._mode;
|
|
224
|
+
}
|
|
225
|
+
setHighlightedSelector(language, selector) {
|
|
226
|
+
this._highlightedElement = { selector: (0, import_locatorParser.locatorOrSelectorAsSelector)(language, selector, this._context.selectors().testIdAttributeName()) };
|
|
227
|
+
this._refreshOverlay();
|
|
228
|
+
}
|
|
229
|
+
setHighlightedAriaTemplate(ariaTemplate) {
|
|
230
|
+
this._highlightedElement = { ariaTemplate };
|
|
231
|
+
this._refreshOverlay();
|
|
232
|
+
}
|
|
233
|
+
hideHighlightedSelector() {
|
|
234
|
+
this._highlightedElement = {};
|
|
235
|
+
this._refreshOverlay();
|
|
236
|
+
}
|
|
237
|
+
async _scopeHighlightedSelectorToFrame(frame) {
|
|
238
|
+
if (!this._highlightedElement.selector)
|
|
239
|
+
return;
|
|
240
|
+
try {
|
|
241
|
+
const mainFrame = frame._page.mainFrame();
|
|
242
|
+
const resolved = await mainFrame.selectors.resolveFrameForSelector(this._highlightedElement.selector);
|
|
243
|
+
if (!resolved)
|
|
244
|
+
return "";
|
|
245
|
+
if (resolved?.frame === mainFrame)
|
|
246
|
+
return (0, import_selectorParser.stringifySelector)(resolved.info.parsed);
|
|
247
|
+
if (resolved?.frame === frame)
|
|
248
|
+
return (0, import_selectorParser.stringifySelector)(resolved.info.parsed);
|
|
249
|
+
return "";
|
|
250
|
+
} catch {
|
|
251
|
+
return "";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
setOutput(codegenId, outputFile) {
|
|
255
|
+
this._contextRecorder.setOutput(codegenId, outputFile);
|
|
256
|
+
}
|
|
257
|
+
_refreshOverlay() {
|
|
258
|
+
for (const page of this._context.pages()) {
|
|
259
|
+
for (const frame of page.frames())
|
|
260
|
+
frame.evaluateExpression("window.__pw_refreshOverlay()").catch(() => {
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async onBeforeCall(sdkObject, metadata) {
|
|
265
|
+
if (this._omitCallTracking || this._isRecording())
|
|
266
|
+
return;
|
|
267
|
+
this._currentCallsMetadata.set(metadata, sdkObject);
|
|
268
|
+
this._updateUserSources();
|
|
269
|
+
this.updateCallLog([metadata]);
|
|
270
|
+
if (isScreenshotCommand(metadata))
|
|
271
|
+
this.hideHighlightedSelector();
|
|
272
|
+
else if (metadata.params && metadata.params.selector)
|
|
273
|
+
this._highlightedElement = { selector: metadata.params.selector };
|
|
274
|
+
}
|
|
275
|
+
async onAfterCall(sdkObject, metadata) {
|
|
276
|
+
if (this._omitCallTracking || this._isRecording())
|
|
277
|
+
return;
|
|
278
|
+
if (!metadata.error)
|
|
279
|
+
this._currentCallsMetadata.delete(metadata);
|
|
280
|
+
this._updateUserSources();
|
|
281
|
+
this.updateCallLog([metadata]);
|
|
282
|
+
}
|
|
283
|
+
_updateUserSources() {
|
|
284
|
+
for (const source of this._userSources.values()) {
|
|
285
|
+
source.highlight = [];
|
|
286
|
+
source.revealLine = void 0;
|
|
287
|
+
}
|
|
288
|
+
let fileToSelect = void 0;
|
|
289
|
+
for (const metadata of this._currentCallsMetadata.keys()) {
|
|
290
|
+
if (!metadata.location)
|
|
291
|
+
continue;
|
|
292
|
+
const { file, line } = metadata.location;
|
|
293
|
+
let source = this._userSources.get(file);
|
|
294
|
+
if (!source) {
|
|
295
|
+
source = { isRecorded: false, label: file, id: file, text: this._readSource(file), highlight: [], language: languageForFile(file) };
|
|
296
|
+
this._userSources.set(file, source);
|
|
297
|
+
}
|
|
298
|
+
if (line) {
|
|
299
|
+
const paused = this._debugger.isPaused(metadata);
|
|
300
|
+
source.highlight.push({ line, type: metadata.error ? "error" : paused ? "paused" : "running" });
|
|
301
|
+
source.revealLine = line;
|
|
302
|
+
fileToSelect = source.id;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
this._pushAllSources();
|
|
306
|
+
if (fileToSelect)
|
|
307
|
+
this._recorderApp?.setRunningFile(fileToSelect);
|
|
308
|
+
}
|
|
309
|
+
_pushAllSources() {
|
|
310
|
+
const primaryPage = this._context.pages()[0];
|
|
311
|
+
this._recorderApp?.setSources([...this._recorderSources, ...this._userSources.values()], primaryPage?.mainFrame().url());
|
|
312
|
+
}
|
|
313
|
+
async onBeforeInputAction(sdkObject, metadata) {
|
|
314
|
+
}
|
|
315
|
+
async onCallLog(sdkObject, metadata, logName, message) {
|
|
316
|
+
this.updateCallLog([metadata]);
|
|
317
|
+
}
|
|
318
|
+
updateCallLog(metadatas) {
|
|
319
|
+
if (this._isRecording())
|
|
320
|
+
return;
|
|
321
|
+
const logs = [];
|
|
322
|
+
for (const metadata of metadatas) {
|
|
323
|
+
if (!metadata.method || metadata.internal)
|
|
324
|
+
continue;
|
|
325
|
+
let status = "done";
|
|
326
|
+
if (this._currentCallsMetadata.has(metadata))
|
|
327
|
+
status = "in-progress";
|
|
328
|
+
if (this._debugger.isPaused(metadata))
|
|
329
|
+
status = "paused";
|
|
330
|
+
logs.push((0, import_recorderUtils.metadataToCallLog)(metadata, status));
|
|
331
|
+
}
|
|
332
|
+
this._recorderApp?.updateCallLogs(logs);
|
|
333
|
+
}
|
|
334
|
+
_isRecording() {
|
|
335
|
+
return ["recording", "assertingText", "assertingVisibility", "assertingValue", "assertingSnapshot"].includes(this._mode);
|
|
336
|
+
}
|
|
337
|
+
_readSource(fileName) {
|
|
338
|
+
try {
|
|
339
|
+
return import_fs.default.readFileSync(fileName, "utf-8");
|
|
340
|
+
} catch (e) {
|
|
341
|
+
return "// No source available";
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function isScreenshotCommand(metadata) {
|
|
346
|
+
return metadata.method.toLowerCase().includes("screenshot");
|
|
347
|
+
}
|
|
348
|
+
function languageForFile(file) {
|
|
349
|
+
if (file.endsWith(".py"))
|
|
350
|
+
return "python";
|
|
351
|
+
if (file.endsWith(".java"))
|
|
352
|
+
return "java";
|
|
353
|
+
if (file.endsWith(".cs"))
|
|
354
|
+
return "csharp";
|
|
355
|
+
return "javascript";
|
|
356
|
+
}
|
|
357
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
358
|
+
0 && (module.exports = {
|
|
359
|
+
Recorder
|
|
360
|
+
});
|