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.
Files changed (381) hide show
  1. patchright/__init__.py +5 -0
  2. patchright/__main__.py +18 -0
  3. patchright/_impl/__init__.py +0 -0
  4. patchright/_impl/__pyinstaller/__init__.py +20 -0
  5. patchright/_impl/__pyinstaller/hook-playwright.async_api.py +3 -0
  6. patchright/_impl/__pyinstaller/hook-playwright.sync_api.py +3 -0
  7. patchright/_impl/_accessibility.py +50 -0
  8. patchright/_impl/_api_structures.py +277 -0
  9. patchright/_impl/_artifact.py +45 -0
  10. patchright/_impl/_assertions.py +867 -0
  11. patchright/_impl/_async_base.py +92 -0
  12. patchright/_impl/_browser.py +248 -0
  13. patchright/_impl/_browser_context.py +743 -0
  14. patchright/_impl/_browser_type.py +276 -0
  15. patchright/_impl/_cdp_session.py +21 -0
  16. patchright/_impl/_clock.py +57 -0
  17. patchright/_impl/_connection.py +562 -0
  18. patchright/_impl/_console_message.py +45 -0
  19. patchright/_impl/_dialog.py +40 -0
  20. patchright/_impl/_download.py +50 -0
  21. patchright/_impl/_driver.py +24 -0
  22. patchright/_impl/_element_handle.py +376 -0
  23. patchright/_impl/_errors.py +44 -0
  24. patchright/_impl/_event_context_manager.py +20 -0
  25. patchright/_impl/_fetch.py +518 -0
  26. patchright/_impl/_file_chooser.py +43 -0
  27. patchright/_impl/_frame.py +779 -0
  28. patchright/_impl/_glob.py +46 -0
  29. patchright/_impl/_greenlets.py +39 -0
  30. patchright/_impl/_har_router.py +99 -0
  31. patchright/_impl/_helper.py +481 -0
  32. patchright/_impl/_impl_to_api_mapping.py +123 -0
  33. patchright/_impl/_input.py +71 -0
  34. patchright/_impl/_js_handle.py +300 -0
  35. patchright/_impl/_json_pipe.py +56 -0
  36. patchright/_impl/_local_utils.py +73 -0
  37. patchright/_impl/_locator.py +814 -0
  38. patchright/_impl/_map.py +19 -0
  39. patchright/_impl/_network.py +958 -0
  40. patchright/_impl/_object_factory.py +91 -0
  41. patchright/_impl/_page.py +1485 -0
  42. patchright/_impl/_path_utils.py +11 -0
  43. patchright/_impl/_playwright.py +51 -0
  44. patchright/_impl/_selectors.py +62 -0
  45. patchright/_impl/_set_input_files_helpers.py +135 -0
  46. patchright/_impl/_str_utils.py +57 -0
  47. patchright/_impl/_stream.py +32 -0
  48. patchright/_impl/_sync_base.py +134 -0
  49. patchright/_impl/_tracing.py +110 -0
  50. patchright/_impl/_transport.py +150 -0
  51. patchright/_impl/_video.py +57 -0
  52. patchright/_impl/_waiter.py +142 -0
  53. patchright/_impl/_web_error.py +27 -0
  54. patchright/_impl/_writable_stream.py +27 -0
  55. patchright/_repo_version.py +1 -0
  56. patchright/async_api/__init__.py +179 -0
  57. patchright/async_api/_context_manager.py +39 -0
  58. patchright/async_api/_generated.py +20416 -0
  59. patchright/driver/README.md +1 -0
  60. patchright/driver/package/README.md +3 -0
  61. patchright/driver/package/ThirdPartyNotices.txt +1560 -0
  62. patchright/driver/package/bin/install_media_pack.ps1 +5 -0
  63. patchright/driver/package/bin/reinstall_chrome_beta_linux.sh +42 -0
  64. patchright/driver/package/bin/reinstall_chrome_beta_mac.sh +13 -0
  65. patchright/driver/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
  66. patchright/driver/package/bin/reinstall_chrome_stable_linux.sh +42 -0
  67. patchright/driver/package/bin/reinstall_chrome_stable_mac.sh +12 -0
  68. patchright/driver/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
  69. patchright/driver/package/bin/reinstall_msedge_beta_linux.sh +48 -0
  70. patchright/driver/package/bin/reinstall_msedge_beta_mac.sh +11 -0
  71. patchright/driver/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
  72. patchright/driver/package/bin/reinstall_msedge_dev_linux.sh +48 -0
  73. patchright/driver/package/bin/reinstall_msedge_dev_mac.sh +11 -0
  74. patchright/driver/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
  75. patchright/driver/package/bin/reinstall_msedge_stable_linux.sh +48 -0
  76. patchright/driver/package/bin/reinstall_msedge_stable_mac.sh +11 -0
  77. patchright/driver/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
  78. patchright/driver/package/browsers.json +80 -0
  79. patchright/driver/package/cli.js +18 -0
  80. patchright/driver/package/index.js +32 -0
  81. patchright/driver/package/index.mjs +28 -0
  82. patchright/driver/package/lib/androidServerImpl.js +63 -0
  83. patchright/driver/package/lib/browserServerImpl.js +88 -0
  84. patchright/driver/package/lib/cli/driver.js +97 -0
  85. patchright/driver/package/lib/cli/program.js +567 -0
  86. patchright/driver/package/lib/cli/programWithTestStub.js +74 -0
  87. patchright/driver/package/lib/client/accessibility.js +49 -0
  88. patchright/driver/package/lib/client/android.js +365 -0
  89. patchright/driver/package/lib/client/api.js +137 -0
  90. patchright/driver/package/lib/client/artifact.js +79 -0
  91. patchright/driver/package/lib/client/browser.js +136 -0
  92. patchright/driver/package/lib/client/browserContext.js +539 -0
  93. patchright/driver/package/lib/client/browserType.js +193 -0
  94. patchright/driver/package/lib/client/cdpSession.js +51 -0
  95. patchright/driver/package/lib/client/channelOwner.js +205 -0
  96. patchright/driver/package/lib/client/clientHelper.js +64 -0
  97. patchright/driver/package/lib/client/clientInstrumentation.js +55 -0
  98. patchright/driver/package/lib/client/clientStackTrace.js +69 -0
  99. patchright/driver/package/lib/client/clock.js +68 -0
  100. patchright/driver/package/lib/client/connection.js +318 -0
  101. patchright/driver/package/lib/client/consoleMessage.js +55 -0
  102. patchright/driver/package/lib/client/coverage.js +44 -0
  103. patchright/driver/package/lib/client/dialog.js +56 -0
  104. patchright/driver/package/lib/client/download.js +62 -0
  105. patchright/driver/package/lib/client/electron.js +133 -0
  106. patchright/driver/package/lib/client/elementHandle.js +284 -0
  107. patchright/driver/package/lib/client/errors.js +77 -0
  108. patchright/driver/package/lib/client/eventEmitter.js +314 -0
  109. patchright/driver/package/lib/client/events.js +98 -0
  110. patchright/driver/package/lib/client/fetch.js +367 -0
  111. patchright/driver/package/lib/client/fileChooser.js +46 -0
  112. patchright/driver/package/lib/client/fileUtils.js +34 -0
  113. patchright/driver/package/lib/client/frame.js +386 -0
  114. patchright/driver/package/lib/client/harRouter.js +87 -0
  115. patchright/driver/package/lib/client/input.js +82 -0
  116. patchright/driver/package/lib/client/jsHandle.js +105 -0
  117. patchright/driver/package/lib/client/jsonPipe.js +39 -0
  118. patchright/driver/package/lib/client/localUtils.js +61 -0
  119. patchright/driver/package/lib/client/locator.js +362 -0
  120. patchright/driver/package/lib/client/network.js +751 -0
  121. patchright/driver/package/lib/client/page.js +709 -0
  122. patchright/driver/package/lib/client/platform.js +74 -0
  123. patchright/driver/package/lib/client/playwright.js +85 -0
  124. patchright/driver/package/lib/client/selectors.js +75 -0
  125. patchright/driver/package/lib/client/stream.js +39 -0
  126. patchright/driver/package/lib/client/timeoutSettings.js +75 -0
  127. patchright/driver/package/lib/client/tracing.js +114 -0
  128. patchright/driver/package/lib/client/types.js +28 -0
  129. patchright/driver/package/lib/client/video.js +59 -0
  130. patchright/driver/package/lib/client/waiter.js +142 -0
  131. patchright/driver/package/lib/client/webError.js +39 -0
  132. patchright/driver/package/lib/client/webSocket.js +111 -0
  133. patchright/driver/package/lib/client/worker.js +63 -0
  134. patchright/driver/package/lib/client/writableStream.js +39 -0
  135. patchright/driver/package/lib/generated/clockSource.js +28 -0
  136. patchright/driver/package/lib/generated/consoleApiSource.js +28 -0
  137. patchright/driver/package/lib/generated/injectedScriptSource.js +28 -0
  138. patchright/driver/package/lib/generated/pollingRecorderSource.js +28 -0
  139. patchright/driver/package/lib/generated/utilityScriptSource.js +28 -0
  140. patchright/driver/package/lib/generated/webSocketMockSource.js +374 -0
  141. patchright/driver/package/lib/inProcessFactory.js +59 -0
  142. patchright/driver/package/lib/inprocess.js +3 -0
  143. patchright/driver/package/lib/outofprocess.js +78 -0
  144. patchright/driver/package/lib/protocol/debug.js +211 -0
  145. patchright/driver/package/lib/protocol/serializers.js +192 -0
  146. patchright/driver/package/lib/protocol/validator.js +2832 -0
  147. patchright/driver/package/lib/protocol/validatorPrimitives.js +179 -0
  148. patchright/driver/package/lib/remote/playwrightConnection.js +266 -0
  149. patchright/driver/package/lib/remote/playwrightServer.js +139 -0
  150. patchright/driver/package/lib/server/accessibility.js +69 -0
  151. patchright/driver/package/lib/server/android/android.js +451 -0
  152. patchright/driver/package/lib/server/android/backendAdb.js +179 -0
  153. patchright/driver/package/lib/server/artifact.js +127 -0
  154. patchright/driver/package/lib/server/bidi/bidiBrowser.js +380 -0
  155. patchright/driver/package/lib/server/bidi/bidiChromium.js +152 -0
  156. patchright/driver/package/lib/server/bidi/bidiConnection.js +187 -0
  157. patchright/driver/package/lib/server/bidi/bidiExecutionContext.js +220 -0
  158. patchright/driver/package/lib/server/bidi/bidiFirefox.js +112 -0
  159. patchright/driver/package/lib/server/bidi/bidiInput.js +146 -0
  160. patchright/driver/package/lib/server/bidi/bidiNetworkManager.js +320 -0
  161. patchright/driver/package/lib/server/bidi/bidiOverCdp.js +102 -0
  162. patchright/driver/package/lib/server/bidi/bidiPage.js +530 -0
  163. patchright/driver/package/lib/server/bidi/bidiPdf.js +106 -0
  164. patchright/driver/package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
  165. patchright/driver/package/lib/server/bidi/third_party/bidiDeserializer.js +98 -0
  166. patchright/driver/package/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
  167. patchright/driver/package/lib/server/bidi/third_party/bidiProtocol.js +152 -0
  168. patchright/driver/package/lib/server/bidi/third_party/bidiSerializer.js +148 -0
  169. patchright/driver/package/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
  170. patchright/driver/package/lib/server/browser.js +140 -0
  171. patchright/driver/package/lib/server/browserContext.js +646 -0
  172. patchright/driver/package/lib/server/browserType.js +326 -0
  173. patchright/driver/package/lib/server/callLog.js +82 -0
  174. patchright/driver/package/lib/server/chromium/appIcon.png +0 -0
  175. patchright/driver/package/lib/server/chromium/chromium.js +376 -0
  176. patchright/driver/package/lib/server/chromium/chromiumSwitches.js +89 -0
  177. patchright/driver/package/lib/server/chromium/crAccessibility.js +263 -0
  178. patchright/driver/package/lib/server/chromium/crBrowser.js +503 -0
  179. patchright/driver/package/lib/server/chromium/crConnection.js +203 -0
  180. patchright/driver/package/lib/server/chromium/crCoverage.js +232 -0
  181. patchright/driver/package/lib/server/chromium/crDevTools.js +112 -0
  182. patchright/driver/package/lib/server/chromium/crDragDrop.js +126 -0
  183. patchright/driver/package/lib/server/chromium/crExecutionContext.js +145 -0
  184. patchright/driver/package/lib/server/chromium/crInput.js +184 -0
  185. patchright/driver/package/lib/server/chromium/crNetworkManager.js +742 -0
  186. patchright/driver/package/lib/server/chromium/crPage.js +1134 -0
  187. patchright/driver/package/lib/server/chromium/crPdf.js +121 -0
  188. patchright/driver/package/lib/server/chromium/crProtocolHelper.js +145 -0
  189. patchright/driver/package/lib/server/chromium/crServiceWorker.js +126 -0
  190. patchright/driver/package/lib/server/chromium/defaultFontFamilies.js +162 -0
  191. patchright/driver/package/lib/server/chromium/protocol.d.js +16 -0
  192. patchright/driver/package/lib/server/chromium/videoRecorder.js +121 -0
  193. patchright/driver/package/lib/server/clock.js +145 -0
  194. patchright/driver/package/lib/server/codegen/csharp.js +329 -0
  195. patchright/driver/package/lib/server/codegen/java.js +270 -0
  196. patchright/driver/package/lib/server/codegen/javascript.js +268 -0
  197. patchright/driver/package/lib/server/codegen/jsonl.js +51 -0
  198. patchright/driver/package/lib/server/codegen/language.js +111 -0
  199. patchright/driver/package/lib/server/codegen/languages.js +68 -0
  200. patchright/driver/package/lib/server/codegen/python.js +277 -0
  201. patchright/driver/package/lib/server/codegen/types.js +16 -0
  202. patchright/driver/package/lib/server/console.js +53 -0
  203. patchright/driver/package/lib/server/cookieStore.js +204 -0
  204. patchright/driver/package/lib/server/debugController.js +185 -0
  205. patchright/driver/package/lib/server/debugger.js +136 -0
  206. patchright/driver/package/lib/server/deviceDescriptors.js +39 -0
  207. patchright/driver/package/lib/server/deviceDescriptorsSource.json +1669 -0
  208. patchright/driver/package/lib/server/dialog.js +72 -0
  209. patchright/driver/package/lib/server/dispatchers/androidDispatcher.js +293 -0
  210. patchright/driver/package/lib/server/dispatchers/artifactDispatcher.js +118 -0
  211. patchright/driver/package/lib/server/dispatchers/browserContextDispatcher.js +328 -0
  212. patchright/driver/package/lib/server/dispatchers/browserDispatcher.js +151 -0
  213. patchright/driver/package/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
  214. patchright/driver/package/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
  215. patchright/driver/package/lib/server/dispatchers/debugControllerDispatcher.js +87 -0
  216. patchright/driver/package/lib/server/dispatchers/dialogDispatcher.js +47 -0
  217. patchright/driver/package/lib/server/dispatchers/dispatcher.js +346 -0
  218. patchright/driver/package/lib/server/dispatchers/electronDispatcher.js +90 -0
  219. patchright/driver/package/lib/server/dispatchers/elementHandlerDispatcher.js +191 -0
  220. patchright/driver/package/lib/server/dispatchers/frameDispatcher.js +230 -0
  221. patchright/driver/package/lib/server/dispatchers/jsHandleDispatcher.js +80 -0
  222. patchright/driver/package/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
  223. patchright/driver/package/lib/server/dispatchers/localUtilsDispatcher.js +155 -0
  224. patchright/driver/package/lib/server/dispatchers/networkDispatchers.js +204 -0
  225. patchright/driver/package/lib/server/dispatchers/pageDispatcher.js +328 -0
  226. patchright/driver/package/lib/server/dispatchers/playwrightDispatcher.js +100 -0
  227. patchright/driver/package/lib/server/dispatchers/selectorsDispatcher.js +40 -0
  228. patchright/driver/package/lib/server/dispatchers/streamDispatcher.js +60 -0
  229. patchright/driver/package/lib/server/dispatchers/tracingDispatcher.js +59 -0
  230. patchright/driver/package/lib/server/dispatchers/webSocketRouteDispatcher.js +154 -0
  231. patchright/driver/package/lib/server/dispatchers/writableStreamDispatcher.js +73 -0
  232. patchright/driver/package/lib/server/dom.js +869 -0
  233. patchright/driver/package/lib/server/download.js +70 -0
  234. patchright/driver/package/lib/server/electron/electron.js +277 -0
  235. patchright/driver/package/lib/server/electron/loader.js +29 -0
  236. patchright/driver/package/lib/server/errors.js +69 -0
  237. patchright/driver/package/lib/server/fetch.js +640 -0
  238. patchright/driver/package/lib/server/fileChooser.js +43 -0
  239. patchright/driver/package/lib/server/fileUploadUtils.js +84 -0
  240. patchright/driver/package/lib/server/firefox/ffAccessibility.js +238 -0
  241. patchright/driver/package/lib/server/firefox/ffBrowser.js +404 -0
  242. patchright/driver/package/lib/server/firefox/ffConnection.js +147 -0
  243. patchright/driver/package/lib/server/firefox/ffExecutionContext.js +149 -0
  244. patchright/driver/package/lib/server/firefox/ffInput.js +159 -0
  245. patchright/driver/package/lib/server/firefox/ffNetworkManager.js +254 -0
  246. patchright/driver/package/lib/server/firefox/ffPage.js +501 -0
  247. patchright/driver/package/lib/server/firefox/firefox.js +106 -0
  248. patchright/driver/package/lib/server/firefox/protocol.d.js +16 -0
  249. patchright/driver/package/lib/server/formData.js +147 -0
  250. patchright/driver/package/lib/server/frameSelectors.js +274 -0
  251. patchright/driver/package/lib/server/frames.js +1834 -0
  252. patchright/driver/package/lib/server/har/harRecorder.js +147 -0
  253. patchright/driver/package/lib/server/har/harTracer.js +606 -0
  254. patchright/driver/package/lib/server/harBackend.js +157 -0
  255. patchright/driver/package/lib/server/helper.js +100 -0
  256. patchright/driver/package/lib/server/index.js +61 -0
  257. patchright/driver/package/lib/server/input.js +280 -0
  258. patchright/driver/package/lib/server/instrumentation.js +75 -0
  259. patchright/driver/package/lib/server/javascript.js +315 -0
  260. patchright/driver/package/lib/server/launchApp.js +110 -0
  261. patchright/driver/package/lib/server/localUtils.js +211 -0
  262. patchright/driver/package/lib/server/macEditingCommands.js +143 -0
  263. patchright/driver/package/lib/server/network.js +583 -0
  264. patchright/driver/package/lib/server/page.js +775 -0
  265. patchright/driver/package/lib/server/pageBinding.js +88 -0
  266. patchright/driver/package/lib/server/pipeTransport.js +89 -0
  267. patchright/driver/package/lib/server/playwright.js +81 -0
  268. patchright/driver/package/lib/server/progress.js +104 -0
  269. patchright/driver/package/lib/server/protocolError.js +52 -0
  270. patchright/driver/package/lib/server/recorder/chat.js +161 -0
  271. patchright/driver/package/lib/server/recorder/contextRecorder.js +286 -0
  272. patchright/driver/package/lib/server/recorder/recorderApp.js +184 -0
  273. patchright/driver/package/lib/server/recorder/recorderCollection.js +116 -0
  274. patchright/driver/package/lib/server/recorder/recorderFrontend.js +16 -0
  275. patchright/driver/package/lib/server/recorder/recorderRunner.js +135 -0
  276. patchright/driver/package/lib/server/recorder/recorderUtils.js +100 -0
  277. patchright/driver/package/lib/server/recorder/throttledFile.js +57 -0
  278. patchright/driver/package/lib/server/recorder.js +360 -0
  279. patchright/driver/package/lib/server/registry/browserFetcher.js +175 -0
  280. patchright/driver/package/lib/server/registry/dependencies.js +371 -0
  281. patchright/driver/package/lib/server/registry/index.js +1271 -0
  282. patchright/driver/package/lib/server/registry/nativeDeps.js +1105 -0
  283. patchright/driver/package/lib/server/registry/oopDownloadBrowserMain.js +120 -0
  284. patchright/driver/package/lib/server/screenshotter.js +332 -0
  285. patchright/driver/package/lib/server/selectors.js +112 -0
  286. patchright/driver/package/lib/server/socksClientCertificatesInterceptor.js +321 -0
  287. patchright/driver/package/lib/server/socksInterceptor.js +95 -0
  288. patchright/driver/package/lib/server/storageScript.js +154 -0
  289. patchright/driver/package/lib/server/timeoutSettings.js +89 -0
  290. patchright/driver/package/lib/server/trace/recorder/snapshotter.js +143 -0
  291. patchright/driver/package/lib/server/trace/recorder/snapshotterInjected.js +539 -0
  292. patchright/driver/package/lib/server/trace/recorder/tracing.js +593 -0
  293. patchright/driver/package/lib/server/trace/test/inMemorySnapshotter.js +87 -0
  294. patchright/driver/package/lib/server/trace/viewer/traceViewer.js +249 -0
  295. patchright/driver/package/lib/server/transport.js +183 -0
  296. patchright/driver/package/lib/server/types.js +28 -0
  297. patchright/driver/package/lib/server/usKeyboardLayout.js +145 -0
  298. patchright/driver/package/lib/server/utils/ascii.js +44 -0
  299. patchright/driver/package/lib/server/utils/comparators.js +161 -0
  300. patchright/driver/package/lib/server/utils/crypto.js +216 -0
  301. patchright/driver/package/lib/server/utils/debug.js +47 -0
  302. patchright/driver/package/lib/server/utils/debugLogger.js +114 -0
  303. patchright/driver/package/lib/server/utils/env.js +68 -0
  304. patchright/driver/package/lib/server/utils/eventsHelper.js +39 -0
  305. patchright/driver/package/lib/server/utils/expectUtils.js +38 -0
  306. patchright/driver/package/lib/server/utils/fileUtils.js +191 -0
  307. patchright/driver/package/lib/server/utils/happyEyeballs.js +207 -0
  308. patchright/driver/package/lib/server/utils/hostPlatform.js +109 -0
  309. patchright/driver/package/lib/server/utils/httpServer.js +218 -0
  310. patchright/driver/package/lib/server/utils/image_tools/colorUtils.js +89 -0
  311. patchright/driver/package/lib/server/utils/image_tools/compare.js +109 -0
  312. patchright/driver/package/lib/server/utils/image_tools/imageChannel.js +78 -0
  313. patchright/driver/package/lib/server/utils/image_tools/stats.js +102 -0
  314. patchright/driver/package/lib/server/utils/linuxUtils.js +71 -0
  315. patchright/driver/package/lib/server/utils/network.js +217 -0
  316. patchright/driver/package/lib/server/utils/nodePlatform.js +148 -0
  317. patchright/driver/package/lib/server/utils/pipeTransport.js +84 -0
  318. patchright/driver/package/lib/server/utils/processLauncher.js +238 -0
  319. patchright/driver/package/lib/server/utils/profiler.js +65 -0
  320. patchright/driver/package/lib/server/utils/socksProxy.js +511 -0
  321. patchright/driver/package/lib/server/utils/spawnAsync.js +41 -0
  322. patchright/driver/package/lib/server/utils/task.js +51 -0
  323. patchright/driver/package/lib/server/utils/userAgent.js +98 -0
  324. patchright/driver/package/lib/server/utils/wsServer.js +132 -0
  325. patchright/driver/package/lib/server/utils/zipFile.js +74 -0
  326. patchright/driver/package/lib/server/utils/zones.js +57 -0
  327. patchright/driver/package/lib/server/webkit/protocol.d.js +16 -0
  328. patchright/driver/package/lib/server/webkit/webkit.js +100 -0
  329. patchright/driver/package/lib/server/webkit/wkAccessibility.js +237 -0
  330. patchright/driver/package/lib/server/webkit/wkBrowser.js +312 -0
  331. patchright/driver/package/lib/server/webkit/wkConnection.js +149 -0
  332. patchright/driver/package/lib/server/webkit/wkExecutionContext.js +153 -0
  333. patchright/driver/package/lib/server/webkit/wkInput.js +181 -0
  334. patchright/driver/package/lib/server/webkit/wkInterceptableRequest.js +169 -0
  335. patchright/driver/package/lib/server/webkit/wkPage.js +1114 -0
  336. patchright/driver/package/lib/server/webkit/wkProvisionalPage.js +83 -0
  337. patchright/driver/package/lib/server/webkit/wkWorkers.js +104 -0
  338. patchright/driver/package/lib/third_party/pixelmatch.js +255 -0
  339. patchright/driver/package/lib/utils/isomorphic/ariaSnapshot.js +384 -0
  340. patchright/driver/package/lib/utils/isomorphic/assert.js +31 -0
  341. patchright/driver/package/lib/utils/isomorphic/builtins.js +86 -0
  342. patchright/driver/package/lib/utils/isomorphic/colors.js +72 -0
  343. patchright/driver/package/lib/utils/isomorphic/cssParser.js +246 -0
  344. patchright/driver/package/lib/utils/isomorphic/cssTokenizer.js +1051 -0
  345. patchright/driver/package/lib/utils/isomorphic/headers.js +53 -0
  346. patchright/driver/package/lib/utils/isomorphic/locatorGenerators.js +655 -0
  347. patchright/driver/package/lib/utils/isomorphic/locatorParser.js +176 -0
  348. patchright/driver/package/lib/utils/isomorphic/locatorUtils.js +81 -0
  349. patchright/driver/package/lib/utils/isomorphic/manualPromise.js +115 -0
  350. patchright/driver/package/lib/utils/isomorphic/mimeType.js +460 -0
  351. patchright/driver/package/lib/utils/isomorphic/multimap.js +81 -0
  352. patchright/driver/package/lib/utils/isomorphic/rtti.js +43 -0
  353. patchright/driver/package/lib/utils/isomorphic/selectorParser.js +387 -0
  354. patchright/driver/package/lib/utils/isomorphic/semaphore.js +54 -0
  355. patchright/driver/package/lib/utils/isomorphic/stackTrace.js +158 -0
  356. patchright/driver/package/lib/utils/isomorphic/stringUtils.js +176 -0
  357. patchright/driver/package/lib/utils/isomorphic/time.js +44 -0
  358. patchright/driver/package/lib/utils/isomorphic/timeoutRunner.js +67 -0
  359. patchright/driver/package/lib/utils/isomorphic/traceUtils.js +59 -0
  360. patchright/driver/package/lib/utils/isomorphic/types.js +16 -0
  361. patchright/driver/package/lib/utils/isomorphic/urlMatch.js +167 -0
  362. patchright/driver/package/lib/utils/isomorphic/utilityScriptSerializers.js +248 -0
  363. patchright/driver/package/lib/utils.js +101 -0
  364. patchright/driver/package/lib/utilsBundle.js +106 -0
  365. patchright/driver/package/lib/utilsBundleImpl/index.js +208 -0
  366. patchright/driver/package/lib/utilsBundleImpl/xdg-open +1066 -0
  367. patchright/driver/package/lib/zipBundle.js +34 -0
  368. patchright/driver/package/lib/zipBundleImpl.js +5 -0
  369. patchright/driver/package/package.json +44 -0
  370. patchright/driver/package/protocol.yml +3313 -0
  371. patchright/py.typed +0 -0
  372. patchright/sync_api/__init__.py +179 -0
  373. patchright/sync_api/_context_manager.py +74 -0
  374. patchright/sync_api/_generated.py +20632 -0
  375. pure_patchright-1.52.5.dist-info/LICENSE +201 -0
  376. pure_patchright-1.52.5.dist-info/METADATA +96 -0
  377. pure_patchright-1.52.5.dist-info/RECORD +381 -0
  378. pure_patchright-1.52.5.dist-info/WHEEL +4 -0
  379. pure_patchright-1.52.5.dist-info/entry_points.txt +5 -0
  380. pure_patchright-1.52.5.dist-info/licenses/LICENSE +202 -0
  381. pure_patchright-1.52.5.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1271 @@
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 registry_exports = {};
30
+ __export(registry_exports, {
31
+ Registry: () => Registry,
32
+ browserDirectoryToMarkerFilePath: () => browserDirectoryToMarkerFilePath,
33
+ buildPlaywrightCLICommand: () => buildPlaywrightCLICommand,
34
+ findChromiumChannel: () => findChromiumChannel,
35
+ installBrowsersForNpmInstall: () => installBrowsersForNpmInstall,
36
+ registry: () => registry,
37
+ registryDirectory: () => registryDirectory,
38
+ writeDockerVersion: () => import_dependencies3.writeDockerVersion
39
+ });
40
+ module.exports = __toCommonJS(registry_exports);
41
+ var import_fs = __toESM(require("fs"));
42
+ var import_os = __toESM(require("os"));
43
+ var import_path = __toESM(require("path"));
44
+ var util = __toESM(require("util"));
45
+ var import_browserFetcher = require("./browserFetcher");
46
+ var import_dependencies = require("./dependencies");
47
+ var import_dependencies2 = require("./dependencies");
48
+ var import_utils = require("../../utils");
49
+ var import_ascii = require("../utils/ascii");
50
+ var import_debugLogger = require("../utils/debugLogger");
51
+ var import_hostPlatform = require("../utils/hostPlatform");
52
+ var import_network = require("../utils/network");
53
+ var import_spawnAsync = require("../utils/spawnAsync");
54
+ var import_userAgent = require("../utils/userAgent");
55
+ var import_utilsBundle = require("../../utilsBundle");
56
+ var import_fileUtils = require("../utils/fileUtils");
57
+ var import_dependencies3 = require("./dependencies");
58
+ const PACKAGE_PATH = import_path.default.join(__dirname, "..", "..", "..");
59
+ const BIN_PATH = import_path.default.join(__dirname, "..", "..", "..", "bin");
60
+ const PLAYWRIGHT_CDN_MIRRORS = [
61
+ "https://cdn.playwright.dev/dbazure/download/playwright",
62
+ // ESRP CDN
63
+ "https://playwright.download.prss.microsoft.com/dbazure/download/playwright",
64
+ // Directly hit ESRP CDN
65
+ "https://cdn.playwright.dev"
66
+ // Hit the Storage Bucket directly
67
+ ];
68
+ if (process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
69
+ for (let i = 0; i < PLAYWRIGHT_CDN_MIRRORS.length; i++) {
70
+ const cdn = PLAYWRIGHT_CDN_MIRRORS[i];
71
+ if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
72
+ const parsedCDN = new URL(cdn);
73
+ parsedCDN.hostname = parsedCDN.hostname + ".does-not-resolve.playwright.dev";
74
+ PLAYWRIGHT_CDN_MIRRORS[i] = parsedCDN.toString();
75
+ }
76
+ }
77
+ }
78
+ const EXECUTABLE_PATHS = {
79
+ "chromium": {
80
+ "linux": ["chrome-linux", "chrome"],
81
+ "mac": ["chrome-mac", "Chromium.app", "Contents", "MacOS", "Chromium"],
82
+ "win": ["chrome-win", "chrome.exe"]
83
+ },
84
+ "chromium-headless-shell": {
85
+ "linux": ["chrome-linux", "headless_shell"],
86
+ "mac": ["chrome-mac", "headless_shell"],
87
+ "win": ["chrome-win", "headless_shell.exe"]
88
+ },
89
+ "firefox": {
90
+ "linux": ["firefox", "firefox"],
91
+ "mac": ["firefox", "Nightly.app", "Contents", "MacOS", "firefox"],
92
+ "win": ["firefox", "firefox.exe"]
93
+ },
94
+ "webkit": {
95
+ "linux": ["pw_run.sh"],
96
+ "mac": ["pw_run.sh"],
97
+ "win": ["Playwright.exe"]
98
+ },
99
+ "ffmpeg": {
100
+ "linux": ["ffmpeg-linux"],
101
+ "mac": ["ffmpeg-mac"],
102
+ "win": ["ffmpeg-win64.exe"]
103
+ },
104
+ "winldd": {
105
+ "linux": void 0,
106
+ "mac": void 0,
107
+ "win": ["PrintDeps.exe"]
108
+ }
109
+ };
110
+ const DOWNLOAD_PATHS = {
111
+ "chromium": {
112
+ "<unknown>": void 0,
113
+ "ubuntu18.04-x64": void 0,
114
+ "ubuntu20.04-x64": "builds/chromium/%s/chromium-linux.zip",
115
+ "ubuntu22.04-x64": "builds/chromium/%s/chromium-linux.zip",
116
+ "ubuntu24.04-x64": "builds/chromium/%s/chromium-linux.zip",
117
+ "ubuntu18.04-arm64": void 0,
118
+ "ubuntu20.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
119
+ "ubuntu22.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
120
+ "ubuntu24.04-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
121
+ "debian11-x64": "builds/chromium/%s/chromium-linux.zip",
122
+ "debian11-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
123
+ "debian12-x64": "builds/chromium/%s/chromium-linux.zip",
124
+ "debian12-arm64": "builds/chromium/%s/chromium-linux-arm64.zip",
125
+ "mac10.13": "builds/chromium/%s/chromium-mac.zip",
126
+ "mac10.14": "builds/chromium/%s/chromium-mac.zip",
127
+ "mac10.15": "builds/chromium/%s/chromium-mac.zip",
128
+ "mac11": "builds/chromium/%s/chromium-mac.zip",
129
+ "mac11-arm64": "builds/chromium/%s/chromium-mac-arm64.zip",
130
+ "mac12": "builds/chromium/%s/chromium-mac.zip",
131
+ "mac12-arm64": "builds/chromium/%s/chromium-mac-arm64.zip",
132
+ "mac13": "builds/chromium/%s/chromium-mac.zip",
133
+ "mac13-arm64": "builds/chromium/%s/chromium-mac-arm64.zip",
134
+ "mac14": "builds/chromium/%s/chromium-mac.zip",
135
+ "mac14-arm64": "builds/chromium/%s/chromium-mac-arm64.zip",
136
+ "mac15": "builds/chromium/%s/chromium-mac.zip",
137
+ "mac15-arm64": "builds/chromium/%s/chromium-mac-arm64.zip",
138
+ "win64": "builds/chromium/%s/chromium-win64.zip"
139
+ },
140
+ "chromium-headless-shell": {
141
+ "<unknown>": void 0,
142
+ "ubuntu18.04-x64": void 0,
143
+ "ubuntu20.04-x64": "builds/chromium/%s/chromium-headless-shell-linux.zip",
144
+ "ubuntu22.04-x64": "builds/chromium/%s/chromium-headless-shell-linux.zip",
145
+ "ubuntu24.04-x64": "builds/chromium/%s/chromium-headless-shell-linux.zip",
146
+ "ubuntu18.04-arm64": void 0,
147
+ "ubuntu20.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
148
+ "ubuntu22.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
149
+ "ubuntu24.04-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
150
+ "debian11-x64": "builds/chromium/%s/chromium-headless-shell-linux.zip",
151
+ "debian11-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
152
+ "debian12-x64": "builds/chromium/%s/chromium-headless-shell-linux.zip",
153
+ "debian12-arm64": "builds/chromium/%s/chromium-headless-shell-linux-arm64.zip",
154
+ "mac10.13": void 0,
155
+ "mac10.14": void 0,
156
+ "mac10.15": void 0,
157
+ "mac11": "builds/chromium/%s/chromium-headless-shell-mac.zip",
158
+ "mac11-arm64": "builds/chromium/%s/chromium-headless-shell-mac-arm64.zip",
159
+ "mac12": "builds/chromium/%s/chromium-headless-shell-mac.zip",
160
+ "mac12-arm64": "builds/chromium/%s/chromium-headless-shell-mac-arm64.zip",
161
+ "mac13": "builds/chromium/%s/chromium-headless-shell-mac.zip",
162
+ "mac13-arm64": "builds/chromium/%s/chromium-headless-shell-mac-arm64.zip",
163
+ "mac14": "builds/chromium/%s/chromium-headless-shell-mac.zip",
164
+ "mac14-arm64": "builds/chromium/%s/chromium-headless-shell-mac-arm64.zip",
165
+ "mac15": "builds/chromium/%s/chromium-headless-shell-mac.zip",
166
+ "mac15-arm64": "builds/chromium/%s/chromium-headless-shell-mac-arm64.zip",
167
+ "win64": "builds/chromium/%s/chromium-headless-shell-win64.zip"
168
+ },
169
+ "chromium-tip-of-tree": {
170
+ "<unknown>": void 0,
171
+ "ubuntu18.04-x64": void 0,
172
+ "ubuntu20.04-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip",
173
+ "ubuntu22.04-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip",
174
+ "ubuntu24.04-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip",
175
+ "ubuntu18.04-arm64": void 0,
176
+ "ubuntu20.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
177
+ "ubuntu22.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
178
+ "ubuntu24.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
179
+ "debian11-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip",
180
+ "debian11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
181
+ "debian12-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip",
182
+ "debian12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip",
183
+ "mac10.13": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
184
+ "mac10.14": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
185
+ "mac10.15": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
186
+ "mac11": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
187
+ "mac11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac-arm64.zip",
188
+ "mac12": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
189
+ "mac12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac-arm64.zip",
190
+ "mac13": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
191
+ "mac13-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac-arm64.zip",
192
+ "mac14": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
193
+ "mac14-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac-arm64.zip",
194
+ "mac15": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac.zip",
195
+ "mac15-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac-arm64.zip",
196
+ "win64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-win64.zip"
197
+ },
198
+ "chromium-tip-of-tree-headless-shell": {
199
+ "<unknown>": void 0,
200
+ "ubuntu18.04-x64": void 0,
201
+ "ubuntu20.04-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip",
202
+ "ubuntu22.04-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip",
203
+ "ubuntu24.04-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip",
204
+ "ubuntu18.04-arm64": void 0,
205
+ "ubuntu20.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
206
+ "ubuntu22.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
207
+ "ubuntu24.04-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
208
+ "debian11-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip",
209
+ "debian11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
210
+ "debian12-x64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip",
211
+ "debian12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip",
212
+ "mac10.13": void 0,
213
+ "mac10.14": void 0,
214
+ "mac10.15": void 0,
215
+ "mac11": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip",
216
+ "mac11-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip",
217
+ "mac12": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip",
218
+ "mac12-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip",
219
+ "mac13": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip",
220
+ "mac13-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip",
221
+ "mac14": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip",
222
+ "mac14-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip",
223
+ "mac15": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip",
224
+ "mac15-arm64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip",
225
+ "win64": "builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-win64.zip"
226
+ },
227
+ "firefox": {
228
+ "<unknown>": void 0,
229
+ "ubuntu18.04-x64": void 0,
230
+ "ubuntu20.04-x64": "builds/firefox/%s/firefox-ubuntu-20.04.zip",
231
+ "ubuntu22.04-x64": "builds/firefox/%s/firefox-ubuntu-22.04.zip",
232
+ "ubuntu24.04-x64": "builds/firefox/%s/firefox-ubuntu-24.04.zip",
233
+ "ubuntu18.04-arm64": void 0,
234
+ "ubuntu20.04-arm64": "builds/firefox/%s/firefox-ubuntu-20.04-arm64.zip",
235
+ "ubuntu22.04-arm64": "builds/firefox/%s/firefox-ubuntu-22.04-arm64.zip",
236
+ "ubuntu24.04-arm64": "builds/firefox/%s/firefox-ubuntu-24.04-arm64.zip",
237
+ "debian11-x64": "builds/firefox/%s/firefox-debian-11.zip",
238
+ "debian11-arm64": "builds/firefox/%s/firefox-debian-11-arm64.zip",
239
+ "debian12-x64": "builds/firefox/%s/firefox-debian-12.zip",
240
+ "debian12-arm64": "builds/firefox/%s/firefox-debian-12-arm64.zip",
241
+ "mac10.13": "builds/firefox/%s/firefox-mac.zip",
242
+ "mac10.14": "builds/firefox/%s/firefox-mac.zip",
243
+ "mac10.15": "builds/firefox/%s/firefox-mac.zip",
244
+ "mac11": "builds/firefox/%s/firefox-mac.zip",
245
+ "mac11-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
246
+ "mac12": "builds/firefox/%s/firefox-mac.zip",
247
+ "mac12-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
248
+ "mac13": "builds/firefox/%s/firefox-mac.zip",
249
+ "mac13-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
250
+ "mac14": "builds/firefox/%s/firefox-mac.zip",
251
+ "mac14-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
252
+ "mac15": "builds/firefox/%s/firefox-mac.zip",
253
+ "mac15-arm64": "builds/firefox/%s/firefox-mac-arm64.zip",
254
+ "win64": "builds/firefox/%s/firefox-win64.zip"
255
+ },
256
+ "firefox-beta": {
257
+ "<unknown>": void 0,
258
+ "ubuntu18.04-x64": void 0,
259
+ "ubuntu20.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-20.04.zip",
260
+ "ubuntu22.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-22.04.zip",
261
+ "ubuntu24.04-x64": "builds/firefox-beta/%s/firefox-beta-ubuntu-24.04.zip",
262
+ "ubuntu18.04-arm64": void 0,
263
+ "ubuntu20.04-arm64": void 0,
264
+ "ubuntu22.04-arm64": "builds/firefox-beta/%s/firefox-beta-ubuntu-22.04-arm64.zip",
265
+ "ubuntu24.04-arm64": "builds/firefox-beta/%s/firefox-beta-ubuntu-24.04-arm64.zip",
266
+ "debian11-x64": "builds/firefox-beta/%s/firefox-beta-debian-11.zip",
267
+ "debian11-arm64": "builds/firefox-beta/%s/firefox-beta-debian-11-arm64.zip",
268
+ "debian12-x64": "builds/firefox-beta/%s/firefox-beta-debian-12.zip",
269
+ "debian12-arm64": "builds/firefox-beta/%s/firefox-beta-debian-12-arm64.zip",
270
+ "mac10.13": "builds/firefox-beta/%s/firefox-beta-mac.zip",
271
+ "mac10.14": "builds/firefox-beta/%s/firefox-beta-mac.zip",
272
+ "mac10.15": "builds/firefox-beta/%s/firefox-beta-mac.zip",
273
+ "mac11": "builds/firefox-beta/%s/firefox-beta-mac.zip",
274
+ "mac11-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
275
+ "mac12": "builds/firefox-beta/%s/firefox-beta-mac.zip",
276
+ "mac12-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
277
+ "mac13": "builds/firefox-beta/%s/firefox-beta-mac.zip",
278
+ "mac13-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
279
+ "mac14": "builds/firefox-beta/%s/firefox-beta-mac.zip",
280
+ "mac14-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
281
+ "mac15": "builds/firefox-beta/%s/firefox-beta-mac.zip",
282
+ "mac15-arm64": "builds/firefox-beta/%s/firefox-beta-mac-arm64.zip",
283
+ "win64": "builds/firefox-beta/%s/firefox-beta-win64.zip"
284
+ },
285
+ "webkit": {
286
+ "<unknown>": void 0,
287
+ "ubuntu18.04-x64": void 0,
288
+ "ubuntu20.04-x64": "builds/webkit/%s/webkit-ubuntu-20.04.zip",
289
+ "ubuntu22.04-x64": "builds/webkit/%s/webkit-ubuntu-22.04.zip",
290
+ "ubuntu24.04-x64": "builds/webkit/%s/webkit-ubuntu-24.04.zip",
291
+ "ubuntu18.04-arm64": void 0,
292
+ "ubuntu20.04-arm64": "builds/webkit/%s/webkit-ubuntu-20.04-arm64.zip",
293
+ "ubuntu22.04-arm64": "builds/webkit/%s/webkit-ubuntu-22.04-arm64.zip",
294
+ "ubuntu24.04-arm64": "builds/webkit/%s/webkit-ubuntu-24.04-arm64.zip",
295
+ "debian11-x64": "builds/webkit/%s/webkit-debian-11.zip",
296
+ "debian11-arm64": "builds/webkit/%s/webkit-debian-11-arm64.zip",
297
+ "debian12-x64": "builds/webkit/%s/webkit-debian-12.zip",
298
+ "debian12-arm64": "builds/webkit/%s/webkit-debian-12-arm64.zip",
299
+ "mac10.13": void 0,
300
+ "mac10.14": "builds/deprecated-webkit-mac-10.14/%s/deprecated-webkit-mac-10.14.zip",
301
+ "mac10.15": "builds/deprecated-webkit-mac-10.15/%s/deprecated-webkit-mac-10.15.zip",
302
+ "mac11": "builds/webkit/%s/webkit-mac-11.zip",
303
+ "mac11-arm64": "builds/webkit/%s/webkit-mac-11-arm64.zip",
304
+ "mac12": "builds/webkit/%s/webkit-mac-12.zip",
305
+ "mac12-arm64": "builds/webkit/%s/webkit-mac-12-arm64.zip",
306
+ "mac13": "builds/webkit/%s/webkit-mac-13.zip",
307
+ "mac13-arm64": "builds/webkit/%s/webkit-mac-13-arm64.zip",
308
+ "mac14": "builds/webkit/%s/webkit-mac-14.zip",
309
+ "mac14-arm64": "builds/webkit/%s/webkit-mac-14-arm64.zip",
310
+ "mac15": "builds/webkit/%s/webkit-mac-15.zip",
311
+ "mac15-arm64": "builds/webkit/%s/webkit-mac-15-arm64.zip",
312
+ "win64": "builds/webkit/%s/webkit-win64.zip"
313
+ },
314
+ "ffmpeg": {
315
+ "<unknown>": void 0,
316
+ "ubuntu18.04-x64": void 0,
317
+ "ubuntu20.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
318
+ "ubuntu22.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
319
+ "ubuntu24.04-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
320
+ "ubuntu18.04-arm64": void 0,
321
+ "ubuntu20.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
322
+ "ubuntu22.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
323
+ "ubuntu24.04-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
324
+ "debian11-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
325
+ "debian11-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
326
+ "debian12-x64": "builds/ffmpeg/%s/ffmpeg-linux.zip",
327
+ "debian12-arm64": "builds/ffmpeg/%s/ffmpeg-linux-arm64.zip",
328
+ "mac10.13": "builds/ffmpeg/%s/ffmpeg-mac.zip",
329
+ "mac10.14": "builds/ffmpeg/%s/ffmpeg-mac.zip",
330
+ "mac10.15": "builds/ffmpeg/%s/ffmpeg-mac.zip",
331
+ "mac11": "builds/ffmpeg/%s/ffmpeg-mac.zip",
332
+ "mac11-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
333
+ "mac12": "builds/ffmpeg/%s/ffmpeg-mac.zip",
334
+ "mac12-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
335
+ "mac13": "builds/ffmpeg/%s/ffmpeg-mac.zip",
336
+ "mac13-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
337
+ "mac14": "builds/ffmpeg/%s/ffmpeg-mac.zip",
338
+ "mac14-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
339
+ "mac15": "builds/ffmpeg/%s/ffmpeg-mac.zip",
340
+ "mac15-arm64": "builds/ffmpeg/%s/ffmpeg-mac-arm64.zip",
341
+ "win64": "builds/ffmpeg/%s/ffmpeg-win64.zip"
342
+ },
343
+ "winldd": {
344
+ "<unknown>": void 0,
345
+ "ubuntu18.04-x64": void 0,
346
+ "ubuntu20.04-x64": void 0,
347
+ "ubuntu22.04-x64": void 0,
348
+ "ubuntu24.04-x64": void 0,
349
+ "ubuntu18.04-arm64": void 0,
350
+ "ubuntu20.04-arm64": void 0,
351
+ "ubuntu22.04-arm64": void 0,
352
+ "ubuntu24.04-arm64": void 0,
353
+ "debian11-x64": void 0,
354
+ "debian11-arm64": void 0,
355
+ "debian12-x64": void 0,
356
+ "debian12-arm64": void 0,
357
+ "mac10.13": void 0,
358
+ "mac10.14": void 0,
359
+ "mac10.15": void 0,
360
+ "mac11": void 0,
361
+ "mac11-arm64": void 0,
362
+ "mac12": void 0,
363
+ "mac12-arm64": void 0,
364
+ "mac13": void 0,
365
+ "mac13-arm64": void 0,
366
+ "mac14": void 0,
367
+ "mac14-arm64": void 0,
368
+ "mac15": void 0,
369
+ "mac15-arm64": void 0,
370
+ "win64": "builds/winldd/%s/winldd-win64.zip"
371
+ },
372
+ "android": {
373
+ "<unknown>": "builds/android/%s/android.zip",
374
+ "ubuntu18.04-x64": void 0,
375
+ "ubuntu20.04-x64": "builds/android/%s/android.zip",
376
+ "ubuntu22.04-x64": "builds/android/%s/android.zip",
377
+ "ubuntu24.04-x64": "builds/android/%s/android.zip",
378
+ "ubuntu18.04-arm64": void 0,
379
+ "ubuntu20.04-arm64": "builds/android/%s/android.zip",
380
+ "ubuntu22.04-arm64": "builds/android/%s/android.zip",
381
+ "ubuntu24.04-arm64": "builds/android/%s/android.zip",
382
+ "debian11-x64": "builds/android/%s/android.zip",
383
+ "debian11-arm64": "builds/android/%s/android.zip",
384
+ "debian12-x64": "builds/android/%s/android.zip",
385
+ "debian12-arm64": "builds/android/%s/android.zip",
386
+ "mac10.13": "builds/android/%s/android.zip",
387
+ "mac10.14": "builds/android/%s/android.zip",
388
+ "mac10.15": "builds/android/%s/android.zip",
389
+ "mac11": "builds/android/%s/android.zip",
390
+ "mac11-arm64": "builds/android/%s/android.zip",
391
+ "mac12": "builds/android/%s/android.zip",
392
+ "mac12-arm64": "builds/android/%s/android.zip",
393
+ "mac13": "builds/android/%s/android.zip",
394
+ "mac13-arm64": "builds/android/%s/android.zip",
395
+ "mac14": "builds/android/%s/android.zip",
396
+ "mac14-arm64": "builds/android/%s/android.zip",
397
+ "mac15": "builds/android/%s/android.zip",
398
+ "mac15-arm64": "builds/android/%s/android.zip",
399
+ "win64": "builds/android/%s/android.zip"
400
+ },
401
+ // TODO(bidi): implement downloads.
402
+ "bidi": {}
403
+ };
404
+ const registryDirectory = (() => {
405
+ let result;
406
+ const envDefined = (0, import_utils.getFromENV)("PLAYWRIGHT_BROWSERS_PATH");
407
+ if (envDefined === "0") {
408
+ result = import_path.default.join(__dirname, "..", "..", "..", ".local-browsers");
409
+ } else if (envDefined) {
410
+ result = envDefined;
411
+ } else {
412
+ let cacheDirectory;
413
+ if (process.platform === "linux")
414
+ cacheDirectory = process.env.XDG_CACHE_HOME || import_path.default.join(import_os.default.homedir(), ".cache");
415
+ else if (process.platform === "darwin")
416
+ cacheDirectory = import_path.default.join(import_os.default.homedir(), "Library", "Caches");
417
+ else if (process.platform === "win32")
418
+ cacheDirectory = process.env.LOCALAPPDATA || import_path.default.join(import_os.default.homedir(), "AppData", "Local");
419
+ else
420
+ throw new Error("Unsupported platform: " + process.platform);
421
+ result = import_path.default.join(cacheDirectory, "ms-playwright");
422
+ }
423
+ if (!import_path.default.isAbsolute(result)) {
424
+ result = import_path.default.resolve((0, import_utils.getFromENV)("INIT_CWD") || process.cwd(), result);
425
+ }
426
+ return result;
427
+ })();
428
+ function isBrowserDirectory(browserDirectory) {
429
+ const baseName = import_path.default.basename(browserDirectory);
430
+ for (const browserName of allDownloadable) {
431
+ if (baseName.startsWith(browserName.replace(/-/g, "_") + "-"))
432
+ return true;
433
+ }
434
+ return false;
435
+ }
436
+ function readDescriptors(browsersJSON) {
437
+ return browsersJSON["browsers"].map((obj) => {
438
+ const name = obj.name;
439
+ const revisionOverride = (obj.revisionOverrides || {})[import_hostPlatform.hostPlatform];
440
+ const revision = revisionOverride || obj.revision;
441
+ const browserDirectoryPrefix = revisionOverride ? `${name}_${import_hostPlatform.hostPlatform}_special` : `${name}`;
442
+ const descriptor = {
443
+ name,
444
+ revision,
445
+ hasRevisionOverride: !!revisionOverride,
446
+ // We only put browser version for the supported operating systems.
447
+ browserVersion: revisionOverride ? void 0 : obj.browserVersion,
448
+ installByDefault: !!obj.installByDefault,
449
+ // Method `isBrowserDirectory` determines directory to be browser iff
450
+ // it starts with some browser name followed by '-'. Some browser names
451
+ // are prefixes of others, e.g. 'webkit' is a prefix of `webkit-technology-preview`.
452
+ // To avoid older registries erroneously removing 'webkit-technology-preview', we have to
453
+ // ensure that browser folders to never include dashes inside.
454
+ dir: import_path.default.join(registryDirectory, browserDirectoryPrefix.replace(/-/g, "_") + "-" + revision)
455
+ };
456
+ return descriptor;
457
+ });
458
+ }
459
+ const allDownloadable = ["android", "chromium", "firefox", "webkit", "ffmpeg", "firefox-beta", "chromium-tip-of-tree", "chromium-headless-shell", "chromium-tip-of-tree-headless-shell"];
460
+ class Registry {
461
+ constructor(browsersJSON) {
462
+ const descriptors = readDescriptors(browsersJSON);
463
+ const findExecutablePath = (dir, name) => {
464
+ let tokens = void 0;
465
+ if (process.platform === "linux")
466
+ tokens = EXECUTABLE_PATHS[name]["linux"];
467
+ else if (process.platform === "darwin")
468
+ tokens = EXECUTABLE_PATHS[name]["mac"];
469
+ else if (process.platform === "win32")
470
+ tokens = EXECUTABLE_PATHS[name]["win"];
471
+ return tokens ? import_path.default.join(dir, ...tokens) : void 0;
472
+ };
473
+ const executablePathOrDie = (name, e, installByDefault, sdkLanguage) => {
474
+ if (!e)
475
+ throw new Error(`${name} is not supported on ${import_hostPlatform.hostPlatform}`);
476
+ const installCommand = buildPlaywrightCLICommand(sdkLanguage, `install${installByDefault ? "" : " " + name}`);
477
+ if (!(0, import_fileUtils.canAccessFile)(e)) {
478
+ const currentDockerVersion = (0, import_dependencies.readDockerVersionSync)();
479
+ const preferredDockerVersion = currentDockerVersion ? (0, import_dependencies.dockerVersion)(currentDockerVersion.dockerImageNameTemplate) : null;
480
+ const isOutdatedDockerImage = currentDockerVersion && preferredDockerVersion && currentDockerVersion.dockerImageName !== preferredDockerVersion.dockerImageName;
481
+ const prettyMessage = isOutdatedDockerImage ? [
482
+ `Looks like ${sdkLanguage === "javascript" ? "Playwright Test or " : ""}Playwright was just updated to ${preferredDockerVersion.driverVersion}.`,
483
+ `Please update docker image as well.`,
484
+ `- current: ${currentDockerVersion.dockerImageName}`,
485
+ `- required: ${preferredDockerVersion.dockerImageName}`,
486
+ ``,
487
+ `<3 Playwright Team`
488
+ ].join("\n") : [
489
+ `Looks like ${sdkLanguage === "javascript" ? "Playwright Test or " : ""}Playwright was just installed or updated.`,
490
+ `Please run the following command to download new browser${installByDefault ? "s" : ""}:`,
491
+ ``,
492
+ ` ${installCommand}`,
493
+ ``,
494
+ `<3 Playwright Team`
495
+ ].join("\n");
496
+ throw new Error(`Executable doesn't exist at ${e}
497
+ ${(0, import_ascii.wrapInASCIIBox)(prettyMessage, 1)}`);
498
+ }
499
+ return e;
500
+ };
501
+ this._executables = [];
502
+ const chromium = descriptors.find((d) => d.name === "chromium");
503
+ const chromiumExecutable = findExecutablePath(chromium.dir, "chromium");
504
+ this._executables.push({
505
+ type: "browser",
506
+ name: "chromium",
507
+ browserName: "chromium",
508
+ directory: chromium.dir,
509
+ executablePath: () => chromiumExecutable,
510
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumExecutable, chromium.installByDefault, sdkLanguage),
511
+ installType: chromium.installByDefault ? "download-by-default" : "download-on-demand",
512
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromium.dir, ["chrome-linux"], [], ["chrome-win"]),
513
+ downloadURLs: this._downloadURLs(chromium),
514
+ browserVersion: chromium.browserVersion,
515
+ _install: () => this._downloadExecutable(chromium, chromiumExecutable),
516
+ _dependencyGroup: "chromium",
517
+ _isHermeticInstallation: true
518
+ });
519
+ const chromiumHeadlessShell = descriptors.find((d) => d.name === "chromium-headless-shell");
520
+ const chromiumHeadlessShellExecutable = findExecutablePath(chromiumHeadlessShell.dir, "chromium-headless-shell");
521
+ this._executables.push({
522
+ type: "channel",
523
+ name: "chromium-headless-shell",
524
+ browserName: "chromium",
525
+ directory: chromiumHeadlessShell.dir,
526
+ executablePath: () => chromiumHeadlessShellExecutable,
527
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumHeadlessShellExecutable, chromiumHeadlessShell.installByDefault, sdkLanguage),
528
+ installType: chromiumHeadlessShell.installByDefault ? "download-by-default" : "download-on-demand",
529
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumHeadlessShell.dir, ["chrome-linux"], [], ["chrome-win"]),
530
+ downloadURLs: this._downloadURLs(chromiumHeadlessShell),
531
+ browserVersion: chromium.browserVersion,
532
+ _install: () => this._downloadExecutable(chromiumHeadlessShell, chromiumHeadlessShellExecutable),
533
+ _dependencyGroup: "chromium",
534
+ _isHermeticInstallation: true
535
+ });
536
+ const chromiumTipOfTreeHeadlessShell = descriptors.find((d) => d.name === "chromium-tip-of-tree-headless-shell");
537
+ const chromiumTipOfTreeHeadlessShellExecutable = findExecutablePath(chromiumTipOfTreeHeadlessShell.dir, "chromium-headless-shell");
538
+ this._executables.push({
539
+ type: "channel",
540
+ name: "chromium-tip-of-tree-headless-shell",
541
+ browserName: "chromium",
542
+ directory: chromiumTipOfTreeHeadlessShell.dir,
543
+ executablePath: () => chromiumTipOfTreeHeadlessShellExecutable,
544
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumTipOfTreeHeadlessShellExecutable, chromiumTipOfTreeHeadlessShell.installByDefault, sdkLanguage),
545
+ installType: chromiumTipOfTreeHeadlessShell.installByDefault ? "download-by-default" : "download-on-demand",
546
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumTipOfTreeHeadlessShell.dir, ["chrome-linux"], [], ["chrome-win"]),
547
+ downloadURLs: this._downloadURLs(chromiumTipOfTreeHeadlessShell),
548
+ browserVersion: chromium.browserVersion,
549
+ _install: () => this._downloadExecutable(chromiumTipOfTreeHeadlessShell, chromiumTipOfTreeHeadlessShellExecutable),
550
+ _dependencyGroup: "chromium",
551
+ _isHermeticInstallation: true
552
+ });
553
+ const chromiumTipOfTree = descriptors.find((d) => d.name === "chromium-tip-of-tree");
554
+ const chromiumTipOfTreeExecutable = findExecutablePath(chromiumTipOfTree.dir, "chromium");
555
+ this._executables.push({
556
+ type: "tool",
557
+ name: "chromium-tip-of-tree",
558
+ browserName: "chromium",
559
+ directory: chromiumTipOfTree.dir,
560
+ executablePath: () => chromiumTipOfTreeExecutable,
561
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium-tip-of-tree", chromiumTipOfTreeExecutable, chromiumTipOfTree.installByDefault, sdkLanguage),
562
+ installType: chromiumTipOfTree.installByDefault ? "download-by-default" : "download-on-demand",
563
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromiumTipOfTree.dir, ["chrome-linux"], [], ["chrome-win"]),
564
+ downloadURLs: this._downloadURLs(chromiumTipOfTree),
565
+ browserVersion: chromiumTipOfTree.browserVersion,
566
+ _install: () => this._downloadExecutable(chromiumTipOfTree, chromiumTipOfTreeExecutable),
567
+ _dependencyGroup: "chromium",
568
+ _isHermeticInstallation: true
569
+ });
570
+ this._executables.push(this._createChromiumChannel("chrome", {
571
+ "linux": "/opt/google/chrome/chrome",
572
+ "darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
573
+ "win32": `\\Google\\Chrome\\Application\\chrome.exe`
574
+ }, () => this._installChromiumChannel("chrome", {
575
+ "linux": "reinstall_chrome_stable_linux.sh",
576
+ "darwin": "reinstall_chrome_stable_mac.sh",
577
+ "win32": "reinstall_chrome_stable_win.ps1"
578
+ })));
579
+ this._executables.push(this._createChromiumChannel("chrome-beta", {
580
+ "linux": "/opt/google/chrome-beta/chrome",
581
+ "darwin": "/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta",
582
+ "win32": `\\Google\\Chrome Beta\\Application\\chrome.exe`
583
+ }, () => this._installChromiumChannel("chrome-beta", {
584
+ "linux": "reinstall_chrome_beta_linux.sh",
585
+ "darwin": "reinstall_chrome_beta_mac.sh",
586
+ "win32": "reinstall_chrome_beta_win.ps1"
587
+ })));
588
+ this._executables.push(this._createChromiumChannel("chrome-dev", {
589
+ "linux": "/opt/google/chrome-unstable/chrome",
590
+ "darwin": "/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev",
591
+ "win32": `\\Google\\Chrome Dev\\Application\\chrome.exe`
592
+ }));
593
+ this._executables.push(this._createChromiumChannel("chrome-canary", {
594
+ "linux": "",
595
+ "darwin": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
596
+ "win32": `\\Google\\Chrome SxS\\Application\\chrome.exe`
597
+ }));
598
+ this._executables.push(this._createChromiumChannel("msedge", {
599
+ "linux": "/opt/microsoft/msedge/msedge",
600
+ "darwin": "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
601
+ "win32": `\\Microsoft\\Edge\\Application\\msedge.exe`
602
+ }, () => this._installMSEdgeChannel("msedge", {
603
+ "linux": "reinstall_msedge_stable_linux.sh",
604
+ "darwin": "reinstall_msedge_stable_mac.sh",
605
+ "win32": "reinstall_msedge_stable_win.ps1"
606
+ })));
607
+ this._executables.push(this._createChromiumChannel("msedge-beta", {
608
+ "linux": "/opt/microsoft/msedge-beta/msedge",
609
+ "darwin": "/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta",
610
+ "win32": `\\Microsoft\\Edge Beta\\Application\\msedge.exe`
611
+ }, () => this._installMSEdgeChannel("msedge-beta", {
612
+ "darwin": "reinstall_msedge_beta_mac.sh",
613
+ "linux": "reinstall_msedge_beta_linux.sh",
614
+ "win32": "reinstall_msedge_beta_win.ps1"
615
+ })));
616
+ this._executables.push(this._createChromiumChannel("msedge-dev", {
617
+ "linux": "/opt/microsoft/msedge-dev/msedge",
618
+ "darwin": "/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev",
619
+ "win32": `\\Microsoft\\Edge Dev\\Application\\msedge.exe`
620
+ }, () => this._installMSEdgeChannel("msedge-dev", {
621
+ "darwin": "reinstall_msedge_dev_mac.sh",
622
+ "linux": "reinstall_msedge_dev_linux.sh",
623
+ "win32": "reinstall_msedge_dev_win.ps1"
624
+ })));
625
+ this._executables.push(this._createChromiumChannel("msedge-canary", {
626
+ "linux": "",
627
+ "darwin": "/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary",
628
+ "win32": `\\Microsoft\\Edge SxS\\Application\\msedge.exe`
629
+ }));
630
+ this._executables.push(this._createBidiFirefoxChannel("moz-firefox", {
631
+ "linux": "/snap/bin/firefox",
632
+ "darwin": "/Applications/Firefox.app/Contents/MacOS/firefox",
633
+ "win32": "\\Mozilla Firefox\\firefox.exe"
634
+ }));
635
+ this._executables.push(this._createBidiFirefoxChannel("moz-firefox-beta", {
636
+ "linux": "/opt/firefox-beta/firefox",
637
+ "darwin": "/Applications/Firefox.app/Contents/MacOS/firefox",
638
+ "win32": "\\Mozilla Firefox\\firefox.exe"
639
+ }));
640
+ this._executables.push(this._createBidiFirefoxChannel("moz-firefox-nightly", {
641
+ "linux": "/opt/firefox-nightly/firefox",
642
+ "darwin": "/Applications/Firefox Nightly.app/Contents/MacOS/firefox",
643
+ "win32": "\\Mozilla Firefox\\firefox.exe"
644
+ }));
645
+ this._executables.push(this._createBidiChromiumChannel("bidi-chrome-stable", {
646
+ "linux": "/opt/google/chrome/chrome",
647
+ "darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
648
+ "win32": `\\Google\\Chrome\\Application\\chrome.exe`
649
+ }));
650
+ this._executables.push(this._createBidiChromiumChannel("bidi-chrome-canary", {
651
+ "linux": "",
652
+ "darwin": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
653
+ "win32": `\\Google\\Chrome SxS\\Application\\chrome.exe`
654
+ }));
655
+ this._executables.push({
656
+ type: "browser",
657
+ name: "bidi-chromium",
658
+ browserName: "bidi",
659
+ directory: chromium.dir,
660
+ executablePath: () => chromiumExecutable,
661
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumExecutable, chromium.installByDefault, sdkLanguage),
662
+ installType: "download-on-demand",
663
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, chromium.dir, ["chrome-linux"], [], ["chrome-win"]),
664
+ downloadURLs: this._downloadURLs(chromium),
665
+ browserVersion: chromium.browserVersion,
666
+ _install: () => this._downloadExecutable(chromium, chromiumExecutable),
667
+ _dependencyGroup: "chromium",
668
+ _isHermeticInstallation: true
669
+ });
670
+ const firefox = descriptors.find((d) => d.name === "firefox");
671
+ const firefoxExecutable = findExecutablePath(firefox.dir, "firefox");
672
+ this._executables.push({
673
+ type: "browser",
674
+ name: "firefox",
675
+ browserName: "firefox",
676
+ directory: firefox.dir,
677
+ executablePath: () => firefoxExecutable,
678
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("firefox", firefoxExecutable, firefox.installByDefault, sdkLanguage),
679
+ installType: firefox.installByDefault ? "download-by-default" : "download-on-demand",
680
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, firefox.dir, ["firefox"], [], ["firefox"]),
681
+ downloadURLs: this._downloadURLs(firefox),
682
+ browserVersion: firefox.browserVersion,
683
+ _install: () => this._downloadExecutable(firefox, firefoxExecutable),
684
+ _dependencyGroup: "firefox",
685
+ _isHermeticInstallation: true
686
+ });
687
+ const firefoxBeta = descriptors.find((d) => d.name === "firefox-beta");
688
+ const firefoxBetaExecutable = findExecutablePath(firefoxBeta.dir, "firefox");
689
+ this._executables.push({
690
+ type: "tool",
691
+ name: "firefox-beta",
692
+ browserName: "firefox",
693
+ directory: firefoxBeta.dir,
694
+ executablePath: () => firefoxBetaExecutable,
695
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("firefox-beta", firefoxBetaExecutable, firefoxBeta.installByDefault, sdkLanguage),
696
+ installType: firefoxBeta.installByDefault ? "download-by-default" : "download-on-demand",
697
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, firefoxBeta.dir, ["firefox"], [], ["firefox"]),
698
+ downloadURLs: this._downloadURLs(firefoxBeta),
699
+ browserVersion: firefoxBeta.browserVersion,
700
+ _install: () => this._downloadExecutable(firefoxBeta, firefoxBetaExecutable),
701
+ _dependencyGroup: "firefox",
702
+ _isHermeticInstallation: true
703
+ });
704
+ const webkit = descriptors.find((d) => d.name === "webkit");
705
+ const webkitExecutable = findExecutablePath(webkit.dir, "webkit");
706
+ const webkitLinuxLddDirectories = [
707
+ import_path.default.join("minibrowser-gtk"),
708
+ import_path.default.join("minibrowser-gtk", "bin"),
709
+ import_path.default.join("minibrowser-gtk", "lib"),
710
+ import_path.default.join("minibrowser-gtk", "sys", "lib"),
711
+ import_path.default.join("minibrowser-wpe"),
712
+ import_path.default.join("minibrowser-wpe", "bin"),
713
+ import_path.default.join("minibrowser-wpe", "lib"),
714
+ import_path.default.join("minibrowser-wpe", "sys", "lib")
715
+ ];
716
+ this._executables.push({
717
+ type: "browser",
718
+ name: "webkit",
719
+ browserName: "webkit",
720
+ directory: webkit.dir,
721
+ executablePath: () => webkitExecutable,
722
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("webkit", webkitExecutable, webkit.installByDefault, sdkLanguage),
723
+ installType: webkit.installByDefault ? "download-by-default" : "download-on-demand",
724
+ _validateHostRequirements: (sdkLanguage) => this._validateHostRequirements(sdkLanguage, webkit.dir, webkitLinuxLddDirectories, ["libGLESv2.so.2", "libx264.so"], [""]),
725
+ downloadURLs: this._downloadURLs(webkit),
726
+ browserVersion: webkit.browserVersion,
727
+ _install: () => this._downloadExecutable(webkit, webkitExecutable),
728
+ _dependencyGroup: "webkit",
729
+ _isHermeticInstallation: true
730
+ });
731
+ const ffmpeg = descriptors.find((d) => d.name === "ffmpeg");
732
+ const ffmpegExecutable = findExecutablePath(ffmpeg.dir, "ffmpeg");
733
+ this._executables.push({
734
+ type: "tool",
735
+ name: "ffmpeg",
736
+ browserName: void 0,
737
+ directory: ffmpeg.dir,
738
+ executablePath: () => ffmpegExecutable,
739
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("ffmpeg", ffmpegExecutable, ffmpeg.installByDefault, sdkLanguage),
740
+ installType: ffmpeg.installByDefault ? "download-by-default" : "download-on-demand",
741
+ _validateHostRequirements: () => Promise.resolve(),
742
+ downloadURLs: this._downloadURLs(ffmpeg),
743
+ _install: () => this._downloadExecutable(ffmpeg, ffmpegExecutable),
744
+ _dependencyGroup: "tools",
745
+ _isHermeticInstallation: true
746
+ });
747
+ const winldd = descriptors.find((d) => d.name === "winldd");
748
+ const winlddExecutable = findExecutablePath(winldd.dir, "winldd");
749
+ this._executables.push({
750
+ type: "tool",
751
+ name: "winldd",
752
+ browserName: void 0,
753
+ directory: winldd.dir,
754
+ executablePath: () => winlddExecutable,
755
+ executablePathOrDie: (sdkLanguage) => executablePathOrDie("winldd", winlddExecutable, winldd.installByDefault, sdkLanguage),
756
+ installType: process.platform === "win32" ? "download-by-default" : "none",
757
+ _validateHostRequirements: () => Promise.resolve(),
758
+ downloadURLs: this._downloadURLs(winldd),
759
+ _install: () => this._downloadExecutable(winldd, winlddExecutable),
760
+ _dependencyGroup: "tools",
761
+ _isHermeticInstallation: true
762
+ });
763
+ const android = descriptors.find((d) => d.name === "android");
764
+ this._executables.push({
765
+ type: "tool",
766
+ name: "android",
767
+ browserName: void 0,
768
+ directory: android.dir,
769
+ executablePath: () => void 0,
770
+ executablePathOrDie: () => "",
771
+ installType: "download-on-demand",
772
+ _validateHostRequirements: () => Promise.resolve(),
773
+ downloadURLs: this._downloadURLs(android),
774
+ _install: () => this._downloadExecutable(android),
775
+ _dependencyGroup: "tools",
776
+ _isHermeticInstallation: true
777
+ });
778
+ this._executables.push({
779
+ type: "browser",
780
+ name: "bidi",
781
+ browserName: "bidi",
782
+ directory: void 0,
783
+ executablePath: () => void 0,
784
+ executablePathOrDie: () => "",
785
+ installType: "none",
786
+ _validateHostRequirements: () => Promise.resolve(),
787
+ downloadURLs: [],
788
+ _install: () => Promise.resolve(),
789
+ _dependencyGroup: "tools",
790
+ _isHermeticInstallation: true
791
+ });
792
+ }
793
+ _createChromiumChannel(name, lookAt, install) {
794
+ const executablePath = (sdkLanguage, shouldThrow) => {
795
+ const suffix = lookAt[process.platform];
796
+ if (!suffix) {
797
+ if (shouldThrow)
798
+ throw new Error(`Chromium distribution '${name}' is not supported on ${process.platform}`);
799
+ return void 0;
800
+ }
801
+ const prefixes = process.platform === "win32" ? [
802
+ process.env.LOCALAPPDATA,
803
+ process.env.PROGRAMFILES,
804
+ process.env["PROGRAMFILES(X86)"],
805
+ // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
806
+ process.env.HOMEDRIVE + "\\Program Files",
807
+ process.env.HOMEDRIVE + "\\Program Files (x86)"
808
+ ].filter(Boolean) : [""];
809
+ for (const prefix of prefixes) {
810
+ const executablePath2 = import_path.default.join(prefix, suffix);
811
+ if ((0, import_fileUtils.canAccessFile)(executablePath2))
812
+ return executablePath2;
813
+ }
814
+ if (!shouldThrow)
815
+ return void 0;
816
+ const location = prefixes.length ? ` at ${import_path.default.join(prefixes[0], suffix)}` : ``;
817
+ const installation = install ? `
818
+ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
819
+ throw new Error(`Chromium distribution '${name}' is not found${location}${installation}`);
820
+ };
821
+ return {
822
+ type: "channel",
823
+ name,
824
+ browserName: "chromium",
825
+ directory: void 0,
826
+ executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
827
+ executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
828
+ installType: install ? "install-script" : "none",
829
+ _validateHostRequirements: () => Promise.resolve(),
830
+ _isHermeticInstallation: false,
831
+ _install: install
832
+ };
833
+ }
834
+ _createBidiFirefoxChannel(name, lookAt, install) {
835
+ const executablePath = (sdkLanguage, shouldThrow) => {
836
+ const suffix = lookAt[process.platform];
837
+ if (!suffix) {
838
+ if (shouldThrow)
839
+ throw new Error(`Firefox distribution '${name}' is not supported on ${process.platform}`);
840
+ return void 0;
841
+ }
842
+ const prefixes = process.platform === "win32" ? [
843
+ process.env.LOCALAPPDATA,
844
+ process.env.PROGRAMFILES,
845
+ process.env["PROGRAMFILES(X86)"],
846
+ // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
847
+ process.env.HOMEDRIVE + "\\Program Files",
848
+ process.env.HOMEDRIVE + "\\Program Files (x86)"
849
+ ].filter(Boolean) : [""];
850
+ for (const prefix of prefixes) {
851
+ const executablePath2 = import_path.default.join(prefix, suffix);
852
+ if ((0, import_fileUtils.canAccessFile)(executablePath2))
853
+ return executablePath2;
854
+ }
855
+ if (shouldThrow)
856
+ throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths.`);
857
+ return void 0;
858
+ };
859
+ return {
860
+ type: "channel",
861
+ name,
862
+ browserName: "bidi",
863
+ directory: void 0,
864
+ executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
865
+ executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
866
+ installType: "none",
867
+ _validateHostRequirements: () => Promise.resolve(),
868
+ _isHermeticInstallation: true,
869
+ _install: install
870
+ };
871
+ }
872
+ _createBidiChromiumChannel(name, lookAt, install) {
873
+ const executablePath = (sdkLanguage, shouldThrow) => {
874
+ const suffix = lookAt[process.platform];
875
+ if (!suffix) {
876
+ if (shouldThrow)
877
+ throw new Error(`Firefox distribution '${name}' is not supported on ${process.platform}`);
878
+ return void 0;
879
+ }
880
+ const prefixes = process.platform === "win32" ? [
881
+ process.env.LOCALAPPDATA,
882
+ process.env.PROGRAMFILES,
883
+ process.env["PROGRAMFILES(X86)"],
884
+ // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
885
+ process.env.HOMEDRIVE + "\\Program Files",
886
+ process.env.HOMEDRIVE + "\\Program Files (x86)"
887
+ ].filter(Boolean) : [""];
888
+ for (const prefix of prefixes) {
889
+ const executablePath2 = import_path.default.join(prefix, suffix);
890
+ if ((0, import_fileUtils.canAccessFile)(executablePath2))
891
+ return executablePath2;
892
+ }
893
+ if (!shouldThrow)
894
+ return void 0;
895
+ const location = prefixes.length ? ` at ${import_path.default.join(prefixes[0], suffix)}` : ``;
896
+ const installation = install ? `
897
+ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
898
+ throw new Error(`Chromium distribution '${name}' is not found${location}${installation}`);
899
+ };
900
+ return {
901
+ type: "channel",
902
+ name,
903
+ browserName: "bidi",
904
+ directory: void 0,
905
+ executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
906
+ executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
907
+ installType: install ? "install-script" : "none",
908
+ _validateHostRequirements: () => Promise.resolve(),
909
+ _isHermeticInstallation: false,
910
+ _install: install
911
+ };
912
+ }
913
+ executables() {
914
+ return this._executables;
915
+ }
916
+ findExecutable(name) {
917
+ return this._executables.find((b) => b.name === name);
918
+ }
919
+ defaultExecutables() {
920
+ return this._executables.filter((e) => e.installType === "download-by-default");
921
+ }
922
+ _dedupe(executables) {
923
+ return Array.from(new Set(executables));
924
+ }
925
+ async _validateHostRequirements(sdkLanguage, browserDirectory, linuxLddDirectories, dlOpenLibraries, windowsExeAndDllDirectories) {
926
+ if (import_os.default.platform() === "linux")
927
+ return await (0, import_dependencies2.validateDependenciesLinux)(sdkLanguage, linuxLddDirectories.map((d) => import_path.default.join(browserDirectory, d)), dlOpenLibraries);
928
+ if (import_os.default.platform() === "win32" && import_os.default.arch() === "x64")
929
+ return await (0, import_dependencies2.validateDependenciesWindows)(sdkLanguage, windowsExeAndDllDirectories.map((d) => import_path.default.join(browserDirectory, d)));
930
+ }
931
+ async installDeps(executablesToInstallDeps, dryRun) {
932
+ const executables = this._dedupe(executablesToInstallDeps);
933
+ const targets = /* @__PURE__ */ new Set();
934
+ for (const executable of executables) {
935
+ if (executable._dependencyGroup)
936
+ targets.add(executable._dependencyGroup);
937
+ }
938
+ targets.add("tools");
939
+ if (import_os.default.platform() === "win32")
940
+ return await (0, import_dependencies2.installDependenciesWindows)(targets, dryRun);
941
+ if (import_os.default.platform() === "linux")
942
+ return await (0, import_dependencies2.installDependenciesLinux)(targets, dryRun);
943
+ }
944
+ async install(executablesToInstall, forceReinstall) {
945
+ const executables = this._dedupe(executablesToInstall);
946
+ await import_fs.default.promises.mkdir(registryDirectory, { recursive: true });
947
+ const lockfilePath = import_path.default.join(registryDirectory, "__dirlock");
948
+ const linksDir = import_path.default.join(registryDirectory, ".links");
949
+ let releaseLock;
950
+ try {
951
+ releaseLock = await import_utilsBundle.lockfile.lock(registryDirectory, {
952
+ retries: {
953
+ // Retry 20 times during 10 minutes with
954
+ // exponential back-off.
955
+ // See documentation at: https://www.npmjs.com/package/retry#retrytimeoutsoptions
956
+ retries: 20,
957
+ factor: 1.27579
958
+ },
959
+ onCompromised: (err) => {
960
+ throw new Error(`${err.message} Path: ${lockfilePath}`);
961
+ },
962
+ lockfilePath
963
+ });
964
+ await import_fs.default.promises.mkdir(linksDir, { recursive: true });
965
+ await import_fs.default.promises.writeFile(import_path.default.join(linksDir, (0, import_utils.calculateSha1)(PACKAGE_PATH)), PACKAGE_PATH);
966
+ await this._validateInstallationCache(linksDir);
967
+ for (const executable of executables) {
968
+ if (!executable._install)
969
+ throw new Error(`ERROR: Playwright does not support installing ${executable.name}`);
970
+ const { embedderName } = (0, import_userAgent.getEmbedderName)();
971
+ if (!(0, import_utils.getAsBooleanFromENV)("CI") && !executable._isHermeticInstallation && !forceReinstall && executable.executablePath(embedderName)) {
972
+ const command = buildPlaywrightCLICommand(embedderName, "install --force " + executable.name);
973
+ throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)([
974
+ `ATTENTION: "${executable.name}" is already installed on the system!`,
975
+ ``,
976
+ `"${executable.name}" installation is not hermetic; installing newer version`,
977
+ `requires *removal* of a current installation first.`,
978
+ ``,
979
+ `To *uninstall* current version and re-install latest "${executable.name}":`,
980
+ ``,
981
+ `- Close all running instances of "${executable.name}", if any`,
982
+ `- Use "--force" to install browser:`,
983
+ ``,
984
+ ` ${command}`,
985
+ ``,
986
+ `<3 Playwright Team`
987
+ ].join("\n"), 1));
988
+ }
989
+ await executable._install();
990
+ }
991
+ } catch (e) {
992
+ if (e.code === "ELOCKED") {
993
+ const rmCommand = process.platform === "win32" ? "rm -R" : "rm -rf";
994
+ throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)([
995
+ `An active lockfile is found at:`,
996
+ ``,
997
+ ` ${lockfilePath}`,
998
+ ``,
999
+ `Either:`,
1000
+ `- wait a few minutes if other Playwright is installing browsers in parallel`,
1001
+ `- remove lock manually with:`,
1002
+ ``,
1003
+ ` ${rmCommand} ${lockfilePath}`,
1004
+ ``,
1005
+ `<3 Playwright Team`
1006
+ ].join("\n"), 1));
1007
+ } else {
1008
+ throw e;
1009
+ }
1010
+ } finally {
1011
+ if (releaseLock)
1012
+ await releaseLock();
1013
+ }
1014
+ }
1015
+ async uninstall(all) {
1016
+ const linksDir = import_path.default.join(registryDirectory, ".links");
1017
+ if (all) {
1018
+ const links = await import_fs.default.promises.readdir(linksDir).catch(() => []);
1019
+ for (const link of links)
1020
+ await import_fs.default.promises.unlink(import_path.default.join(linksDir, link));
1021
+ } else {
1022
+ await import_fs.default.promises.unlink(import_path.default.join(linksDir, (0, import_utils.calculateSha1)(PACKAGE_PATH))).catch(() => {
1023
+ });
1024
+ }
1025
+ await this._validateInstallationCache(linksDir);
1026
+ return {
1027
+ numberOfBrowsersLeft: (await import_fs.default.promises.readdir(registryDirectory).catch(() => [])).filter((browserDirectory) => isBrowserDirectory(browserDirectory)).length
1028
+ };
1029
+ }
1030
+ async validateHostRequirementsForExecutablesIfNeeded(executables, sdkLanguage) {
1031
+ if ((0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS")) {
1032
+ process.stderr.write("Skipping host requirements validation logic because `PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS` env variable is set.\n");
1033
+ return;
1034
+ }
1035
+ for (const executable of executables)
1036
+ await this._validateHostRequirementsForExecutableIfNeeded(executable, sdkLanguage);
1037
+ }
1038
+ async _validateHostRequirementsForExecutableIfNeeded(executable, sdkLanguage) {
1039
+ const kMaximumReValidationPeriod = 30 * 24 * 60 * 60 * 1e3;
1040
+ if (!executable.directory)
1041
+ return;
1042
+ const markerFile = import_path.default.join(executable.directory, "DEPENDENCIES_VALIDATED");
1043
+ if (await import_fs.default.promises.stat(markerFile).then((stat) => Date.now() - stat.mtime.getTime() < kMaximumReValidationPeriod).catch(() => false))
1044
+ return;
1045
+ import_debugLogger.debugLogger.log("install", `validating host requirements for "${executable.name}"`);
1046
+ try {
1047
+ await executable._validateHostRequirements(sdkLanguage);
1048
+ import_debugLogger.debugLogger.log("install", `validation passed for ${executable.name}`);
1049
+ } catch (error) {
1050
+ import_debugLogger.debugLogger.log("install", `validation failed for ${executable.name}`);
1051
+ throw error;
1052
+ }
1053
+ await import_fs.default.promises.writeFile(markerFile, "").catch(() => {
1054
+ });
1055
+ }
1056
+ _downloadURLs(descriptor) {
1057
+ const paths = DOWNLOAD_PATHS[descriptor.name];
1058
+ const downloadPathTemplate = paths[import_hostPlatform.hostPlatform] || paths["<unknown>"];
1059
+ if (!downloadPathTemplate)
1060
+ return [];
1061
+ const downloadPath = util.format(downloadPathTemplate, descriptor.revision);
1062
+ let downloadURLs = PLAYWRIGHT_CDN_MIRRORS.map((mirror) => `${mirror}/${downloadPath}`);
1063
+ let downloadHostEnv;
1064
+ if (descriptor.name.startsWith("chromium"))
1065
+ downloadHostEnv = "PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST";
1066
+ else if (descriptor.name.startsWith("firefox"))
1067
+ downloadHostEnv = "PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST";
1068
+ else if (descriptor.name.startsWith("webkit"))
1069
+ downloadHostEnv = "PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST";
1070
+ const customHostOverride = downloadHostEnv && (0, import_utils.getFromENV)(downloadHostEnv) || (0, import_utils.getFromENV)("PLAYWRIGHT_DOWNLOAD_HOST");
1071
+ if (customHostOverride)
1072
+ downloadURLs = [`${customHostOverride}/${downloadPath}`];
1073
+ return downloadURLs;
1074
+ }
1075
+ async _downloadExecutable(descriptor, executablePath) {
1076
+ const downloadURLs = this._downloadURLs(descriptor);
1077
+ if (!downloadURLs.length)
1078
+ throw new Error(`ERROR: Playwright does not support ${descriptor.name} on ${import_hostPlatform.hostPlatform}`);
1079
+ if (!import_hostPlatform.isOfficiallySupportedPlatform)
1080
+ (0, import_browserFetcher.logPolitely)(`BEWARE: your OS is not officially supported by Playwright; downloading fallback build for ${import_hostPlatform.hostPlatform}.`);
1081
+ if (descriptor.hasRevisionOverride) {
1082
+ const message = `You are using a frozen ${descriptor.name} browser which does not receive updates anymore on ${import_hostPlatform.hostPlatform}. Please update to the latest version of your operating system to test up-to-date browsers.`;
1083
+ if (process.env.GITHUB_ACTIONS)
1084
+ console.log(`::warning title=Playwright::${message}`);
1085
+ else
1086
+ (0, import_browserFetcher.logPolitely)(message);
1087
+ }
1088
+ const displayName = descriptor.name.split("-").map((word) => {
1089
+ return word === "ffmpeg" ? "FFMPEG" : word.charAt(0).toUpperCase() + word.slice(1);
1090
+ }).join(" ");
1091
+ const title = descriptor.browserVersion ? `${displayName} ${descriptor.browserVersion} (playwright build v${descriptor.revision})` : `${displayName} playwright build v${descriptor.revision}`;
1092
+ const downloadFileName = `playwright-download-${descriptor.name}-${import_hostPlatform.hostPlatform}-${descriptor.revision}.zip`;
1093
+ const downloadSocketTimeoutEnv = (0, import_utils.getFromENV)("PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT");
1094
+ const downloadSocketTimeout = +(downloadSocketTimeoutEnv || "0") || 3e4;
1095
+ await (0, import_browserFetcher.downloadBrowserWithProgressBar)(title, descriptor.dir, executablePath, downloadURLs, downloadFileName, downloadSocketTimeout).catch((e) => {
1096
+ throw new Error(`Failed to download ${title}, caused by
1097
+ ${e.stack}`);
1098
+ });
1099
+ }
1100
+ async _installMSEdgeChannel(channel, scripts) {
1101
+ const scriptArgs = [];
1102
+ if (process.platform !== "linux") {
1103
+ const products = lowercaseAllKeys(JSON.parse(await (0, import_network.fetchData)({ url: "https://edgeupdates.microsoft.com/api/products" })));
1104
+ const productName = {
1105
+ "msedge": "Stable",
1106
+ "msedge-beta": "Beta",
1107
+ "msedge-dev": "Dev"
1108
+ }[channel];
1109
+ const product = products.find((product2) => product2.product === productName);
1110
+ const searchConfig = {
1111
+ darwin: { platform: "MacOS", arch: "universal", artifact: "pkg" },
1112
+ win32: { platform: "Windows", arch: "x64", artifact: "msi" }
1113
+ }[process.platform];
1114
+ const release = searchConfig ? product.releases.find((release2) => release2.platform === searchConfig.platform && release2.architecture === searchConfig.arch && release2.artifacts.length > 0) : null;
1115
+ const artifact = release ? release.artifacts.find((artifact2) => artifact2.artifactname === searchConfig.artifact) : null;
1116
+ if (artifact)
1117
+ scriptArgs.push(
1118
+ artifact.location
1119
+ /* url */
1120
+ );
1121
+ else
1122
+ throw new Error(`Cannot install ${channel} on ${process.platform}`);
1123
+ }
1124
+ await this._installChromiumChannel(channel, scripts, scriptArgs);
1125
+ }
1126
+ async _installChromiumChannel(channel, scripts, scriptArgs = []) {
1127
+ const scriptName = scripts[process.platform];
1128
+ if (!scriptName)
1129
+ throw new Error(`Cannot install ${channel} on ${process.platform}`);
1130
+ const cwd = BIN_PATH;
1131
+ const isPowerShell = scriptName.endsWith(".ps1");
1132
+ if (isPowerShell) {
1133
+ const args = [
1134
+ "-ExecutionPolicy",
1135
+ "Bypass",
1136
+ "-File",
1137
+ import_path.default.join(BIN_PATH, scriptName),
1138
+ ...scriptArgs
1139
+ ];
1140
+ const { code } = await (0, import_spawnAsync.spawnAsync)("powershell.exe", args, { cwd, stdio: "inherit" });
1141
+ if (code !== 0)
1142
+ throw new Error(`Failed to install ${channel}`);
1143
+ } else {
1144
+ const { command, args, elevatedPermissions } = await (0, import_dependencies.transformCommandsForRoot)([`bash "${import_path.default.join(BIN_PATH, scriptName)}" ${scriptArgs.join("")}`]);
1145
+ if (elevatedPermissions)
1146
+ console.log("Switching to root user to install dependencies...");
1147
+ const { code } = await (0, import_spawnAsync.spawnAsync)(command, args, { cwd, stdio: "inherit" });
1148
+ if (code !== 0)
1149
+ throw new Error(`Failed to install ${channel}`);
1150
+ }
1151
+ }
1152
+ async _validateInstallationCache(linksDir) {
1153
+ const usedBrowserPaths = /* @__PURE__ */ new Set();
1154
+ for (const fileName of await import_fs.default.promises.readdir(linksDir)) {
1155
+ const linkPath = import_path.default.join(linksDir, fileName);
1156
+ let linkTarget = "";
1157
+ try {
1158
+ linkTarget = (await import_fs.default.promises.readFile(linkPath)).toString();
1159
+ const browsersJSON = require(import_path.default.join(linkTarget, "browsers.json"));
1160
+ const descriptors = readDescriptors(browsersJSON);
1161
+ for (const browserName of allDownloadable) {
1162
+ const descriptor = descriptors.find((d) => d.name === browserName);
1163
+ if (!descriptor)
1164
+ continue;
1165
+ const usedBrowserPath = descriptor.dir;
1166
+ const browserRevision = parseInt(descriptor.revision, 10);
1167
+ const shouldHaveMarkerFile = browserName === "chromium" && (browserRevision >= 786218 || browserRevision < 3e5) || browserName === "firefox" && browserRevision >= 1128 || browserName === "webkit" && browserRevision >= 1307 || // All new applications have a marker file right away.
1168
+ browserName !== "firefox" && browserName !== "chromium" && browserName !== "webkit";
1169
+ if (!shouldHaveMarkerFile || await (0, import_fileUtils.existsAsync)(browserDirectoryToMarkerFilePath(usedBrowserPath)))
1170
+ usedBrowserPaths.add(usedBrowserPath);
1171
+ }
1172
+ } catch (e) {
1173
+ await import_fs.default.promises.unlink(linkPath).catch((e2) => {
1174
+ });
1175
+ }
1176
+ }
1177
+ if (!(0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_BROWSER_GC")) {
1178
+ let downloadedBrowsers = (await import_fs.default.promises.readdir(registryDirectory)).map((file) => import_path.default.join(registryDirectory, file));
1179
+ downloadedBrowsers = downloadedBrowsers.filter((file) => isBrowserDirectory(file));
1180
+ const directories = new Set(downloadedBrowsers);
1181
+ for (const browserDirectory of usedBrowserPaths)
1182
+ directories.delete(browserDirectory);
1183
+ for (const directory of directories)
1184
+ (0, import_browserFetcher.logPolitely)("Removing unused browser at " + directory);
1185
+ await (0, import_fileUtils.removeFolders)([...directories]);
1186
+ }
1187
+ }
1188
+ }
1189
+ function browserDirectoryToMarkerFilePath(browserDirectory) {
1190
+ return import_path.default.join(browserDirectory, "INSTALLATION_COMPLETE");
1191
+ }
1192
+ function buildPlaywrightCLICommand(sdkLanguage, parameters) {
1193
+ switch (sdkLanguage) {
1194
+ case "python":
1195
+ return `playwright ${parameters}`;
1196
+ case "java":
1197
+ return `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="${parameters}"`;
1198
+ case "csharp":
1199
+ return `pwsh bin/Debug/netX/playwright.ps1 ${parameters}`;
1200
+ default: {
1201
+ const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
1202
+ return `${packageManagerCommand} playwright ${parameters}`;
1203
+ }
1204
+ }
1205
+ }
1206
+ async function installBrowsersForNpmInstall(browsers) {
1207
+ if ((0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")) {
1208
+ (0, import_browserFetcher.logPolitely)("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set");
1209
+ return false;
1210
+ }
1211
+ const executables = [];
1212
+ if (process.platform === "win32")
1213
+ executables.push(registry.findExecutable("winldd"));
1214
+ for (const browserName of browsers) {
1215
+ const executable = registry.findExecutable(browserName);
1216
+ if (!executable || executable.installType === "none")
1217
+ throw new Error(`Cannot install ${browserName}`);
1218
+ executables.push(executable);
1219
+ }
1220
+ await registry.install(
1221
+ executables,
1222
+ false
1223
+ /* forceReinstall */
1224
+ );
1225
+ }
1226
+ function findChromiumChannel(sdkLanguage) {
1227
+ let channel = null;
1228
+ for (const name of ["chromium", "chrome", "msedge"]) {
1229
+ try {
1230
+ registry.findExecutable(name).executablePathOrDie(sdkLanguage);
1231
+ channel = name === "chromium" ? void 0 : name;
1232
+ break;
1233
+ } catch (e) {
1234
+ }
1235
+ }
1236
+ if (channel === null) {
1237
+ const installCommand = buildPlaywrightCLICommand(sdkLanguage, `install chromium`);
1238
+ const prettyMessage = [
1239
+ `No chromium-based browser found on the system.`,
1240
+ `Please run the following command to download one:`,
1241
+ ``,
1242
+ ` ${installCommand}`,
1243
+ ``,
1244
+ `<3 Playwright Team`
1245
+ ].join("\n");
1246
+ throw new Error("\n" + (0, import_ascii.wrapInASCIIBox)(prettyMessage, 1));
1247
+ }
1248
+ return channel;
1249
+ }
1250
+ function lowercaseAllKeys(json) {
1251
+ if (typeof json !== "object" || !json)
1252
+ return json;
1253
+ if (Array.isArray(json))
1254
+ return json.map(lowercaseAllKeys);
1255
+ const result = {};
1256
+ for (const [key, value] of Object.entries(json))
1257
+ result[key.toLowerCase()] = lowercaseAllKeys(value);
1258
+ return result;
1259
+ }
1260
+ const registry = new Registry(require("../../../browsers.json"));
1261
+ // Annotate the CommonJS export names for ESM import in node:
1262
+ 0 && (module.exports = {
1263
+ Registry,
1264
+ browserDirectoryToMarkerFilePath,
1265
+ buildPlaywrightCLICommand,
1266
+ findChromiumChannel,
1267
+ installBrowsersForNpmInstall,
1268
+ registry,
1269
+ registryDirectory,
1270
+ writeDockerVersion
1271
+ });