patchright 1.48.0__py3-none-win32.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 +17 -0
- patchright/_impl/__pyinstaller/hook-playwright.sync_api.py +17 -0
- patchright/_impl/_accessibility.py +50 -0
- patchright/_impl/_api_structures.py +271 -0
- patchright/_impl/_artifact.py +45 -0
- patchright/_impl/_assertions.py +779 -0
- patchright/_impl/_async_base.py +92 -0
- patchright/_impl/_browser.py +243 -0
- patchright/_impl/_browser_context.py +724 -0
- patchright/_impl/_browser_type.py +264 -0
- patchright/_impl/_cdp_session.py +21 -0
- patchright/_impl/_clock.py +57 -0
- patchright/_impl/_connection.py +554 -0
- patchright/_impl/_console_message.py +45 -0
- patchright/_impl/_dialog.py +40 -0
- patchright/_impl/_download.py +50 -0
- patchright/_impl/_driver.py +26 -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 +511 -0
- patchright/_impl/_file_chooser.py +43 -0
- patchright/_impl/_frame.py +755 -0
- patchright/_impl/_glob.py +51 -0
- patchright/_impl/_greenlets.py +39 -0
- patchright/_impl/_har_router.py +99 -0
- patchright/_impl/_helper.py +421 -0
- patchright/_impl/_impl_to_api_mapping.py +123 -0
- patchright/_impl/_input.py +71 -0
- patchright/_impl/_js_handle.py +234 -0
- patchright/_impl/_json_pipe.py +56 -0
- patchright/_impl/_local_utils.py +73 -0
- patchright/_impl/_locator.py +784 -0
- patchright/_impl/_map.py +19 -0
- patchright/_impl/_network.py +934 -0
- patchright/_impl/_object_factory.py +91 -0
- patchright/_impl/_page.py +1446 -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 +103 -0
- patchright/_impl/_transport.py +150 -0
- patchright/_impl/_video.py +57 -0
- patchright/_impl/_waiter.py +142 -0
- patchright/_impl/_web_error.py +22 -0
- patchright/_impl/_writable_stream.py +27 -0
- patchright/_repo_version.py +12 -0
- patchright/async_api/__init__.py +177 -0
- patchright/async_api/_context_manager.py +39 -0
- patchright/async_api/_generated.py +19960 -0
- patchright/driver/LICENSE +2174 -0
- patchright/driver/README.md +1 -0
- patchright/driver/node.exe +0 -0
- patchright/driver/package/README.md +3 -0
- patchright/driver/package/ThirdPartyNotices.txt +1548 -0
- patchright/driver/package/api.json +1 -0
- patchright/driver/package/bin/PrintDeps.exe +0 -0
- patchright/driver/package/bin/README.md +2 -0
- patchright/driver/package/bin/install_media_pack.ps1 +5 -0
- patchright/driver/package/bin/reinstall_chrome_beta_linux.sh +40 -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 +40 -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 +40 -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 +40 -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 +40 -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 +57 -0
- patchright/driver/package/cli.js +18 -0
- patchright/driver/package/index.d.ts +17 -0
- patchright/driver/package/index.js +33 -0
- patchright/driver/package/index.mjs +28 -0
- patchright/driver/package/lib/androidServerImpl.js +69 -0
- patchright/driver/package/lib/browserServerImpl.js +92 -0
- patchright/driver/package/lib/cli/driver.js +95 -0
- patchright/driver/package/lib/cli/program.js +587 -0
- patchright/driver/package/lib/cli/programWithTestStub.js +67 -0
- patchright/driver/package/lib/client/accessibility.js +50 -0
- patchright/driver/package/lib/client/android.js +473 -0
- patchright/driver/package/lib/client/api.js +285 -0
- patchright/driver/package/lib/client/artifact.js +79 -0
- patchright/driver/package/lib/client/browser.js +145 -0
- patchright/driver/package/lib/client/browserContext.js +559 -0
- patchright/driver/package/lib/client/browserType.js +241 -0
- patchright/driver/package/lib/client/cdpSession.js +53 -0
- patchright/driver/package/lib/client/channelOwner.js +235 -0
- patchright/driver/package/lib/client/clientHelper.js +57 -0
- patchright/driver/package/lib/client/clientInstrumentation.js +50 -0
- patchright/driver/package/lib/client/clock.js +68 -0
- patchright/driver/package/lib/client/connection.js +333 -0
- patchright/driver/package/lib/client/consoleMessage.js +55 -0
- patchright/driver/package/lib/client/coverage.js +41 -0
- patchright/driver/package/lib/client/dialog.js +57 -0
- patchright/driver/package/lib/client/download.js +62 -0
- patchright/driver/package/lib/client/electron.js +135 -0
- patchright/driver/package/lib/client/elementHandle.js +321 -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 +94 -0
- patchright/driver/package/lib/client/fetch.js +391 -0
- patchright/driver/package/lib/client/fileChooser.js +45 -0
- patchright/driver/package/lib/client/frame.js +504 -0
- patchright/driver/package/lib/client/harRouter.js +99 -0
- patchright/driver/package/lib/client/input.js +111 -0
- patchright/driver/package/lib/client/jsHandle.js +121 -0
- patchright/driver/package/lib/client/jsonPipe.js +35 -0
- patchright/driver/package/lib/client/localUtils.js +36 -0
- patchright/driver/package/lib/client/locator.js +441 -0
- patchright/driver/package/lib/client/network.js +762 -0
- patchright/driver/package/lib/client/page.js +746 -0
- patchright/driver/package/lib/client/playwright.js +80 -0
- patchright/driver/package/lib/client/selectors.js +67 -0
- patchright/driver/package/lib/client/stream.js +54 -0
- patchright/driver/package/lib/client/tracing.js +134 -0
- patchright/driver/package/lib/client/types.js +24 -0
- patchright/driver/package/lib/client/video.js +51 -0
- patchright/driver/package/lib/client/waiter.js +158 -0
- patchright/driver/package/lib/client/webError.js +37 -0
- patchright/driver/package/lib/client/worker.js +71 -0
- patchright/driver/package/lib/client/writableStream.js +54 -0
- patchright/driver/package/lib/common/socksProxy.js +569 -0
- patchright/driver/package/lib/common/timeoutSettings.js +73 -0
- patchright/driver/package/lib/common/types.js +5 -0
- patchright/driver/package/lib/generated/clockSource.js +7 -0
- patchright/driver/package/lib/generated/consoleApiSource.js +7 -0
- patchright/driver/package/lib/generated/injectedScriptSource.js +7 -0
- patchright/driver/package/lib/generated/pollingRecorderSource.js +7 -0
- patchright/driver/package/lib/generated/utilityScriptSource.js +7 -0
- patchright/driver/package/lib/generated/webSocketMockSource.js +7 -0
- patchright/driver/package/lib/image_tools/colorUtils.js +98 -0
- patchright/driver/package/lib/image_tools/compare.js +108 -0
- patchright/driver/package/lib/image_tools/imageChannel.js +70 -0
- patchright/driver/package/lib/image_tools/stats.js +102 -0
- patchright/driver/package/lib/inProcessFactory.js +54 -0
- patchright/driver/package/lib/inprocess.js +20 -0
- patchright/driver/package/lib/outofprocess.js +67 -0
- patchright/driver/package/lib/protocol/debug.js +27 -0
- patchright/driver/package/lib/protocol/serializers.js +173 -0
- patchright/driver/package/lib/protocol/transport.js +82 -0
- patchright/driver/package/lib/protocol/validator.js +2759 -0
- patchright/driver/package/lib/protocol/validatorPrimitives.js +139 -0
- patchright/driver/package/lib/remote/playwrightConnection.js +274 -0
- patchright/driver/package/lib/remote/playwrightServer.js +110 -0
- patchright/driver/package/lib/server/accessibility.js +62 -0
- patchright/driver/package/lib/server/android/android.js +441 -0
- patchright/driver/package/lib/server/android/backendAdb.js +172 -0
- patchright/driver/package/lib/server/artifact.js +104 -0
- patchright/driver/package/lib/server/bidi/bidiBrowser.js +311 -0
- patchright/driver/package/lib/server/bidi/bidiChromium.js +124 -0
- patchright/driver/package/lib/server/bidi/bidiConnection.js +206 -0
- patchright/driver/package/lib/server/bidi/bidiExecutionContext.js +159 -0
- patchright/driver/package/lib/server/bidi/bidiFirefox.js +104 -0
- patchright/driver/package/lib/server/bidi/bidiInput.js +158 -0
- patchright/driver/package/lib/server/bidi/bidiNetworkManager.js +338 -0
- patchright/driver/package/lib/server/bidi/bidiOverCdp.js +103 -0
- patchright/driver/package/lib/server/bidi/bidiPage.js +529 -0
- patchright/driver/package/lib/server/bidi/bidiPdf.js +140 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiDeserializer.js +93 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiKeyboard.js +238 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiProtocol.js +139 -0
- patchright/driver/package/lib/server/bidi/third_party/bidiSerializer.js +144 -0
- patchright/driver/package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
- patchright/driver/package/lib/server/browser.js +148 -0
- patchright/driver/package/lib/server/browserContext.js +666 -0
- patchright/driver/package/lib/server/browserType.js +335 -0
- patchright/driver/package/lib/server/chromium/appIcon.png +0 -0
- patchright/driver/package/lib/server/chromium/chromium.js +350 -0
- patchright/driver/package/lib/server/chromium/chromiumSwitches.js +36 -0
- patchright/driver/package/lib/server/chromium/crAccessibility.js +237 -0
- patchright/driver/package/lib/server/chromium/crBrowser.js +522 -0
- patchright/driver/package/lib/server/chromium/crConnection.js +228 -0
- patchright/driver/package/lib/server/chromium/crCoverage.js +246 -0
- patchright/driver/package/lib/server/chromium/crDevTools.js +104 -0
- patchright/driver/package/lib/server/chromium/crDragDrop.js +143 -0
- patchright/driver/package/lib/server/chromium/crExecutionContext.js +149 -0
- patchright/driver/package/lib/server/chromium/crInput.js +171 -0
- patchright/driver/package/lib/server/chromium/crNetworkManager.js +809 -0
- patchright/driver/package/lib/server/chromium/crPage.js +1235 -0
- patchright/driver/package/lib/server/chromium/crPdf.js +153 -0
- patchright/driver/package/lib/server/chromium/crProtocolHelper.js +133 -0
- patchright/driver/package/lib/server/chromium/crServiceWorker.js +111 -0
- patchright/driver/package/lib/server/chromium/defaultFontFamilies.js +145 -0
- patchright/driver/package/lib/server/chromium/videoRecorder.js +155 -0
- patchright/driver/package/lib/server/clock.js +133 -0
- patchright/driver/package/lib/server/codegen/csharp.js +299 -0
- patchright/driver/package/lib/server/codegen/java.js +235 -0
- patchright/driver/package/lib/server/codegen/javascript.js +223 -0
- patchright/driver/package/lib/server/codegen/jsonl.js +47 -0
- patchright/driver/package/lib/server/codegen/language.js +88 -0
- patchright/driver/package/lib/server/codegen/languages.js +30 -0
- patchright/driver/package/lib/server/codegen/python.js +265 -0
- patchright/driver/package/lib/server/codegen/types.js +5 -0
- patchright/driver/package/lib/server/console.js +57 -0
- patchright/driver/package/lib/server/cookieStore.js +185 -0
- patchright/driver/package/lib/server/debugController.js +234 -0
- patchright/driver/package/lib/server/debugger.js +132 -0
- patchright/driver/package/lib/server/deviceDescriptors.js +26 -0
- patchright/driver/package/lib/server/deviceDescriptorsSource.json +1669 -0
- patchright/driver/package/lib/server/dialog.js +71 -0
- patchright/driver/package/lib/server/dispatchers/androidDispatcher.js +193 -0
- patchright/driver/package/lib/server/dispatchers/artifactDispatcher.js +118 -0
- patchright/driver/package/lib/server/dispatchers/browserContextDispatcher.js +368 -0
- patchright/driver/package/lib/server/dispatchers/browserDispatcher.js +170 -0
- patchright/driver/package/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
- patchright/driver/package/lib/server/dispatchers/cdpSessionDispatcher.js +48 -0
- patchright/driver/package/lib/server/dispatchers/debugControllerDispatcher.js +103 -0
- patchright/driver/package/lib/server/dispatchers/dialogDispatcher.js +44 -0
- patchright/driver/package/lib/server/dispatchers/dispatcher.js +395 -0
- patchright/driver/package/lib/server/dispatchers/electronDispatcher.js +93 -0
- patchright/driver/package/lib/server/dispatchers/elementHandlerDispatcher.js +228 -0
- patchright/driver/package/lib/server/dispatchers/frameDispatcher.js +286 -0
- patchright/driver/package/lib/server/dispatchers/jsHandleDispatcher.js +97 -0
- patchright/driver/package/lib/server/dispatchers/jsonPipeDispatcher.js +59 -0
- patchright/driver/package/lib/server/dispatchers/localUtilsDispatcher.js +413 -0
- patchright/driver/package/lib/server/dispatchers/networkDispatchers.js +221 -0
- patchright/driver/package/lib/server/dispatchers/pageDispatcher.js +367 -0
- patchright/driver/package/lib/server/dispatchers/playwrightDispatcher.js +107 -0
- patchright/driver/package/lib/server/dispatchers/selectorsDispatcher.js +36 -0
- patchright/driver/package/lib/server/dispatchers/streamDispatcher.js +62 -0
- patchright/driver/package/lib/server/dispatchers/tracingDispatcher.js +54 -0
- patchright/driver/package/lib/server/dispatchers/webSocketRouteDispatcher.js +189 -0
- patchright/driver/package/lib/server/dispatchers/writableStreamDispatcher.js +58 -0
- patchright/driver/package/lib/server/dom.js +845 -0
- patchright/driver/package/lib/server/download.js +60 -0
- patchright/driver/package/lib/server/electron/electron.js +296 -0
- patchright/driver/package/lib/server/electron/loader.js +57 -0
- patchright/driver/package/lib/server/errors.js +68 -0
- patchright/driver/package/lib/server/fetch.js +656 -0
- patchright/driver/package/lib/server/fileChooser.js +42 -0
- patchright/driver/package/lib/server/fileUploadUtils.js +75 -0
- patchright/driver/package/lib/server/firefox/ffAccessibility.js +216 -0
- patchright/driver/package/lib/server/firefox/ffBrowser.js +460 -0
- patchright/driver/package/lib/server/firefox/ffConnection.js +168 -0
- patchright/driver/package/lib/server/firefox/ffExecutionContext.js +135 -0
- patchright/driver/package/lib/server/firefox/ffInput.js +150 -0
- patchright/driver/package/lib/server/firefox/ffNetworkManager.js +233 -0
- patchright/driver/package/lib/server/firefox/ffPage.js +559 -0
- patchright/driver/package/lib/server/firefox/firefox.js +99 -0
- patchright/driver/package/lib/server/formData.js +75 -0
- patchright/driver/package/lib/server/frameSelectors.js +171 -0
- patchright/driver/package/lib/server/frames.js +1808 -0
- patchright/driver/package/lib/server/har/harRecorder.js +139 -0
- patchright/driver/package/lib/server/har/harTracer.js +542 -0
- patchright/driver/package/lib/server/helper.js +103 -0
- patchright/driver/package/lib/server/index.js +114 -0
- patchright/driver/package/lib/server/input.js +310 -0
- patchright/driver/package/lib/server/instrumentation.js +70 -0
- patchright/driver/package/lib/server/isomorphic/utilityScriptSerializers.js +226 -0
- patchright/driver/package/lib/server/javascript.js +299 -0
- patchright/driver/package/lib/server/launchApp.js +91 -0
- patchright/driver/package/lib/server/macEditingCommands.js +139 -0
- patchright/driver/package/lib/server/network.js +617 -0
- patchright/driver/package/lib/server/page.js +819 -0
- patchright/driver/package/lib/server/pipeTransport.js +85 -0
- patchright/driver/package/lib/server/playwright.js +88 -0
- patchright/driver/package/lib/server/progress.js +102 -0
- patchright/driver/package/lib/server/protocolError.js +49 -0
- patchright/driver/package/lib/server/recorder/contextRecorder.js +299 -0
- patchright/driver/package/lib/server/recorder/recorderApp.js +196 -0
- patchright/driver/package/lib/server/recorder/recorderCollection.js +116 -0
- patchright/driver/package/lib/server/recorder/recorderFrontend.js +5 -0
- patchright/driver/package/lib/server/recorder/recorderInTraceViewer.js +144 -0
- patchright/driver/package/lib/server/recorder/recorderRunner.js +155 -0
- patchright/driver/package/lib/server/recorder/recorderUtils.js +112 -0
- patchright/driver/package/lib/server/recorder/throttledFile.js +46 -0
- patchright/driver/package/lib/server/recorder.js +327 -0
- patchright/driver/package/lib/server/registry/browserFetcher.js +168 -0
- patchright/driver/package/lib/server/registry/dependencies.js +322 -0
- patchright/driver/package/lib/server/registry/index.js +1005 -0
- patchright/driver/package/lib/server/registry/nativeDeps.js +490 -0
- patchright/driver/package/lib/server/registry/oopDownloadBrowserMain.js +138 -0
- patchright/driver/package/lib/server/screenshotter.js +348 -0
- patchright/driver/package/lib/server/selectors.js +73 -0
- patchright/driver/package/lib/server/socksClientCertificatesInterceptor.js +340 -0
- patchright/driver/package/lib/server/socksInterceptor.js +100 -0
- patchright/driver/package/lib/server/trace/recorder/snapshotter.js +172 -0
- patchright/driver/package/lib/server/trace/recorder/snapshotterInjected.js +493 -0
- patchright/driver/package/lib/server/trace/recorder/tracing.js +542 -0
- patchright/driver/package/lib/server/trace/test/inMemorySnapshotter.js +93 -0
- patchright/driver/package/lib/server/trace/viewer/traceViewer.js +213 -0
- patchright/driver/package/lib/server/transport.js +191 -0
- patchright/driver/package/lib/server/types.js +24 -0
- patchright/driver/package/lib/server/usKeyboardLayout.js +555 -0
- patchright/driver/package/lib/server/webkit/webkit.js +87 -0
- patchright/driver/package/lib/server/webkit/wkAccessibility.js +194 -0
- patchright/driver/package/lib/server/webkit/wkBrowser.js +329 -0
- patchright/driver/package/lib/server/webkit/wkConnection.js +173 -0
- patchright/driver/package/lib/server/webkit/wkExecutionContext.js +143 -0
- patchright/driver/package/lib/server/webkit/wkInput.js +169 -0
- patchright/driver/package/lib/server/webkit/wkInterceptableRequest.js +162 -0
- patchright/driver/package/lib/server/webkit/wkPage.js +1219 -0
- patchright/driver/package/lib/server/webkit/wkProvisionalPage.js +94 -0
- patchright/driver/package/lib/server/webkit/wkWorkers.js +104 -0
- patchright/driver/package/lib/third_party/diff_match_patch.js +2222 -0
- patchright/driver/package/lib/third_party/pixelmatch.js +255 -0
- patchright/driver/package/lib/utils/ascii.js +31 -0
- patchright/driver/package/lib/utils/comparators.js +171 -0
- patchright/driver/package/lib/utils/crypto.js +174 -0
- patchright/driver/package/lib/utils/debug.js +46 -0
- patchright/driver/package/lib/utils/debugLogger.js +91 -0
- patchright/driver/package/lib/utils/env.js +49 -0
- patchright/driver/package/lib/utils/eventsHelper.js +38 -0
- patchright/driver/package/lib/utils/expectUtils.js +33 -0
- patchright/driver/package/lib/utils/fileUtils.js +205 -0
- patchright/driver/package/lib/utils/happy-eyeballs.js +194 -0
- patchright/driver/package/lib/utils/headers.js +52 -0
- patchright/driver/package/lib/utils/hostPlatform.js +133 -0
- patchright/driver/package/lib/utils/httpServer.js +237 -0
- patchright/driver/package/lib/utils/index.js +368 -0
- patchright/driver/package/lib/utils/isomorphic/cssParser.js +250 -0
- patchright/driver/package/lib/utils/isomorphic/cssTokenizer.js +979 -0
- patchright/driver/package/lib/utils/isomorphic/locatorGenerators.js +642 -0
- patchright/driver/package/lib/utils/isomorphic/locatorParser.js +179 -0
- patchright/driver/package/lib/utils/isomorphic/locatorUtils.js +62 -0
- patchright/driver/package/lib/utils/isomorphic/mimeType.js +29 -0
- patchright/driver/package/lib/utils/isomorphic/recorderUtils.js +195 -0
- patchright/driver/package/lib/utils/isomorphic/selectorParser.js +397 -0
- patchright/driver/package/lib/utils/isomorphic/stringUtils.js +139 -0
- patchright/driver/package/lib/utils/isomorphic/traceUtils.js +39 -0
- patchright/driver/package/lib/utils/isomorphic/urlMatch.js +120 -0
- patchright/driver/package/lib/utils/linuxUtils.js +78 -0
- patchright/driver/package/lib/utils/manualPromise.js +109 -0
- patchright/driver/package/lib/utils/multimap.js +75 -0
- patchright/driver/package/lib/utils/network.js +160 -0
- patchright/driver/package/lib/utils/processLauncher.js +248 -0
- patchright/driver/package/lib/utils/profiler.js +53 -0
- patchright/driver/package/lib/utils/rtti.js +44 -0
- patchright/driver/package/lib/utils/semaphore.js +51 -0
- patchright/driver/package/lib/utils/spawnAsync.js +45 -0
- patchright/driver/package/lib/utils/stackTrace.js +121 -0
- patchright/driver/package/lib/utils/task.js +58 -0
- patchright/driver/package/lib/utils/time.js +37 -0
- patchright/driver/package/lib/utils/timeoutRunner.js +66 -0
- patchright/driver/package/lib/utils/traceUtils.js +44 -0
- patchright/driver/package/lib/utils/userAgent.js +105 -0
- patchright/driver/package/lib/utils/wsServer.js +127 -0
- patchright/driver/package/lib/utils/zipFile.js +75 -0
- patchright/driver/package/lib/utils/zones.js +62 -0
- patchright/driver/package/lib/utilsBundle.js +82 -0
- patchright/driver/package/lib/utilsBundleImpl/index.js +53 -0
- patchright/driver/package/lib/utilsBundleImpl/xdg-open +1066 -0
- patchright/driver/package/lib/vite/htmlReport/index.html +66 -0
- patchright/driver/package/lib/vite/recorder/assets/codeMirrorModule-d0KhC1qL.js +24 -0
- patchright/driver/package/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +1 -0
- patchright/driver/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- patchright/driver/package/lib/vite/recorder/assets/index-BW-aOBcL.css +1 -0
- patchright/driver/package/lib/vite/recorder/assets/index-Bxxcmxlu.js +42 -0
- patchright/driver/package/lib/vite/recorder/index.html +29 -0
- patchright/driver/package/lib/vite/recorder/playwright-logo.svg +9 -0
- patchright/driver/package/lib/vite/traceViewer/assets/codeMirrorModule-CZTtn9l8.js +24 -0
- patchright/driver/package/lib/vite/traceViewer/assets/inspectorTab-DTusvprx.js +64 -0
- patchright/driver/package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +1 -0
- patchright/driver/package/lib/vite/traceViewer/assets/workbench-DIEjrm3Z.js +9 -0
- patchright/driver/package/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +9 -0
- patchright/driver/package/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +1 -0
- patchright/driver/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- patchright/driver/package/lib/vite/traceViewer/embedded.Do_J5Hgs.js +2 -0
- patchright/driver/package/lib/vite/traceViewer/embedded.html +18 -0
- patchright/driver/package/lib/vite/traceViewer/embedded.w7WN2u1R.css +1 -0
- patchright/driver/package/lib/vite/traceViewer/index.B21BXreT.js +2 -0
- patchright/driver/package/lib/vite/traceViewer/index.CrbWWHbf.css +1 -0
- patchright/driver/package/lib/vite/traceViewer/index.html +29 -0
- patchright/driver/package/lib/vite/traceViewer/inspectorTab.DLjBDrQR.css +1 -0
- patchright/driver/package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- patchright/driver/package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- patchright/driver/package/lib/vite/traceViewer/recorder.Bfh_9UGt.js +2 -0
- patchright/driver/package/lib/vite/traceViewer/recorder.html +17 -0
- patchright/driver/package/lib/vite/traceViewer/snapshot.html +21 -0
- patchright/driver/package/lib/vite/traceViewer/sw.bundle.js +3 -0
- patchright/driver/package/lib/vite/traceViewer/uiMode.CAYqod-m.css +1 -0
- patchright/driver/package/lib/vite/traceViewer/uiMode.DloKQa-h.js +5 -0
- patchright/driver/package/lib/vite/traceViewer/uiMode.html +20 -0
- patchright/driver/package/lib/vite/traceViewer/workbench.D3JVcA9K.css +1 -0
- patchright/driver/package/lib/vite/traceViewer/xtermModule.DSXBckUd.css +32 -0
- patchright/driver/package/lib/zipBundle.js +25 -0
- patchright/driver/package/lib/zipBundleImpl.js +5 -0
- patchright/driver/package/package.json +44 -0
- patchright/driver/package/protocol.yml +3720 -0
- patchright/driver/package/types/protocol.d.ts +21571 -0
- patchright/driver/package/types/structs.d.ts +45 -0
- patchright/driver/package/types/types.d.ts +22519 -0
- patchright/py.typed +0 -0
- patchright/sync_api/__init__.py +177 -0
- patchright/sync_api/_context_manager.py +74 -0
- patchright/sync_api/_generated.py +20155 -0
- patchright-1.48.0.dist-info/LICENSE +202 -0
- patchright-1.48.0.dist-info/METADATA +83 -0
- patchright-1.48.0.dist-info/RECORD +406 -0
- patchright-1.48.0.dist-info/WHEEL +5 -0
- patchright-1.48.0.dist-info/entry_points.txt +5 -0
- patchright-1.48.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.callMetadataForAction = callMetadataForAction;
|
|
7
|
+
exports.collapseActions = collapseActions;
|
|
8
|
+
exports.frameForAction = frameForAction;
|
|
9
|
+
exports.mainFrameForAction = mainFrameForAction;
|
|
10
|
+
exports.metadataToCallLog = metadataToCallLog;
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _recorderUtils = require("../../utils/isomorphic/recorderUtils");
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Microsoft Corporation.
|
|
15
|
+
*
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License.
|
|
18
|
+
* You may obtain a copy of the License at
|
|
19
|
+
*
|
|
20
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
* See the License for the specific language governing permissions and
|
|
26
|
+
* limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function metadataToCallLog(metadata, status) {
|
|
30
|
+
var _metadata$params, _metadata$params2, _metadata$error;
|
|
31
|
+
let title = metadata.apiName || metadata.method;
|
|
32
|
+
if (metadata.method === 'waitForEventInfo') title += `(${metadata.params.info.event})`;
|
|
33
|
+
title = title.replace('object.expect', 'expect');
|
|
34
|
+
if (metadata.error) status = 'error';
|
|
35
|
+
const params = {
|
|
36
|
+
url: (_metadata$params = metadata.params) === null || _metadata$params === void 0 ? void 0 : _metadata$params.url,
|
|
37
|
+
selector: (_metadata$params2 = metadata.params) === null || _metadata$params2 === void 0 ? void 0 : _metadata$params2.selector
|
|
38
|
+
};
|
|
39
|
+
let duration = metadata.endTime ? metadata.endTime - metadata.startTime : undefined;
|
|
40
|
+
if (typeof duration === 'number' && metadata.pauseStartTime && metadata.pauseEndTime) {
|
|
41
|
+
duration -= metadata.pauseEndTime - metadata.pauseStartTime;
|
|
42
|
+
duration = Math.max(duration, 0);
|
|
43
|
+
}
|
|
44
|
+
const callLog = {
|
|
45
|
+
id: metadata.id,
|
|
46
|
+
messages: metadata.log,
|
|
47
|
+
title,
|
|
48
|
+
status,
|
|
49
|
+
error: (_metadata$error = metadata.error) === null || _metadata$error === void 0 || (_metadata$error = _metadata$error.error) === null || _metadata$error === void 0 ? void 0 : _metadata$error.message,
|
|
50
|
+
params,
|
|
51
|
+
duration
|
|
52
|
+
};
|
|
53
|
+
return callLog;
|
|
54
|
+
}
|
|
55
|
+
function mainFrameForAction(pageAliases, actionInContext) {
|
|
56
|
+
var _find;
|
|
57
|
+
const pageAlias = actionInContext.frame.pageAlias;
|
|
58
|
+
const page = (_find = [...pageAliases.entries()].find(([, alias]) => pageAlias === alias)) === null || _find === void 0 ? void 0 : _find[0];
|
|
59
|
+
if (!page) throw new Error(`Internal error: page ${pageAlias} not found in [${[...pageAliases.values()]}]`);
|
|
60
|
+
return page.mainFrame();
|
|
61
|
+
}
|
|
62
|
+
async function frameForAction(pageAliases, actionInContext, action) {
|
|
63
|
+
var _find2;
|
|
64
|
+
const pageAlias = actionInContext.frame.pageAlias;
|
|
65
|
+
const page = (_find2 = [...pageAliases.entries()].find(([, alias]) => pageAlias === alias)) === null || _find2 === void 0 ? void 0 : _find2[0];
|
|
66
|
+
if (!page) throw new Error('Internal error: page not found');
|
|
67
|
+
const fullSelector = (0, _recorderUtils.buildFullSelector)(actionInContext.frame.framePath, action.selector);
|
|
68
|
+
const result = await page.mainFrame().selectors.resolveFrameForSelector(fullSelector);
|
|
69
|
+
if (!result) throw new Error('Internal error: frame not found');
|
|
70
|
+
return result.frame;
|
|
71
|
+
}
|
|
72
|
+
function callMetadataForAction(pageAliases, actionInContext) {
|
|
73
|
+
const mainFrame = mainFrameForAction(pageAliases, actionInContext);
|
|
74
|
+
const {
|
|
75
|
+
method,
|
|
76
|
+
params
|
|
77
|
+
} = (0, _recorderUtils.traceParamsForAction)(actionInContext);
|
|
78
|
+
const callMetadata = {
|
|
79
|
+
id: `call@${(0, _utils.createGuid)()}`,
|
|
80
|
+
apiName: 'page.' + method,
|
|
81
|
+
objectId: mainFrame.guid,
|
|
82
|
+
pageId: mainFrame._page.guid,
|
|
83
|
+
frameId: mainFrame.guid,
|
|
84
|
+
startTime: actionInContext.startTime,
|
|
85
|
+
endTime: 0,
|
|
86
|
+
type: 'Frame',
|
|
87
|
+
method,
|
|
88
|
+
params,
|
|
89
|
+
log: []
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
callMetadata,
|
|
93
|
+
mainFrame
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function collapseActions(actions) {
|
|
97
|
+
const result = [];
|
|
98
|
+
for (const action of actions) {
|
|
99
|
+
const lastAction = result[result.length - 1];
|
|
100
|
+
const isSameAction = lastAction && lastAction.action.name === action.action.name && lastAction.frame.pageAlias === action.frame.pageAlias && lastAction.frame.framePath.join('|') === action.frame.framePath.join('|');
|
|
101
|
+
const isSameSelector = lastAction && 'selector' in lastAction.action && 'selector' in action.action && action.action.selector === lastAction.action.selector;
|
|
102
|
+
const shouldMerge = isSameAction && (action.action.name === 'navigate' || action.action.name === 'fill' && isSameSelector);
|
|
103
|
+
if (!shouldMerge) {
|
|
104
|
+
result.push(action);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const startTime = result[result.length - 1].startTime;
|
|
108
|
+
result[result.length - 1] = action;
|
|
109
|
+
result[result.length - 1].startTime = startTime;
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ThrottledFile = void 0;
|
|
7
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) Microsoft Corporation.
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License.
|
|
15
|
+
* You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
class ThrottledFile {
|
|
27
|
+
constructor(file) {
|
|
28
|
+
this._file = void 0;
|
|
29
|
+
this._timer = void 0;
|
|
30
|
+
this._text = void 0;
|
|
31
|
+
this._file = file;
|
|
32
|
+
}
|
|
33
|
+
setContent(text) {
|
|
34
|
+
this._text = text;
|
|
35
|
+
if (!this._timer) this._timer = setTimeout(() => this.flush(), 250);
|
|
36
|
+
}
|
|
37
|
+
flush() {
|
|
38
|
+
if (this._timer) {
|
|
39
|
+
clearTimeout(this._timer);
|
|
40
|
+
this._timer = undefined;
|
|
41
|
+
}
|
|
42
|
+
if (this._text) fs.writeFileSync(this._file, this._text);
|
|
43
|
+
this._text = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ThrottledFile = ThrottledFile;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Recorder = void 0;
|
|
7
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
8
|
+
var consoleApiSource = _interopRequireWildcard(require("../generated/consoleApiSource"));
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _locatorParser = require("../utils/isomorphic/locatorParser");
|
|
11
|
+
var _browserContext = require("./browserContext");
|
|
12
|
+
var _debugger = require("./debugger");
|
|
13
|
+
var _contextRecorder = require("./recorder/contextRecorder");
|
|
14
|
+
var _recorderUtils = require("./recorder/recorderUtils");
|
|
15
|
+
var _recorderUtils2 = require("../utils/isomorphic/recorderUtils");
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
/**
|
|
19
|
+
* Copyright (c) Microsoft Corporation.
|
|
20
|
+
*
|
|
21
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22
|
+
* you may not use this file except in compliance with the License.
|
|
23
|
+
* You may obtain a copy of the License at
|
|
24
|
+
*
|
|
25
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
+
* See the License for the specific language governing permissions and
|
|
31
|
+
* limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
const recorderSymbol = Symbol('recorderSymbol');
|
|
35
|
+
class Recorder {
|
|
36
|
+
static async showInspector(context, params, recorderAppFactory) {
|
|
37
|
+
if ((0, _utils.isUnderTest)()) params.language = process.env.TEST_INSPECTOR_LANGUAGE;
|
|
38
|
+
return await Recorder.show('actions', context, recorderAppFactory, params);
|
|
39
|
+
}
|
|
40
|
+
static showInspectorNoReply(context, recorderAppFactory) {
|
|
41
|
+
Recorder.showInspector(context, {}, recorderAppFactory).catch(() => {});
|
|
42
|
+
}
|
|
43
|
+
static show(codegenMode, context, recorderAppFactory, params) {
|
|
44
|
+
let recorderPromise = context[recorderSymbol];
|
|
45
|
+
if (!recorderPromise) {
|
|
46
|
+
recorderPromise = Recorder._create(codegenMode, context, recorderAppFactory, params);
|
|
47
|
+
context[recorderSymbol] = recorderPromise;
|
|
48
|
+
}
|
|
49
|
+
return recorderPromise;
|
|
50
|
+
}
|
|
51
|
+
static async _create(codegenMode, context, recorderAppFactory, params = {}) {
|
|
52
|
+
const recorder = new Recorder(codegenMode, context, params);
|
|
53
|
+
const recorderApp = await recorderAppFactory(recorder);
|
|
54
|
+
await recorder._install(recorderApp);
|
|
55
|
+
return recorder;
|
|
56
|
+
}
|
|
57
|
+
constructor(codegenMode, context, params) {
|
|
58
|
+
this._context = void 0;
|
|
59
|
+
this._mode = void 0;
|
|
60
|
+
this._highlightedSelector = '';
|
|
61
|
+
this._overlayState = {
|
|
62
|
+
offsetX: 0
|
|
63
|
+
};
|
|
64
|
+
this._recorderApp = null;
|
|
65
|
+
this._currentCallsMetadata = new Map();
|
|
66
|
+
this._recorderSources = [];
|
|
67
|
+
this._userSources = new Map();
|
|
68
|
+
this._debugger = void 0;
|
|
69
|
+
this._contextRecorder = void 0;
|
|
70
|
+
this._omitCallTracking = false;
|
|
71
|
+
this._currentLanguage = void 0;
|
|
72
|
+
this._mode = params.mode || 'none';
|
|
73
|
+
this._contextRecorder = new _contextRecorder.ContextRecorder(codegenMode, context, params, {});
|
|
74
|
+
this._context = context;
|
|
75
|
+
this._omitCallTracking = !!params.omitCallTracking;
|
|
76
|
+
this._debugger = context.debugger();
|
|
77
|
+
context.instrumentation.addListener(this, context);
|
|
78
|
+
this._currentLanguage = this._contextRecorder.languageName();
|
|
79
|
+
if ((0, _utils.isUnderTest)()) {
|
|
80
|
+
// Most of our tests put elements at the top left, so get out of the way.
|
|
81
|
+
this._overlayState.offsetX = 200;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async _install(recorderApp) {
|
|
85
|
+
this._recorderApp = recorderApp;
|
|
86
|
+
recorderApp.once('close', () => {
|
|
87
|
+
this._debugger.resume(false);
|
|
88
|
+
this._recorderApp = null;
|
|
89
|
+
});
|
|
90
|
+
recorderApp.on('event', data => {
|
|
91
|
+
if (data.event === 'setMode') {
|
|
92
|
+
this.setMode(data.params.mode);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (data.event === 'selectorUpdated') {
|
|
96
|
+
this.setHighlightedSelector(this._currentLanguage, data.params.selector);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (data.event === 'step') {
|
|
100
|
+
this._debugger.resume(true);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (data.event === 'fileChanged') {
|
|
104
|
+
this._currentLanguage = this._contextRecorder.languageName(data.params.file);
|
|
105
|
+
this._refreshOverlay();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (data.event === 'resume') {
|
|
109
|
+
this._debugger.resume(false);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (data.event === 'pause') {
|
|
113
|
+
this._debugger.pauseOnNextStatement();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (data.event === 'clear') {
|
|
117
|
+
this._contextRecorder.clearScript();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
await Promise.all([recorderApp.setMode(this._mode), recorderApp.setPaused(this._debugger.isPaused()), this._pushAllSources()]);
|
|
122
|
+
this._context.once(_browserContext.BrowserContext.Events.Close, () => {
|
|
123
|
+
var _this$_recorderApp;
|
|
124
|
+
this._contextRecorder.dispose();
|
|
125
|
+
this._context.instrumentation.removeListener(this);
|
|
126
|
+
(_this$_recorderApp = this._recorderApp) === null || _this$_recorderApp === void 0 || _this$_recorderApp.close().catch(() => {});
|
|
127
|
+
});
|
|
128
|
+
this._contextRecorder.on(_contextRecorder.ContextRecorder.Events.Change, data => {
|
|
129
|
+
this._recorderSources = data.sources;
|
|
130
|
+
recorderApp.setActions(data.actions, data.sources);
|
|
131
|
+
recorderApp.setRunningFile(undefined);
|
|
132
|
+
this._pushAllSources();
|
|
133
|
+
});
|
|
134
|
+
await this._context.exposeBinding('__pw_recorderState', false, source => {
|
|
135
|
+
let actionSelector = '';
|
|
136
|
+
let actionPoint;
|
|
137
|
+
const hasActiveScreenshotCommand = [...this._currentCallsMetadata.keys()].some(isScreenshotCommand);
|
|
138
|
+
if (!hasActiveScreenshotCommand) {
|
|
139
|
+
actionSelector = this._highlightedSelector;
|
|
140
|
+
for (const [metadata, sdkObject] of this._currentCallsMetadata) {
|
|
141
|
+
if (source.page === sdkObject.attribution.page) {
|
|
142
|
+
actionPoint = metadata.point || actionPoint;
|
|
143
|
+
actionSelector = actionSelector || metadata.params.selector;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const uiState = {
|
|
148
|
+
mode: this._mode,
|
|
149
|
+
actionPoint,
|
|
150
|
+
actionSelector,
|
|
151
|
+
language: this._currentLanguage,
|
|
152
|
+
testIdAttributeName: this._contextRecorder.testIdAttributeName(),
|
|
153
|
+
overlay: this._overlayState
|
|
154
|
+
};
|
|
155
|
+
return uiState;
|
|
156
|
+
});
|
|
157
|
+
await this._context.exposeBinding('__pw_recorderSetSelector', false, async ({
|
|
158
|
+
frame
|
|
159
|
+
}, selector) => {
|
|
160
|
+
var _this$_recorderApp2;
|
|
161
|
+
const selectorChain = await (0, _contextRecorder.generateFrameSelector)(frame);
|
|
162
|
+
await ((_this$_recorderApp2 = this._recorderApp) === null || _this$_recorderApp2 === void 0 ? void 0 : _this$_recorderApp2.setSelector((0, _recorderUtils2.buildFullSelector)(selectorChain, selector), true));
|
|
163
|
+
});
|
|
164
|
+
await this._context.exposeBinding('__pw_recorderSetMode', false, async ({
|
|
165
|
+
frame
|
|
166
|
+
}, mode) => {
|
|
167
|
+
if (frame.parentFrame()) return;
|
|
168
|
+
this.setMode(mode);
|
|
169
|
+
});
|
|
170
|
+
await this._context.exposeBinding('__pw_recorderSetOverlayState', false, async ({
|
|
171
|
+
frame
|
|
172
|
+
}, state) => {
|
|
173
|
+
if (frame.parentFrame()) return;
|
|
174
|
+
this._overlayState = state;
|
|
175
|
+
});
|
|
176
|
+
await this._context.exposeBinding('__pw_resume', false, () => {
|
|
177
|
+
this._debugger.resume(false);
|
|
178
|
+
});
|
|
179
|
+
await this._context.extendInjectedScript(consoleApiSource.source);
|
|
180
|
+
await this._contextRecorder.install();
|
|
181
|
+
if (this._debugger.isPaused()) this._pausedStateChanged();
|
|
182
|
+
this._debugger.on(_debugger.Debugger.Events.PausedStateChanged, () => this._pausedStateChanged());
|
|
183
|
+
this._context.recorderAppForTest = this._recorderApp;
|
|
184
|
+
}
|
|
185
|
+
_pausedStateChanged() {
|
|
186
|
+
var _this$_recorderApp3;
|
|
187
|
+
// If we are called upon page.pause, we don't have metadatas, populate them.
|
|
188
|
+
for (const {
|
|
189
|
+
metadata,
|
|
190
|
+
sdkObject
|
|
191
|
+
} of this._debugger.pausedDetails()) {
|
|
192
|
+
if (!this._currentCallsMetadata.has(metadata)) this.onBeforeCall(sdkObject, metadata);
|
|
193
|
+
}
|
|
194
|
+
(_this$_recorderApp3 = this._recorderApp) === null || _this$_recorderApp3 === void 0 || _this$_recorderApp3.setPaused(this._debugger.isPaused());
|
|
195
|
+
this._updateUserSources();
|
|
196
|
+
this.updateCallLog([...this._currentCallsMetadata.keys()]);
|
|
197
|
+
}
|
|
198
|
+
setMode(mode) {
|
|
199
|
+
var _this$_recorderApp4;
|
|
200
|
+
if (this._mode === mode) return;
|
|
201
|
+
this._highlightedSelector = '';
|
|
202
|
+
this._mode = mode;
|
|
203
|
+
(_this$_recorderApp4 = this._recorderApp) === null || _this$_recorderApp4 === void 0 || _this$_recorderApp4.setMode(this._mode);
|
|
204
|
+
this._contextRecorder.setEnabled(this._mode === 'recording' || this._mode === 'assertingText' || this._mode === 'assertingVisibility' || this._mode === 'assertingValue');
|
|
205
|
+
this._debugger.setMuted(this._mode === 'recording' || this._mode === 'assertingText' || this._mode === 'assertingVisibility' || this._mode === 'assertingValue');
|
|
206
|
+
if (this._mode !== 'none' && this._mode !== 'standby' && this._context.pages().length === 1) this._context.pages()[0].bringToFront().catch(() => {});
|
|
207
|
+
this._refreshOverlay();
|
|
208
|
+
}
|
|
209
|
+
resume() {
|
|
210
|
+
this._debugger.resume(false);
|
|
211
|
+
}
|
|
212
|
+
mode() {
|
|
213
|
+
return this._mode;
|
|
214
|
+
}
|
|
215
|
+
setHighlightedSelector(language, selector) {
|
|
216
|
+
this._highlightedSelector = (0, _locatorParser.locatorOrSelectorAsSelector)(language, selector, this._context.selectors().testIdAttributeName());
|
|
217
|
+
this._refreshOverlay();
|
|
218
|
+
}
|
|
219
|
+
hideHighlightedSelector() {
|
|
220
|
+
this._highlightedSelector = '';
|
|
221
|
+
this._refreshOverlay();
|
|
222
|
+
}
|
|
223
|
+
setOutput(codegenId, outputFile) {
|
|
224
|
+
this._contextRecorder.setOutput(codegenId, outputFile);
|
|
225
|
+
}
|
|
226
|
+
_refreshOverlay() {
|
|
227
|
+
for (const page of this._context.pages()) page.mainFrame().evaluateExpression('window.__pw_refreshOverlay()').catch(() => {});
|
|
228
|
+
}
|
|
229
|
+
async onBeforeCall(sdkObject, metadata) {
|
|
230
|
+
if (this._omitCallTracking || this._mode === 'recording' || this._mode === 'assertingText' || this._mode === 'assertingVisibility' || this._mode === 'assertingValue') return;
|
|
231
|
+
this._currentCallsMetadata.set(metadata, sdkObject);
|
|
232
|
+
this._updateUserSources();
|
|
233
|
+
this.updateCallLog([metadata]);
|
|
234
|
+
if (isScreenshotCommand(metadata)) {
|
|
235
|
+
this.hideHighlightedSelector();
|
|
236
|
+
} else if (metadata.params && metadata.params.selector) {
|
|
237
|
+
var _this$_recorderApp5;
|
|
238
|
+
this._highlightedSelector = metadata.params.selector;
|
|
239
|
+
(_this$_recorderApp5 = this._recorderApp) === null || _this$_recorderApp5 === void 0 || _this$_recorderApp5.setSelector(this._highlightedSelector).catch(() => {});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async onAfterCall(sdkObject, metadata) {
|
|
243
|
+
if (this._omitCallTracking || this._mode === 'recording' || this._mode === 'assertingText' || this._mode === 'assertingVisibility' || this._mode === 'assertingValue') return;
|
|
244
|
+
if (!metadata.error) this._currentCallsMetadata.delete(metadata);
|
|
245
|
+
this._updateUserSources();
|
|
246
|
+
this.updateCallLog([metadata]);
|
|
247
|
+
}
|
|
248
|
+
_updateUserSources() {
|
|
249
|
+
var _this$_recorderApp6;
|
|
250
|
+
// Remove old decorations.
|
|
251
|
+
for (const source of this._userSources.values()) {
|
|
252
|
+
source.highlight = [];
|
|
253
|
+
source.revealLine = undefined;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Apply new decorations.
|
|
257
|
+
let fileToSelect = undefined;
|
|
258
|
+
for (const metadata of this._currentCallsMetadata.keys()) {
|
|
259
|
+
if (!metadata.location) continue;
|
|
260
|
+
const {
|
|
261
|
+
file,
|
|
262
|
+
line
|
|
263
|
+
} = metadata.location;
|
|
264
|
+
let source = this._userSources.get(file);
|
|
265
|
+
if (!source) {
|
|
266
|
+
source = {
|
|
267
|
+
isRecorded: false,
|
|
268
|
+
label: file,
|
|
269
|
+
id: file,
|
|
270
|
+
text: this._readSource(file),
|
|
271
|
+
highlight: [],
|
|
272
|
+
language: languageForFile(file)
|
|
273
|
+
};
|
|
274
|
+
this._userSources.set(file, source);
|
|
275
|
+
}
|
|
276
|
+
if (line) {
|
|
277
|
+
const paused = this._debugger.isPaused(metadata);
|
|
278
|
+
source.highlight.push({
|
|
279
|
+
line,
|
|
280
|
+
type: metadata.error ? 'error' : paused ? 'paused' : 'running'
|
|
281
|
+
});
|
|
282
|
+
source.revealLine = line;
|
|
283
|
+
fileToSelect = source.id;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
this._pushAllSources();
|
|
287
|
+
if (fileToSelect) (_this$_recorderApp6 = this._recorderApp) === null || _this$_recorderApp6 === void 0 || _this$_recorderApp6.setRunningFile(fileToSelect);
|
|
288
|
+
}
|
|
289
|
+
_pushAllSources() {
|
|
290
|
+
var _this$_recorderApp7;
|
|
291
|
+
(_this$_recorderApp7 = this._recorderApp) === null || _this$_recorderApp7 === void 0 || _this$_recorderApp7.setSources([...this._recorderSources, ...this._userSources.values()]);
|
|
292
|
+
}
|
|
293
|
+
async onBeforeInputAction(sdkObject, metadata) {}
|
|
294
|
+
async onCallLog(sdkObject, metadata, logName, message) {
|
|
295
|
+
this.updateCallLog([metadata]);
|
|
296
|
+
}
|
|
297
|
+
updateCallLog(metadatas) {
|
|
298
|
+
var _this$_recorderApp8;
|
|
299
|
+
if (this._mode === 'recording' || this._mode === 'assertingText' || this._mode === 'assertingVisibility' || this._mode === 'assertingValue') return;
|
|
300
|
+
const logs = [];
|
|
301
|
+
for (const metadata of metadatas) {
|
|
302
|
+
if (!metadata.method || metadata.internal) continue;
|
|
303
|
+
let status = 'done';
|
|
304
|
+
if (this._currentCallsMetadata.has(metadata)) status = 'in-progress';
|
|
305
|
+
if (this._debugger.isPaused(metadata)) status = 'paused';
|
|
306
|
+
logs.push((0, _recorderUtils.metadataToCallLog)(metadata, status));
|
|
307
|
+
}
|
|
308
|
+
(_this$_recorderApp8 = this._recorderApp) === null || _this$_recorderApp8 === void 0 || _this$_recorderApp8.updateCallLogs(logs);
|
|
309
|
+
}
|
|
310
|
+
_readSource(fileName) {
|
|
311
|
+
try {
|
|
312
|
+
return fs.readFileSync(fileName, 'utf-8');
|
|
313
|
+
} catch (e) {
|
|
314
|
+
return '// No source available';
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
exports.Recorder = Recorder;
|
|
319
|
+
function isScreenshotCommand(metadata) {
|
|
320
|
+
return metadata.method.toLowerCase().includes('screenshot');
|
|
321
|
+
}
|
|
322
|
+
function languageForFile(file) {
|
|
323
|
+
if (file.endsWith('.py')) return 'python';
|
|
324
|
+
if (file.endsWith('.java')) return 'java';
|
|
325
|
+
if (file.endsWith('.cs')) return 'csharp';
|
|
326
|
+
return 'javascript';
|
|
327
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.downloadBrowserWithProgressBar = downloadBrowserWithProgressBar;
|
|
7
|
+
exports.logPolitely = logPolitely;
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _os = _interopRequireDefault(require("os"));
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var _child_process = _interopRequireDefault(require("child_process"));
|
|
12
|
+
var _fileUtils = require("../../utils/fileUtils");
|
|
13
|
+
var _debugLogger = require("../../utils/debugLogger");
|
|
14
|
+
var _manualPromise = require("../../utils/manualPromise");
|
|
15
|
+
var _utilsBundle = require("../../utilsBundle");
|
|
16
|
+
var _ = require(".");
|
|
17
|
+
var _userAgent = require("../../utils/userAgent");
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
/**
|
|
20
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
|
21
|
+
* Modifications copyright (c) Microsoft Corporation.
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License.
|
|
25
|
+
* You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
async function downloadBrowserWithProgressBar(title, browserDirectory, executablePath, downloadURLs, downloadFileName, downloadConnectionTimeout) {
|
|
37
|
+
if (await (0, _fileUtils.existsAsync)((0, _.browserDirectoryToMarkerFilePath)(browserDirectory))) {
|
|
38
|
+
// Already downloaded.
|
|
39
|
+
_debugLogger.debugLogger.log('install', `${title} is already downloaded.`);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const zipPath = _path.default.join(_os.default.tmpdir(), downloadFileName);
|
|
43
|
+
try {
|
|
44
|
+
const retryCount = 3;
|
|
45
|
+
for (let attempt = 1; attempt <= retryCount; ++attempt) {
|
|
46
|
+
_debugLogger.debugLogger.log('install', `downloading ${title} - attempt #${attempt}`);
|
|
47
|
+
const url = downloadURLs[(attempt - 1) % downloadURLs.length];
|
|
48
|
+
logPolitely(`Downloading ${title}` + _utilsBundle.colors.dim(` from ${url}`));
|
|
49
|
+
const {
|
|
50
|
+
error
|
|
51
|
+
} = await downloadBrowserWithProgressBarOutOfProcess(title, browserDirectory, url, zipPath, executablePath, downloadConnectionTimeout);
|
|
52
|
+
if (!error) {
|
|
53
|
+
_debugLogger.debugLogger.log('install', `SUCCESS installing ${title}`);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
if (await (0, _fileUtils.existsAsync)(zipPath)) await _fs.default.promises.unlink(zipPath);
|
|
57
|
+
if (await (0, _fileUtils.existsAsync)(browserDirectory)) await _fs.default.promises.rmdir(browserDirectory, {
|
|
58
|
+
recursive: true
|
|
59
|
+
});
|
|
60
|
+
const errorMessage = (error === null || error === void 0 ? void 0 : error.message) || '';
|
|
61
|
+
_debugLogger.debugLogger.log('install', `attempt #${attempt} - ERROR: ${errorMessage}`);
|
|
62
|
+
if (attempt >= retryCount) throw error;
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
_debugLogger.debugLogger.log('install', `FAILED installation ${title} with error: ${e}`);
|
|
66
|
+
process.exitCode = 1;
|
|
67
|
+
throw e;
|
|
68
|
+
} finally {
|
|
69
|
+
if (await (0, _fileUtils.existsAsync)(zipPath)) await _fs.default.promises.unlink(zipPath);
|
|
70
|
+
}
|
|
71
|
+
logPolitely(`${title} downloaded to ${browserDirectory}`);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Node.js has a bug where the process can exit with 0 code even though there was an uncaught exception.
|
|
77
|
+
* Thats why we execute it in a separate process and check manually if the destination file exists.
|
|
78
|
+
* https://github.com/microsoft/playwright/issues/17394
|
|
79
|
+
*/
|
|
80
|
+
function downloadBrowserWithProgressBarOutOfProcess(title, browserDirectory, url, zipPath, executablePath, connectionTimeout) {
|
|
81
|
+
const cp = _child_process.default.fork(_path.default.join(__dirname, 'oopDownloadBrowserMain.js'));
|
|
82
|
+
const promise = new _manualPromise.ManualPromise();
|
|
83
|
+
const progress = getDownloadProgress();
|
|
84
|
+
cp.on('message', message => {
|
|
85
|
+
if ((message === null || message === void 0 ? void 0 : message.method) === 'log') _debugLogger.debugLogger.log('install', message.params.message);
|
|
86
|
+
if ((message === null || message === void 0 ? void 0 : message.method) === 'progress') progress(message.params.done, message.params.total);
|
|
87
|
+
});
|
|
88
|
+
cp.on('exit', code => {
|
|
89
|
+
if (code !== 0) {
|
|
90
|
+
promise.resolve({
|
|
91
|
+
error: new Error(`Download failure, code=${code}`)
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (!_fs.default.existsSync((0, _.browserDirectoryToMarkerFilePath)(browserDirectory))) promise.resolve({
|
|
96
|
+
error: new Error(`Download failure, ${(0, _.browserDirectoryToMarkerFilePath)(browserDirectory)} does not exist`)
|
|
97
|
+
});else promise.resolve({
|
|
98
|
+
error: null
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
cp.on('error', error => {
|
|
102
|
+
promise.resolve({
|
|
103
|
+
error
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
_debugLogger.debugLogger.log('install', `running download:`);
|
|
107
|
+
_debugLogger.debugLogger.log('install', `-- from url: ${url}`);
|
|
108
|
+
_debugLogger.debugLogger.log('install', `-- to location: ${zipPath}`);
|
|
109
|
+
const downloadParams = {
|
|
110
|
+
title,
|
|
111
|
+
browserDirectory,
|
|
112
|
+
url,
|
|
113
|
+
zipPath,
|
|
114
|
+
executablePath,
|
|
115
|
+
connectionTimeout,
|
|
116
|
+
userAgent: (0, _userAgent.getUserAgent)()
|
|
117
|
+
};
|
|
118
|
+
cp.send({
|
|
119
|
+
method: 'download',
|
|
120
|
+
params: downloadParams
|
|
121
|
+
});
|
|
122
|
+
return promise;
|
|
123
|
+
}
|
|
124
|
+
function logPolitely(toBeLogged) {
|
|
125
|
+
const logLevel = process.env.npm_config_loglevel;
|
|
126
|
+
const logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel || '') > -1;
|
|
127
|
+
if (!logLevelDisplay) console.log(toBeLogged); // eslint-disable-line no-console
|
|
128
|
+
}
|
|
129
|
+
function getDownloadProgress() {
|
|
130
|
+
if (process.stdout.isTTY) return getAnimatedDownloadProgress();
|
|
131
|
+
return getBasicDownloadProgress();
|
|
132
|
+
}
|
|
133
|
+
function getAnimatedDownloadProgress() {
|
|
134
|
+
let progressBar;
|
|
135
|
+
let lastDownloadedBytes = 0;
|
|
136
|
+
return (downloadedBytes, totalBytes) => {
|
|
137
|
+
if (!progressBar) {
|
|
138
|
+
progressBar = new _utilsBundle.progress(`${toMegabytes(totalBytes)} [:bar] :percent :etas`, {
|
|
139
|
+
complete: '=',
|
|
140
|
+
incomplete: ' ',
|
|
141
|
+
width: 20,
|
|
142
|
+
total: totalBytes
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const delta = downloadedBytes - lastDownloadedBytes;
|
|
146
|
+
lastDownloadedBytes = downloadedBytes;
|
|
147
|
+
progressBar.tick(delta);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function getBasicDownloadProgress() {
|
|
151
|
+
const totalRows = 10;
|
|
152
|
+
const stepWidth = 8;
|
|
153
|
+
let lastRow = -1;
|
|
154
|
+
return (downloadedBytes, totalBytes) => {
|
|
155
|
+
const percentage = downloadedBytes / totalBytes;
|
|
156
|
+
const row = Math.floor(totalRows * percentage);
|
|
157
|
+
if (row > lastRow) {
|
|
158
|
+
lastRow = row;
|
|
159
|
+
const percentageString = String(percentage * 100 | 0).padStart(3);
|
|
160
|
+
// eslint-disable-next-line no-console
|
|
161
|
+
console.log(`|${'■'.repeat(row * stepWidth)}${' '.repeat((totalRows - row) * stepWidth)}| ${percentageString}% of ${toMegabytes(totalBytes)}`);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function toMegabytes(bytes) {
|
|
166
|
+
const mb = bytes / 1024 / 1024;
|
|
167
|
+
return `${Math.round(mb * 10) / 10} MiB`;
|
|
168
|
+
}
|