patchright-core 1.50.0 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/ThirdPartyNotices.txt +381 -55
  2. package/browsers.json +22 -10
  3. package/index.js +0 -1
  4. package/lib/androidServerImpl.js +4 -4
  5. package/lib/browserServerImpl.js +18 -9
  6. package/lib/cli/driver.js +6 -6
  7. package/lib/cli/program.js +9 -9
  8. package/lib/cli/programWithTestStub.js +2 -1
  9. package/lib/client/android.js +37 -58
  10. package/lib/client/artifact.js +4 -7
  11. package/lib/client/browser.js +10 -15
  12. package/lib/client/browserContext.js +77 -73
  13. package/lib/client/browserType.js +30 -64
  14. package/lib/client/channelOwner.js +23 -20
  15. package/lib/client/clientHelper.js +5 -7
  16. package/lib/client/clientStackTrace.js +65 -0
  17. package/lib/client/connection.js +46 -39
  18. package/lib/client/consoleMessage.js +4 -7
  19. package/lib/client/electron.js +10 -10
  20. package/lib/client/elementHandle.js +32 -33
  21. package/lib/client/errors.js +2 -2
  22. package/lib/client/eventEmitter.js +5 -8
  23. package/lib/client/fetch.js +60 -61
  24. package/lib/client/fileUtils.js +31 -0
  25. package/lib/client/frame.js +30 -29
  26. package/lib/client/harRouter.js +7 -9
  27. package/lib/client/jsHandle.js +3 -4
  28. package/lib/client/localUtils.js +24 -0
  29. package/lib/client/locator.js +37 -18
  30. package/lib/client/network.js +40 -40
  31. package/lib/client/page.js +59 -55
  32. package/lib/client/platform.js +71 -0
  33. package/lib/client/playwright.js +21 -1
  34. package/lib/client/selectors.js +8 -2
  35. package/lib/client/stream.js +2 -21
  36. package/lib/client/timeoutSettings.js +65 -0
  37. package/lib/client/tracing.js +10 -7
  38. package/lib/client/video.js +2 -2
  39. package/lib/client/waiter.js +5 -6
  40. package/lib/client/webSocket.js +106 -0
  41. package/lib/client/worker.js +12 -10
  42. package/lib/client/writableStream.js +2 -21
  43. package/lib/generated/consoleApiSource.js +1 -1
  44. package/lib/generated/injectedScriptSource.js +1 -1
  45. package/lib/generated/pollingRecorderSource.js +1 -1
  46. package/lib/inProcessFactory.js +6 -3
  47. package/lib/outofprocess.js +12 -8
  48. package/lib/protocol/validator.js +64 -13
  49. package/lib/protocol/validatorPrimitives.js +1 -2
  50. package/lib/remote/playwrightConnection.js +18 -10
  51. package/lib/remote/playwrightServer.js +20 -7
  52. package/lib/server/android/android.js +17 -14
  53. package/lib/server/android/backendAdb.js +14 -14
  54. package/lib/server/artifact.js +3 -3
  55. package/lib/server/bidi/bidiBrowser.js +2 -2
  56. package/lib/server/bidi/bidiChromium.js +4 -3
  57. package/lib/server/bidi/bidiConnection.js +1 -1
  58. package/lib/server/bidi/bidiExecutionContext.js +70 -40
  59. package/lib/server/bidi/bidiFirefox.js +4 -3
  60. package/lib/server/bidi/bidiInput.js +5 -8
  61. package/lib/server/bidi/bidiNetworkManager.js +3 -3
  62. package/lib/server/bidi/bidiOverCdp.js +2 -2
  63. package/lib/server/bidi/bidiPage.js +30 -46
  64. package/lib/server/bidi/third_party/firefoxPrefs.js +19 -3
  65. package/lib/server/browser.js +2 -2
  66. package/lib/server/browserContext.js +37 -40
  67. package/lib/server/browserType.js +18 -17
  68. package/lib/{utils/sequence.js → server/callLog.js} +18 -3
  69. package/lib/server/chromium/chromium.js +14 -14
  70. package/lib/server/chromium/chromiumSwitches.js +32 -1
  71. package/lib/server/chromium/crBrowser.js +15 -14
  72. package/lib/server/chromium/crConnection.js +2 -2
  73. package/lib/server/chromium/crCoverage.js +1 -1
  74. package/lib/server/chromium/crDevTools.js +1 -1
  75. package/lib/server/chromium/crDragDrop.js +1 -1
  76. package/lib/server/chromium/crExecutionContext.js +25 -17
  77. package/lib/server/chromium/crInput.js +2 -2
  78. package/lib/server/chromium/crNetworkManager.js +73 -26
  79. package/lib/server/chromium/crPage.js +22 -23
  80. package/lib/server/chromium/crPdf.js +1 -1
  81. package/lib/server/chromium/crProtocolHelper.js +3 -3
  82. package/lib/server/chromium/crServiceWorker.js +2 -2
  83. package/lib/server/chromium/videoRecorder.js +2 -2
  84. package/lib/server/clock.js +1 -1
  85. package/lib/server/codegen/javascript.js +1 -1
  86. package/lib/server/codegen/languages.js +2 -2
  87. package/lib/server/debugController.js +3 -3
  88. package/lib/server/deviceDescriptors.js +1 -1
  89. package/lib/server/deviceDescriptorsSource.json +131 -131
  90. package/lib/server/dispatchers/androidDispatcher.js +1 -1
  91. package/lib/server/dispatchers/artifactDispatcher.js +3 -3
  92. package/lib/server/dispatchers/browserContextDispatcher.js +19 -19
  93. package/lib/server/dispatchers/browserTypeDispatcher.js +1 -1
  94. package/lib/server/dispatchers/cdpSessionDispatcher.js +1 -1
  95. package/lib/server/dispatchers/dispatcher.js +27 -25
  96. package/lib/server/dispatchers/electronDispatcher.js +3 -3
  97. package/lib/server/dispatchers/elementHandlerDispatcher.js +7 -2
  98. package/lib/server/dispatchers/frameDispatcher.js +4 -4
  99. package/lib/server/dispatchers/jsHandleDispatcher.js +2 -2
  100. package/lib/server/dispatchers/jsonPipeDispatcher.js +2 -2
  101. package/lib/server/dispatchers/localUtilsDispatcher.js +25 -298
  102. package/lib/server/dispatchers/networkDispatchers.js +3 -3
  103. package/lib/server/dispatchers/pageDispatcher.js +11 -9
  104. package/lib/server/dispatchers/playwrightDispatcher.js +5 -5
  105. package/lib/server/dispatchers/streamDispatcher.js +4 -3
  106. package/lib/server/dispatchers/webSocketRouteDispatcher.js +8 -7
  107. package/lib/server/dispatchers/writableStreamDispatcher.js +5 -6
  108. package/lib/server/dom.js +18 -12
  109. package/lib/server/download.js +1 -1
  110. package/lib/server/electron/electron.js +17 -16
  111. package/lib/server/errors.js +1 -1
  112. package/lib/server/fetch.js +50 -45
  113. package/lib/server/fileUploadUtils.js +7 -4
  114. package/lib/server/firefox/ffBrowser.js +11 -3
  115. package/lib/server/firefox/ffConnection.js +1 -1
  116. package/lib/server/firefox/ffExecutionContext.js +25 -17
  117. package/lib/server/firefox/ffNetworkManager.js +2 -2
  118. package/lib/server/firefox/ffPage.js +15 -21
  119. package/lib/server/firefox/firefox.js +7 -9
  120. package/lib/server/frameSelectors.js +1 -1
  121. package/lib/server/frames.js +366 -209
  122. package/lib/server/har/harRecorder.js +4 -4
  123. package/lib/server/har/harTracer.js +7 -8
  124. package/lib/server/harBackend.js +157 -0
  125. package/lib/server/helper.js +2 -2
  126. package/lib/server/index.js +1 -8
  127. package/lib/server/input.js +1 -1
  128. package/lib/server/instrumentation.js +2 -2
  129. package/lib/server/isomorphic/utilityScriptSerializers.js +3 -0
  130. package/lib/server/javascript.js +46 -33
  131. package/lib/server/launchApp.js +2 -2
  132. package/lib/server/localUtils.js +203 -0
  133. package/lib/server/network.js +3 -3
  134. package/lib/server/page.js +41 -22
  135. package/lib/server/pipeTransport.js +1 -1
  136. package/lib/server/playwright.js +5 -5
  137. package/lib/server/progress.js +1 -1
  138. package/lib/server/protocolError.js +1 -1
  139. package/lib/server/recorder/contextRecorder.js +3 -3
  140. package/lib/server/recorder/recorderApp.js +18 -12
  141. package/lib/server/recorder/recorderCollection.js +4 -4
  142. package/lib/server/recorder/throttledFile.js +3 -4
  143. package/lib/server/recorder.js +7 -5
  144. package/lib/server/registry/browserFetcher.js +9 -7
  145. package/lib/server/registry/dependencies.js +15 -15
  146. package/lib/server/registry/index.js +38 -44
  147. package/lib/server/registry/oopDownloadBrowserMain.js +3 -3
  148. package/lib/server/screenshotter.js +1 -1
  149. package/lib/server/selectors.js +3 -3
  150. package/lib/server/socksClientCertificatesInterceptor.js +9 -9
  151. package/lib/server/socksInterceptor.js +8 -5
  152. package/lib/server/storageScript.js +160 -0
  153. package/lib/{common → server}/timeoutSettings.js +6 -5
  154. package/lib/server/trace/recorder/snapshotter.js +9 -8
  155. package/lib/server/trace/recorder/tracing.js +40 -31
  156. package/lib/server/trace/test/inMemorySnapshotter.js +4 -4
  157. package/lib/server/trace/viewer/traceViewer.js +13 -5
  158. package/lib/server/transport.js +2 -2
  159. package/lib/{utils → server/utils}/comparators.js +4 -4
  160. package/lib/{utils → server/utils}/crypto.js +4 -4
  161. package/lib/{utils → server/utils}/debug.js +4 -12
  162. package/lib/{utils → server/utils}/debugLogger.js +2 -2
  163. package/lib/{utils → server/utils}/env.js +4 -0
  164. package/lib/{utils → server/utils}/expectUtils.js +1 -1
  165. package/lib/{utils → server/utils}/fileUtils.js +4 -5
  166. package/lib/{utils/happy-eyeballs.js → server/utils/happyEyeballs.js} +22 -24
  167. package/lib/{utils → server/utils}/hostPlatform.js +1 -1
  168. package/lib/{utils → server/utils}/httpServer.js +8 -12
  169. package/lib/{utils → server/utils}/linuxUtils.js +3 -23
  170. package/lib/{utils → server/utils}/network.js +5 -5
  171. package/lib/server/utils/nodePlatform.js +140 -0
  172. package/lib/{protocol/transport.js → server/utils/pipeTransport.js} +2 -2
  173. package/lib/{utils → server/utils}/processLauncher.js +5 -5
  174. package/lib/{utils → server/utils}/profiler.js +5 -6
  175. package/lib/{common → server/utils}/socksProxy.js +10 -9
  176. package/lib/{utils → server/utils}/userAgent.js +2 -16
  177. package/lib/{utils → server/utils}/wsServer.js +3 -3
  178. package/lib/{utils → server/utils}/zipFile.js +1 -1
  179. package/lib/{utils → server/utils}/zones.js +9 -24
  180. package/lib/server/webkit/webkit.js +4 -4
  181. package/lib/server/webkit/wkBrowser.js +4 -4
  182. package/lib/server/webkit/wkConnection.js +1 -1
  183. package/lib/server/webkit/wkExecutionContext.js +25 -17
  184. package/lib/server/webkit/wkInput.js +2 -2
  185. package/lib/server/webkit/wkInterceptableRequest.js +2 -2
  186. package/lib/server/webkit/wkPage.js +41 -40
  187. package/lib/server/webkit/wkProvisionalPage.js +1 -1
  188. package/lib/server/webkit/wkWorkers.js +2 -2
  189. package/lib/utils/isomorphic/ariaSnapshot.js +2 -1
  190. package/lib/utils/isomorphic/assert.js +25 -0
  191. package/lib/utils/isomorphic/colors.js +65 -0
  192. package/lib/utils/isomorphic/cssParser.js +1 -1
  193. package/lib/utils/isomorphic/locatorGenerators.js +13 -1
  194. package/lib/utils/isomorphic/locatorParser.js +2 -2
  195. package/lib/utils/{manualPromise.js → isomorphic/manualPromise.js} +3 -5
  196. package/lib/utils/isomorphic/mimeType.js +11 -3
  197. package/lib/utils/{multimap.js → isomorphic/multimap.js} +1 -3
  198. package/lib/utils/{rtti.js → isomorphic/rtti.js} +2 -5
  199. package/lib/utils/isomorphic/stackTrace.js +169 -0
  200. package/lib/utils/isomorphic/stringUtils.js +1 -1
  201. package/lib/utils/{time.js → isomorphic/time.js} +1 -13
  202. package/lib/utils/{timeoutRunner.js → isomorphic/timeoutRunner.js} +4 -4
  203. package/lib/utils/isomorphic/traceUtils.js +23 -0
  204. package/lib/{utils/index.js → utils.js} +200 -121
  205. package/lib/utilsBundle.js +1 -25
  206. package/lib/utilsBundleImpl/index.js +119 -121
  207. package/lib/vite/htmlReport/index.html +20 -20
  208. package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +24 -0
  209. package/lib/vite/recorder/assets/index-ELPgmkwA.js +184 -0
  210. package/lib/vite/recorder/index.html +2 -2
  211. package/lib/vite/traceViewer/assets/codeMirrorModule-DpJ-EmBQ.js +24 -0
  212. package/lib/vite/traceViewer/assets/defaultSettingsView-DTenqiGw.js +259 -0
  213. package/lib/vite/traceViewer/assets/{xtermModule-BeNbaIVa.js → xtermModule-BoAIEibi.js} +7 -7
  214. package/lib/vite/traceViewer/defaultSettingsView.5fN5lw10.css +1 -0
  215. package/lib/vite/traceViewer/index.CUq7VgrV.js +2 -0
  216. package/lib/vite/traceViewer/index.html +4 -4
  217. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  218. package/lib/vite/traceViewer/uiMode.CHJSAD7F.js +5 -0
  219. package/lib/vite/traceViewer/uiMode.html +4 -4
  220. package/lib/zipBundleImpl.js +4 -4
  221. package/package.json +7 -7
  222. package/types/protocol.d.ts +123 -99
  223. package/types/types.d.ts +110 -38
  224. package/lib/utils/stackTrace.js +0 -134
  225. package/lib/utils/traceUtils.js +0 -44
  226. package/lib/vite/recorder/assets/codeMirrorModule-3Qn3tPnZ.js +0 -24
  227. package/lib/vite/recorder/assets/index-Bek6JFv8.js +0 -184
  228. package/lib/vite/traceViewer/assets/codeMirrorModule-aLkSUGpW.js +0 -24
  229. package/lib/vite/traceViewer/assets/defaultSettingsView-CxUo6zd3.js +0 -243
  230. package/lib/vite/traceViewer/defaultSettingsView.DtIkrKWn.css +0 -1
  231. package/lib/vite/traceViewer/index.Bhu5cv5R.js +0 -2
  232. package/lib/vite/traceViewer/uiMode.BBy7FOVd.js +0 -5
  233. /package/lib/{utils → server/utils}/ascii.js +0 -0
  234. /package/lib/{utils → server/utils}/eventsHelper.js +0 -0
  235. /package/lib/{image_tools → server/utils/image_tools}/colorUtils.js +0 -0
  236. /package/lib/{image_tools → server/utils/image_tools}/compare.js +0 -0
  237. /package/lib/{image_tools → server/utils/image_tools}/imageChannel.js +0 -0
  238. /package/lib/{image_tools → server/utils/image_tools}/stats.js +0 -0
  239. /package/lib/{utils → server/utils}/spawnAsync.js +0 -0
  240. /package/lib/{utils → server/utils}/task.js +0 -0
  241. /package/lib/utils/{headers.js → isomorphic/headers.js} +0 -0
  242. /package/lib/utils/{semaphore.js → isomorphic/semaphore.js} +0 -0
  243. /package/lib/{common → utils/isomorphic}/types.js +0 -0
  244. /package/lib/vite/recorder/assets/{codeMirrorModule-ez37Vkbh.css → codeMirrorModule-C3UTv-Ge.css} +0 -0
  245. /package/lib/vite/recorder/assets/{index-CAQewHss.css → index-eHBmevrY.css} +0 -0
  246. /package/lib/vite/traceViewer/{codeMirrorModule.ez37Vkbh.css → codeMirrorModule.C3UTv-Ge.css} +0 -0
  247. /package/lib/vite/traceViewer/{index.CrbWWHbf.css → index.CFOW-Ezb.css} +0 -0
  248. /package/lib/vite/traceViewer/{uiMode.Be_ME-Go.css → uiMode.BatfzHMG.css} +0 -0
  249. /package/lib/vite/traceViewer/{xtermModule.DSXBckUd.css → xtermModule.Beg8tuEN.css} +0 -0
package/types/types.d.ts CHANGED
@@ -15,7 +15,6 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { ChildProcess } from 'child_process';
18
- import { EventEmitter } from 'events';
19
18
  import { Readable } from 'stream';
20
19
  import { ReadStream } from 'fs';
21
20
  import { Protocol } from './protocol';
@@ -2565,6 +2564,12 @@ export interface Page {
2565
2564
  */
2566
2565
  colorScheme?: null|"light"|"dark"|"no-preference";
2567
2566
 
2567
+ /**
2568
+ * Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. Passing `null`
2569
+ * disables contrast emulation.
2570
+ */
2571
+ contrast?: null|"no-preference"|"more";
2572
+
2568
2573
  /**
2569
2574
  * Emulates `'forced-colors'` media feature, supported values are `'active'` and `'none'`. Passing `null` disables
2570
2575
  * forced colors emulation.
@@ -9260,10 +9265,21 @@ export interface BrowserContext {
9260
9265
  setOffline(offline: boolean): Promise<void>;
9261
9266
 
9262
9267
  /**
9263
- * Returns storage state for this browser context, contains current cookies and local storage snapshot.
9268
+ * Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB
9269
+ * snapshot.
9264
9270
  * @param options
9265
9271
  */
9266
9272
  storageState(options?: {
9273
+ /**
9274
+ * Set to `true` to include [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) in the storage
9275
+ * state snapshot. If your application uses IndexedDB to store authentication tokens, like Firebase Authentication,
9276
+ * enable this.
9277
+ *
9278
+ * **NOTE** IndexedDBs with typed arrays are currently not supported.
9279
+ *
9280
+ */
9281
+ indexedDB?: boolean;
9282
+
9267
9283
  /**
9268
9284
  * The file path to save the storage state to. If
9269
9285
  * [`path`](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state-option-path) is a
@@ -9770,6 +9786,13 @@ export interface Browser {
9770
9786
  */
9771
9787
  colorScheme?: null|"light"|"dark"|"no-preference";
9772
9788
 
9789
+ /**
9790
+ * Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
9791
+ * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
9792
+ * Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
9793
+ */
9794
+ contrast?: null|"no-preference"|"more";
9795
+
9773
9796
  /**
9774
9797
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
9775
9798
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -10049,12 +10072,12 @@ export interface Browser {
10049
10072
  sameSite: "Strict"|"Lax"|"None";
10050
10073
  }>;
10051
10074
 
10052
- /**
10053
- * localStorage to set for context
10054
- */
10055
10075
  origins: Array<{
10056
10076
  origin: string;
10057
10077
 
10078
+ /**
10079
+ * localStorage to set for context
10080
+ */
10058
10081
  localStorage: Array<{
10059
10082
  name: string;
10060
10083
 
@@ -11627,7 +11650,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
11627
11650
  * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
11628
11651
  * box `#FF00FF` (customized by
11629
11652
  * [`maskColor`](https://playwright.dev/docs/api/class-elementhandle#element-handle-screenshot-option-mask-color))
11630
- * that completely covers its bounding box.
11653
+ * that completely covers its bounding box. The mask is also applied to invisible elements, see
11654
+ * [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
11631
11655
  */
11632
11656
  mask?: Array<Locator>;
11633
11657
 
@@ -12176,12 +12200,6 @@ export interface Locator {
12176
12200
  * rejects, this method throws.
12177
12201
  *
12178
12202
  * **Usage**
12179
- *
12180
- * ```js
12181
- * const tweets = page.locator('.tweet .retweets');
12182
- * expect(await tweets.evaluate(node => node.innerText)).toBe('10 retweets');
12183
- * ```
12184
- *
12185
12203
  * @param pageFunction Function to be evaluated in the page context.
12186
12204
  * @param arg Optional argument to pass to
12187
12205
  * [`pageFunction`](https://playwright.dev/docs/api/class-locator#locator-evaluate-option-expression).
@@ -12207,12 +12225,6 @@ export interface Locator {
12207
12225
  * rejects, this method throws.
12208
12226
  *
12209
12227
  * **Usage**
12210
- *
12211
- * ```js
12212
- * const tweets = page.locator('.tweet .retweets');
12213
- * expect(await tweets.evaluate(node => node.innerText)).toBe('10 retweets');
12214
- * ```
12215
- *
12216
12228
  * @param pageFunction Function to be evaluated in the page context.
12217
12229
  * @param arg Optional argument to pass to
12218
12230
  * [`pageFunction`](https://playwright.dev/docs/api/class-locator#locator-evaluate-option-expression).
@@ -12429,7 +12441,7 @@ export interface Locator {
12429
12441
 
12430
12442
  /**
12431
12443
  * Captures the aria snapshot of the given element. Read more about [aria snapshots](https://playwright.dev/docs/aria-snapshots) and
12432
- * [expect(locator).toMatchAriaSnapshot(expected[, options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-match-aria-snapshot-1)
12444
+ * [expect(locator).toMatchAriaSnapshot(expected[, options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-match-aria-snapshot)
12433
12445
  * for the corresponding assertion.
12434
12446
  *
12435
12447
  * **Usage**
@@ -13111,6 +13123,11 @@ export interface Locator {
13111
13123
  * `<article><div>Playwright</div></article>`.
13112
13124
  */
13113
13125
  hasText?: string|RegExp;
13126
+
13127
+ /**
13128
+ * Only matches visible or invisible elements.
13129
+ */
13130
+ visible?: boolean;
13114
13131
  }): Locator;
13115
13132
 
13116
13133
  /**
@@ -14062,9 +14079,9 @@ export interface Locator {
14062
14079
  *
14063
14080
  * ```html
14064
14081
  * <select multiple>
14065
- * <option value="red">Red</div>
14066
- * <option value="green">Green</div>
14067
- * <option value="blue">Blue</div>
14082
+ * <option value="red">Red</option>
14083
+ * <option value="green">Green</option>
14084
+ * <option value="blue">Blue</option>
14068
14085
  * </select>
14069
14086
  * ```
14070
14087
  *
@@ -14313,7 +14330,8 @@ export interface Locator {
14313
14330
  }): Promise<void>;
14314
14331
 
14315
14332
  /**
14316
- * Perform a tap gesture on the element matching the locator.
14333
+ * Perform a tap gesture on the element matching the locator. For examples of emulating other gestures by manually
14334
+ * dispatching touch events, see the [emulating legacy touch events](https://playwright.dev/docs/touch-events) page.
14317
14335
  *
14318
14336
  * **Details**
14319
14337
  *
@@ -14566,6 +14584,11 @@ export interface BrowserType<Unused = {}> {
14566
14584
  *
14567
14585
  * **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
14568
14586
  *
14587
+ * **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
14588
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14589
+ * If you are experiencing issues or attempting to use advanced functionality, you probably want to use
14590
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14591
+ *
14569
14592
  * **Usage**
14570
14593
  *
14571
14594
  * ```js
@@ -14591,6 +14614,11 @@ export interface BrowserType<Unused = {}> {
14591
14614
  *
14592
14615
  * **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
14593
14616
  *
14617
+ * **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
14618
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14619
+ * If you are experiencing issues or attempting to use advanced functionality, you probably want to use
14620
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14621
+ *
14594
14622
  * **Usage**
14595
14623
  *
14596
14624
  * ```js
@@ -14605,10 +14633,12 @@ export interface BrowserType<Unused = {}> {
14605
14633
  */
14606
14634
  connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>;
14607
14635
  /**
14608
- * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
14609
- * `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
14610
- * compatible with 1.2.x).
14611
- * @param wsEndpoint A browser websocket endpoint to connect to.
14636
+ * This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
14637
+ *
14638
+ * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
14639
+ * Playwright that launches the browser (1.2.3 is compatible with 1.2.x).
14640
+ *
14641
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
14612
14642
  * @param options
14613
14643
  */
14614
14644
  connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
@@ -14619,10 +14649,12 @@ export interface BrowserType<Unused = {}> {
14619
14649
  * @deprecated
14620
14650
  */
14621
14651
  /**
14622
- * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
14623
- * `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
14624
- * compatible with 1.2.x).
14625
- * @param wsEndpoint A browser websocket endpoint to connect to.
14652
+ * This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
14653
+ *
14654
+ * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
14655
+ * Playwright that launches the browser (1.2.3 is compatible with 1.2.x).
14656
+ *
14657
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
14626
14658
  * @param options
14627
14659
  */
14628
14660
  connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
@@ -14795,6 +14827,13 @@ export interface BrowserType<Unused = {}> {
14795
14827
  */
14796
14828
  colorScheme?: null|"light"|"dark"|"no-preference";
14797
14829
 
14830
+ /**
14831
+ * Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
14832
+ * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
14833
+ * Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
14834
+ */
14835
+ contrast?: null|"no-preference"|"more";
14836
+
14798
14837
  /**
14799
14838
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
14800
14839
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -16607,6 +16646,13 @@ export interface AndroidDevice {
16607
16646
  */
16608
16647
  colorScheme?: null|"light"|"dark"|"no-preference";
16609
16648
 
16649
+ /**
16650
+ * Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
16651
+ * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
16652
+ * Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
16653
+ */
16654
+ contrast?: null|"no-preference"|"more";
16655
+
16610
16656
  /**
16611
16657
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
16612
16658
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -17482,6 +17528,12 @@ export interface APIRequest {
17482
17528
  */
17483
17529
  extraHTTPHeaders?: { [key: string]: string; };
17484
17530
 
17531
+ /**
17532
+ * Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status
17533
+ * codes.
17534
+ */
17535
+ failOnStatusCode?: boolean;
17536
+
17485
17537
  /**
17486
17538
  * Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
17487
17539
  * origin is specified, the username and password are sent to any servers upon unauthorized responses.
@@ -18351,6 +18403,11 @@ export interface APIRequestContext {
18351
18403
  * @param options
18352
18404
  */
18353
18405
  storageState(options?: {
18406
+ /**
18407
+ * Set to `true` to include IndexedDB in the storage state snapshot.
18408
+ */
18409
+ indexedDB?: boolean;
18410
+
18354
18411
  /**
18355
18412
  * The file path to save the storage state to. If
18356
18413
  * [`path`](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-storage-state-option-path) is
@@ -21049,6 +21106,9 @@ export interface Selectors {
21049
21106
  /**
21050
21107
  * The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on
21051
21108
  * the touchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true.
21109
+ *
21110
+ * This class is limited to emulating tap gestures. For examples of other gestures simulated by manually dispatching
21111
+ * touch events, see the [emulating legacy touch events](https://playwright.dev/docs/touch-events) page.
21052
21112
  */
21053
21113
  export interface Touchscreen {
21054
21114
  /**
@@ -21299,8 +21359,11 @@ export interface WebError {
21299
21359
  }
21300
21360
 
21301
21361
  /**
21302
- * The [WebSocket](https://playwright.dev/docs/api/class-websocket) class represents websocket connections in the
21303
- * page.
21362
+ * The [WebSocket](https://playwright.dev/docs/api/class-websocket) class represents WebSocket connections within a
21363
+ * page. It provides the ability to inspect and manipulate the data being transmitted and received.
21364
+ *
21365
+ * If you want to intercept or modify WebSocket frames, consider using
21366
+ * [WebSocketRoute](https://playwright.dev/docs/api/class-websocketroute).
21304
21367
  */
21305
21368
  export interface WebSocket {
21306
21369
  /**
@@ -21785,7 +21848,8 @@ export interface LocatorScreenshotOptions {
21785
21848
  * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
21786
21849
  * box `#FF00FF` (customized by
21787
21850
  * [`maskColor`](https://playwright.dev/docs/api/class-locator#locator-screenshot-option-mask-color)) that completely
21788
- * covers its bounding box.
21851
+ * covers its bounding box. The mask is also applied to invisible elements, see
21852
+ * [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
21789
21853
  */
21790
21854
  mask?: Array<Locator>;
21791
21855
 
@@ -21964,6 +22028,13 @@ export interface BrowserContextOptions {
21964
22028
  */
21965
22029
  colorScheme?: null|"light"|"dark"|"no-preference";
21966
22030
 
22031
+ /**
22032
+ * Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
22033
+ * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
22034
+ * Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
22035
+ */
22036
+ contrast?: null|"no-preference"|"more";
22037
+
21967
22038
  /**
21968
22039
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
21969
22040
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -22210,12 +22281,12 @@ export interface BrowserContextOptions {
22210
22281
  sameSite: "Strict"|"Lax"|"None";
22211
22282
  }>;
22212
22283
 
22213
- /**
22214
- * localStorage to set for context
22215
- */
22216
22284
  origins: Array<{
22217
22285
  origin: string;
22218
22286
 
22287
+ /**
22288
+ * localStorage to set for context
22289
+ */
22219
22290
  localStorage: Array<{
22220
22291
  name: string;
22221
22292
 
@@ -22443,7 +22514,8 @@ export interface PageScreenshotOptions {
22443
22514
  * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
22444
22515
  * box `#FF00FF` (customized by
22445
22516
  * [`maskColor`](https://playwright.dev/docs/api/class-page#page-screenshot-option-mask-color)) that completely covers
22446
- * its bounding box.
22517
+ * its bounding box. The mask is also applied to invisible elements, see
22518
+ * [Matching only visible elements](https://playwright.dev/docs/locators#matching-only-visible-elements) to disable that.
22447
22519
  */
22448
22520
  mask?: Array<Locator>;
22449
22521
 
@@ -1,134 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addInternalStackPrefix = void 0;
7
- exports.captureLibraryStackText = captureLibraryStackText;
8
- exports.captureLibraryStackTrace = captureLibraryStackTrace;
9
- exports.captureRawStack = captureRawStack;
10
- exports.compressCallLog = compressCallLog;
11
- exports.formatCallLog = formatCallLog;
12
- exports.rewriteErrorMessage = rewriteErrorMessage;
13
- exports.splitErrorMessage = splitErrorMessage;
14
- exports.stringifyStackFrames = stringifyStackFrames;
15
- var _path = _interopRequireDefault(require("path"));
16
- var _utilsBundle = require("../utilsBundle");
17
- var _sequence = require("./sequence");
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
- /**
20
- * Copyright (c) Microsoft Corporation.
21
- *
22
- * Licensed under the Apache License, Version 2.0 (the "License");
23
- * you may not use this file except in compliance with the License.
24
- * You may obtain a copy of the License at
25
- *
26
- * http://www.apache.org/licenses/LICENSE-2.0
27
- *
28
- * Unless required by applicable law or agreed to in writing, software
29
- * distributed under the License is distributed on an "AS IS" BASIS,
30
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
- * See the License for the specific language governing permissions and
32
- * limitations under the License.
33
- */
34
-
35
- function rewriteErrorMessage(e, newMessage) {
36
- var _e$stack;
37
- const lines = (((_e$stack = e.stack) === null || _e$stack === void 0 ? void 0 : _e$stack.split('\n')) || []).filter(l => l.startsWith(' at '));
38
- e.message = newMessage;
39
- const errorTitle = `${e.name}: ${e.message}`;
40
- if (lines.length) e.stack = `${errorTitle}\n${lines.join('\n')}`;
41
- return e;
42
- }
43
- const CORE_DIR = _path.default.resolve(__dirname, '..', '..');
44
- const internalStackPrefixes = [CORE_DIR];
45
- const addInternalStackPrefix = prefix => internalStackPrefixes.push(prefix);
46
- exports.addInternalStackPrefix = addInternalStackPrefix;
47
- function captureRawStack() {
48
- const stackTraceLimit = Error.stackTraceLimit;
49
- Error.stackTraceLimit = 50;
50
- const error = new Error();
51
- const stack = error.stack || '';
52
- Error.stackTraceLimit = stackTraceLimit;
53
- return stack.split('\n');
54
- }
55
- function captureLibraryStackTrace() {
56
- const stack = captureRawStack();
57
- let parsedFrames = stack.map(line => {
58
- const frame = (0, _utilsBundle.parseStackTraceLine)(line);
59
- if (!frame || !frame.file) return null;
60
- const isPlaywrightLibrary = frame.file.startsWith(CORE_DIR);
61
- const parsed = {
62
- frame,
63
- frameText: line,
64
- isPlaywrightLibrary
65
- };
66
- return parsed;
67
- }).filter(Boolean);
68
- let apiName = '';
69
-
70
- // Deepest transition between non-client code calling into client
71
- // code is the api entry.
72
- for (let i = 0; i < parsedFrames.length - 1; i++) {
73
- const parsedFrame = parsedFrames[i];
74
- if (parsedFrame.isPlaywrightLibrary && !parsedFrames[i + 1].isPlaywrightLibrary) {
75
- apiName = apiName || normalizeAPIName(parsedFrame.frame.function);
76
- break;
77
- }
78
- }
79
- function normalizeAPIName(name) {
80
- if (!name) return '';
81
- const match = name.match(/(API|JS|CDP|[A-Z])(.*)/);
82
- if (!match) return name;
83
- return match[1].toLowerCase() + match[2];
84
- }
85
-
86
- // This is for the inspector so that it did not include the test runner stack frames.
87
- parsedFrames = parsedFrames.filter(f => {
88
- if (process.env.PWDEBUGIMPL) return true;
89
- if (internalStackPrefixes.some(prefix => f.frame.file.startsWith(prefix))) return false;
90
- return true;
91
- });
92
- return {
93
- frames: parsedFrames.map(p => p.frame),
94
- apiName
95
- };
96
- }
97
- function stringifyStackFrames(frames) {
98
- const stackLines = [];
99
- for (const frame of frames) {
100
- if (frame.function) stackLines.push(` at ${frame.function} (${frame.file}:${frame.line}:${frame.column})`);else stackLines.push(` at ${frame.file}:${frame.line}:${frame.column}`);
101
- }
102
- return stackLines;
103
- }
104
- function captureLibraryStackText() {
105
- const parsed = captureLibraryStackTrace();
106
- return stringifyStackFrames(parsed.frames).join('\n');
107
- }
108
- function splitErrorMessage(message) {
109
- const separationIdx = message.indexOf(':');
110
- return {
111
- name: separationIdx !== -1 ? message.slice(0, separationIdx) : '',
112
- message: separationIdx !== -1 && separationIdx + 2 <= message.length ? message.substring(separationIdx + 2) : message
113
- };
114
- }
115
- function formatCallLog(log) {
116
- if (!log || !log.some(l => !!l)) return '';
117
- return `
118
- Call log:
119
- ${_utilsBundle.colors.dim(log.join('\n'))}
120
- `;
121
- }
122
- function compressCallLog(log) {
123
- const lines = [];
124
- for (const block of (0, _sequence.findRepeatedSubsequences)(log)) {
125
- for (let i = 0; i < block.sequence.length; i++) {
126
- const line = block.sequence[i];
127
- const leadingWhitespace = line.match(/^\s*/);
128
- const whitespacePrefix = ' ' + (leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace[0]) || '';
129
- const countPrefix = `${block.count} × `;
130
- if (block.count > 1 && i === 0) lines.push(whitespacePrefix + countPrefix + line.trim());else if (block.count > 1) lines.push(whitespacePrefix + ' '.repeat(countPrefix.length - 2) + '- ' + line.trim());else lines.push(whitespacePrefix + '- ' + line.trim());
131
- }
132
- }
133
- return lines;
134
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.serializeClientSideCallMetadata = serializeClientSideCallMetadata;
7
- /**
8
- * Copyright (c) Microsoft Corporation.
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
-
23
- function serializeClientSideCallMetadata(metadatas) {
24
- const fileNames = new Map();
25
- const stacks = [];
26
- for (const m of metadatas) {
27
- if (!m.stack || !m.stack.length) continue;
28
- const stack = [];
29
- for (const frame of m.stack) {
30
- let ordinal = fileNames.get(frame.file);
31
- if (typeof ordinal !== 'number') {
32
- ordinal = fileNames.size;
33
- fileNames.set(frame.file, ordinal);
34
- }
35
- const stackFrame = [ordinal, frame.line || 0, frame.column || 0, frame.function || ''];
36
- stack.push(stackFrame);
37
- }
38
- stacks.push([m.id, stack]);
39
- }
40
- return {
41
- files: [...fileNames.keys()],
42
- stacks
43
- };
44
- }