patchright-core 1.50.1 → 1.51.1

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 (242) hide show
  1. package/ThirdPartyNotices.txt +1 -43
  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/inProcessFactory.js +6 -3
  46. package/lib/outofprocess.js +12 -8
  47. package/lib/protocol/validator.js +64 -13
  48. package/lib/protocol/validatorPrimitives.js +1 -2
  49. package/lib/remote/playwrightConnection.js +18 -10
  50. package/lib/remote/playwrightServer.js +20 -7
  51. package/lib/server/android/android.js +17 -14
  52. package/lib/server/android/backendAdb.js +14 -14
  53. package/lib/server/artifact.js +3 -3
  54. package/lib/server/bidi/bidiBrowser.js +2 -2
  55. package/lib/server/bidi/bidiChromium.js +4 -3
  56. package/lib/server/bidi/bidiConnection.js +1 -1
  57. package/lib/server/bidi/bidiExecutionContext.js +70 -40
  58. package/lib/server/bidi/bidiFirefox.js +4 -3
  59. package/lib/server/bidi/bidiInput.js +5 -8
  60. package/lib/server/bidi/bidiNetworkManager.js +3 -3
  61. package/lib/server/bidi/bidiOverCdp.js +2 -2
  62. package/lib/server/bidi/bidiPage.js +30 -46
  63. package/lib/server/bidi/third_party/firefoxPrefs.js +19 -3
  64. package/lib/server/browser.js +2 -2
  65. package/lib/server/browserContext.js +37 -40
  66. package/lib/server/browserType.js +18 -17
  67. package/lib/{utils/sequence.js → server/callLog.js} +18 -3
  68. package/lib/server/chromium/chromium.js +14 -14
  69. package/lib/server/chromium/chromiumSwitches.js +32 -1
  70. package/lib/server/chromium/crBrowser.js +15 -14
  71. package/lib/server/chromium/crConnection.js +2 -2
  72. package/lib/server/chromium/crCoverage.js +1 -1
  73. package/lib/server/chromium/crDevTools.js +1 -1
  74. package/lib/server/chromium/crDragDrop.js +1 -1
  75. package/lib/server/chromium/crExecutionContext.js +25 -17
  76. package/lib/server/chromium/crInput.js +2 -2
  77. package/lib/server/chromium/crNetworkManager.js +73 -26
  78. package/lib/server/chromium/crPage.js +22 -23
  79. package/lib/server/chromium/crPdf.js +1 -1
  80. package/lib/server/chromium/crProtocolHelper.js +3 -3
  81. package/lib/server/chromium/crServiceWorker.js +2 -2
  82. package/lib/server/chromium/videoRecorder.js +2 -2
  83. package/lib/server/clock.js +1 -1
  84. package/lib/server/codegen/javascript.js +1 -1
  85. package/lib/server/codegen/languages.js +2 -2
  86. package/lib/server/debugController.js +3 -3
  87. package/lib/server/deviceDescriptors.js +1 -1
  88. package/lib/server/deviceDescriptorsSource.json +131 -131
  89. package/lib/server/dispatchers/androidDispatcher.js +1 -1
  90. package/lib/server/dispatchers/artifactDispatcher.js +3 -3
  91. package/lib/server/dispatchers/browserContextDispatcher.js +19 -19
  92. package/lib/server/dispatchers/browserTypeDispatcher.js +1 -1
  93. package/lib/server/dispatchers/cdpSessionDispatcher.js +1 -1
  94. package/lib/server/dispatchers/dispatcher.js +27 -25
  95. package/lib/server/dispatchers/electronDispatcher.js +3 -3
  96. package/lib/server/dispatchers/elementHandlerDispatcher.js +7 -2
  97. package/lib/server/dispatchers/frameDispatcher.js +4 -4
  98. package/lib/server/dispatchers/jsHandleDispatcher.js +2 -2
  99. package/lib/server/dispatchers/jsonPipeDispatcher.js +2 -2
  100. package/lib/server/dispatchers/localUtilsDispatcher.js +25 -298
  101. package/lib/server/dispatchers/networkDispatchers.js +3 -3
  102. package/lib/server/dispatchers/pageDispatcher.js +11 -9
  103. package/lib/server/dispatchers/playwrightDispatcher.js +5 -5
  104. package/lib/server/dispatchers/streamDispatcher.js +4 -3
  105. package/lib/server/dispatchers/webSocketRouteDispatcher.js +8 -7
  106. package/lib/server/dispatchers/writableStreamDispatcher.js +5 -6
  107. package/lib/server/dom.js +18 -12
  108. package/lib/server/download.js +1 -1
  109. package/lib/server/electron/electron.js +17 -16
  110. package/lib/server/errors.js +1 -1
  111. package/lib/server/fetch.js +36 -25
  112. package/lib/server/fileUploadUtils.js +7 -4
  113. package/lib/server/firefox/ffBrowser.js +8 -2
  114. package/lib/server/firefox/ffConnection.js +1 -1
  115. package/lib/server/firefox/ffExecutionContext.js +25 -17
  116. package/lib/server/firefox/ffNetworkManager.js +2 -2
  117. package/lib/server/firefox/ffPage.js +15 -21
  118. package/lib/server/firefox/firefox.js +7 -9
  119. package/lib/server/frameSelectors.js +1 -1
  120. package/lib/server/frames.js +366 -209
  121. package/lib/server/har/harRecorder.js +4 -4
  122. package/lib/server/har/harTracer.js +7 -8
  123. package/lib/server/harBackend.js +157 -0
  124. package/lib/server/helper.js +2 -2
  125. package/lib/server/index.js +1 -8
  126. package/lib/server/input.js +1 -1
  127. package/lib/server/instrumentation.js +2 -2
  128. package/lib/server/isomorphic/utilityScriptSerializers.js +3 -0
  129. package/lib/server/javascript.js +46 -33
  130. package/lib/server/launchApp.js +2 -2
  131. package/lib/server/localUtils.js +203 -0
  132. package/lib/server/network.js +3 -3
  133. package/lib/server/page.js +41 -22
  134. package/lib/server/pipeTransport.js +1 -1
  135. package/lib/server/playwright.js +5 -5
  136. package/lib/server/progress.js +1 -1
  137. package/lib/server/protocolError.js +1 -1
  138. package/lib/server/recorder/contextRecorder.js +3 -3
  139. package/lib/server/recorder/recorderApp.js +18 -12
  140. package/lib/server/recorder/recorderCollection.js +3 -3
  141. package/lib/server/recorder/throttledFile.js +3 -4
  142. package/lib/server/recorder.js +7 -5
  143. package/lib/server/registry/browserFetcher.js +9 -7
  144. package/lib/server/registry/dependencies.js +15 -15
  145. package/lib/server/registry/index.js +38 -44
  146. package/lib/server/registry/oopDownloadBrowserMain.js +3 -3
  147. package/lib/server/screenshotter.js +1 -1
  148. package/lib/server/selectors.js +3 -3
  149. package/lib/server/socksClientCertificatesInterceptor.js +8 -8
  150. package/lib/server/socksInterceptor.js +8 -5
  151. package/lib/server/storageScript.js +160 -0
  152. package/lib/{common → server}/timeoutSettings.js +6 -5
  153. package/lib/server/trace/recorder/snapshotter.js +9 -8
  154. package/lib/server/trace/recorder/tracing.js +40 -31
  155. package/lib/server/trace/test/inMemorySnapshotter.js +4 -4
  156. package/lib/server/trace/viewer/traceViewer.js +13 -5
  157. package/lib/server/transport.js +2 -2
  158. package/lib/{utils → server/utils}/comparators.js +4 -4
  159. package/lib/{utils → server/utils}/crypto.js +4 -4
  160. package/lib/{utils → server/utils}/debug.js +4 -12
  161. package/lib/{utils → server/utils}/debugLogger.js +2 -2
  162. package/lib/{utils → server/utils}/env.js +4 -0
  163. package/lib/{utils → server/utils}/expectUtils.js +1 -1
  164. package/lib/{utils → server/utils}/fileUtils.js +4 -5
  165. package/lib/{utils/happy-eyeballs.js → server/utils/happyEyeballs.js} +22 -24
  166. package/lib/{utils → server/utils}/hostPlatform.js +1 -1
  167. package/lib/{utils → server/utils}/httpServer.js +8 -8
  168. package/lib/{utils → server/utils}/linuxUtils.js +3 -23
  169. package/lib/{utils → server/utils}/network.js +4 -4
  170. package/lib/server/utils/nodePlatform.js +140 -0
  171. package/lib/{protocol/transport.js → server/utils/pipeTransport.js} +2 -2
  172. package/lib/{utils → server/utils}/processLauncher.js +5 -5
  173. package/lib/{utils → server/utils}/profiler.js +5 -6
  174. package/lib/{common → server/utils}/socksProxy.js +10 -9
  175. package/lib/{utils → server/utils}/userAgent.js +2 -16
  176. package/lib/{utils → server/utils}/wsServer.js +3 -3
  177. package/lib/{utils → server/utils}/zipFile.js +1 -1
  178. package/lib/{utils → server/utils}/zones.js +9 -24
  179. package/lib/server/webkit/webkit.js +4 -4
  180. package/lib/server/webkit/wkBrowser.js +4 -4
  181. package/lib/server/webkit/wkConnection.js +1 -1
  182. package/lib/server/webkit/wkExecutionContext.js +25 -17
  183. package/lib/server/webkit/wkInput.js +2 -2
  184. package/lib/server/webkit/wkInterceptableRequest.js +2 -2
  185. package/lib/server/webkit/wkPage.js +41 -40
  186. package/lib/server/webkit/wkProvisionalPage.js +1 -1
  187. package/lib/server/webkit/wkWorkers.js +2 -2
  188. package/lib/utils/isomorphic/ariaSnapshot.js +2 -1
  189. package/lib/utils/isomorphic/assert.js +25 -0
  190. package/lib/utils/isomorphic/colors.js +65 -0
  191. package/lib/utils/isomorphic/cssParser.js +1 -1
  192. package/lib/utils/isomorphic/locatorGenerators.js +13 -1
  193. package/lib/utils/isomorphic/locatorParser.js +2 -2
  194. package/lib/utils/{manualPromise.js → isomorphic/manualPromise.js} +3 -5
  195. package/lib/utils/isomorphic/mimeType.js +11 -3
  196. package/lib/utils/{multimap.js → isomorphic/multimap.js} +1 -3
  197. package/lib/utils/{rtti.js → isomorphic/rtti.js} +2 -5
  198. package/lib/utils/isomorphic/stackTrace.js +169 -0
  199. package/lib/utils/isomorphic/stringUtils.js +1 -1
  200. package/lib/utils/{time.js → isomorphic/time.js} +1 -13
  201. package/lib/utils/{timeoutRunner.js → isomorphic/timeoutRunner.js} +4 -4
  202. package/lib/utils/isomorphic/traceUtils.js +23 -0
  203. package/lib/{utils/index.js → utils.js} +200 -121
  204. package/lib/utilsBundle.js +1 -25
  205. package/lib/utilsBundleImpl/index.js +114 -116
  206. package/lib/vite/htmlReport/index.html +20 -20
  207. package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +24 -0
  208. package/lib/vite/recorder/assets/index-ELPgmkwA.js +184 -0
  209. package/lib/vite/recorder/index.html +1 -1
  210. package/lib/vite/traceViewer/assets/codeMirrorModule-DpJ-EmBQ.js +24 -0
  211. package/lib/vite/traceViewer/assets/defaultSettingsView-DTenqiGw.js +259 -0
  212. package/lib/vite/traceViewer/assets/{xtermModule-c-SNdYZy.js → xtermModule-BoAIEibi.js} +7 -7
  213. package/lib/vite/traceViewer/defaultSettingsView.5fN5lw10.css +1 -0
  214. package/lib/vite/traceViewer/index.CUq7VgrV.js +2 -0
  215. package/lib/vite/traceViewer/index.html +3 -3
  216. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  217. package/lib/vite/traceViewer/uiMode.CHJSAD7F.js +5 -0
  218. package/lib/vite/traceViewer/uiMode.html +3 -3
  219. package/lib/zipBundleImpl.js +4 -4
  220. package/package.json +7 -7
  221. package/types/protocol.d.ts +123 -99
  222. package/types/types.d.ts +91 -37
  223. package/lib/utils/stackTrace.js +0 -134
  224. package/lib/utils/traceUtils.js +0 -44
  225. package/lib/vite/recorder/assets/codeMirrorModule-CNAqJrkA.js +0 -24
  226. package/lib/vite/recorder/assets/index-DGS0JLxS.js +0 -184
  227. package/lib/vite/traceViewer/assets/codeMirrorModule-D55P_UuL.js +0 -24
  228. package/lib/vite/traceViewer/assets/defaultSettingsView-B-uNoFsX.js +0 -243
  229. package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +0 -1
  230. package/lib/vite/traceViewer/index.BfvuujqP.js +0 -2
  231. package/lib/vite/traceViewer/uiMode.CStJu6jo.js +0 -5
  232. /package/lib/{utils → server/utils}/ascii.js +0 -0
  233. /package/lib/{utils → server/utils}/eventsHelper.js +0 -0
  234. /package/lib/{image_tools → server/utils/image_tools}/colorUtils.js +0 -0
  235. /package/lib/{image_tools → server/utils/image_tools}/compare.js +0 -0
  236. /package/lib/{image_tools → server/utils/image_tools}/imageChannel.js +0 -0
  237. /package/lib/{image_tools → server/utils/image_tools}/stats.js +0 -0
  238. /package/lib/{utils → server/utils}/spawnAsync.js +0 -0
  239. /package/lib/{utils → server/utils}/task.js +0 -0
  240. /package/lib/utils/{headers.js → isomorphic/headers.js} +0 -0
  241. /package/lib/utils/{semaphore.js → isomorphic/semaphore.js} +0 -0
  242. /package/lib/{common → utils/isomorphic}/types.js +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).
@@ -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
  *
@@ -14615,14 +14633,12 @@ export interface BrowserType<Unused = {}> {
14615
14633
  */
14616
14634
  connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>;
14617
14635
  /**
14618
- * This method attaches Playwright to an existing browser instance created via
14619
- * [browserType.launchServer([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server).
14636
+ * This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
14620
14637
  *
14621
14638
  * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
14622
14639
  * Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
14623
14640
  *
14624
- * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via
14625
- * [browserServer.wsEndpoint()](https://playwright.dev/docs/api/class-browserserver#browser-server-ws-endpoint).
14641
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
14626
14642
  * @param options
14627
14643
  */
14628
14644
  connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
@@ -14633,14 +14649,12 @@ export interface BrowserType<Unused = {}> {
14633
14649
  * @deprecated
14634
14650
  */
14635
14651
  /**
14636
- * This method attaches Playwright to an existing browser instance created via
14637
- * [browserType.launchServer([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server).
14652
+ * This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
14638
14653
  *
14639
14654
  * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
14640
14655
  * Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
14641
14656
  *
14642
- * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via
14643
- * [browserServer.wsEndpoint()](https://playwright.dev/docs/api/class-browserserver#browser-server-ws-endpoint).
14657
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
14644
14658
  * @param options
14645
14659
  */
14646
14660
  connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
@@ -14813,6 +14827,13 @@ export interface BrowserType<Unused = {}> {
14813
14827
  */
14814
14828
  colorScheme?: null|"light"|"dark"|"no-preference";
14815
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
+
14816
14837
  /**
14817
14838
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
14818
14839
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -16625,6 +16646,13 @@ export interface AndroidDevice {
16625
16646
  */
16626
16647
  colorScheme?: null|"light"|"dark"|"no-preference";
16627
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
+
16628
16656
  /**
16629
16657
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
16630
16658
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -17500,6 +17528,12 @@ export interface APIRequest {
17500
17528
  */
17501
17529
  extraHTTPHeaders?: { [key: string]: string; };
17502
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
+
17503
17537
  /**
17504
17538
  * Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
17505
17539
  * origin is specified, the username and password are sent to any servers upon unauthorized responses.
@@ -18369,6 +18403,11 @@ export interface APIRequestContext {
18369
18403
  * @param options
18370
18404
  */
18371
18405
  storageState(options?: {
18406
+ /**
18407
+ * Set to `true` to include IndexedDB in the storage state snapshot.
18408
+ */
18409
+ indexedDB?: boolean;
18410
+
18372
18411
  /**
18373
18412
  * The file path to save the storage state to. If
18374
18413
  * [`path`](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-storage-state-option-path) is
@@ -21067,6 +21106,9 @@ export interface Selectors {
21067
21106
  /**
21068
21107
  * The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on
21069
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.
21070
21112
  */
21071
21113
  export interface Touchscreen {
21072
21114
  /**
@@ -21317,8 +21359,11 @@ export interface WebError {
21317
21359
  }
21318
21360
 
21319
21361
  /**
21320
- * The [WebSocket](https://playwright.dev/docs/api/class-websocket) class represents websocket connections in the
21321
- * 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).
21322
21367
  */
21323
21368
  export interface WebSocket {
21324
21369
  /**
@@ -21803,7 +21848,8 @@ export interface LocatorScreenshotOptions {
21803
21848
  * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
21804
21849
  * box `#FF00FF` (customized by
21805
21850
  * [`maskColor`](https://playwright.dev/docs/api/class-locator#locator-screenshot-option-mask-color)) that completely
21806
- * 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.
21807
21853
  */
21808
21854
  mask?: Array<Locator>;
21809
21855
 
@@ -21982,6 +22028,13 @@ export interface BrowserContextOptions {
21982
22028
  */
21983
22029
  colorScheme?: null|"light"|"dark"|"no-preference";
21984
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
+
21985
22038
  /**
21986
22039
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
21987
22040
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -22228,12 +22281,12 @@ export interface BrowserContextOptions {
22228
22281
  sameSite: "Strict"|"Lax"|"None";
22229
22282
  }>;
22230
22283
 
22231
- /**
22232
- * localStorage to set for context
22233
- */
22234
22284
  origins: Array<{
22235
22285
  origin: string;
22236
22286
 
22287
+ /**
22288
+ * localStorage to set for context
22289
+ */
22237
22290
  localStorage: Array<{
22238
22291
  name: string;
22239
22292
 
@@ -22461,7 +22514,8 @@ export interface PageScreenshotOptions {
22461
22514
  * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
22462
22515
  * box `#FF00FF` (customized by
22463
22516
  * [`maskColor`](https://playwright.dev/docs/api/class-page#page-screenshot-option-mask-color)) that completely covers
22464
- * 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.
22465
22519
  */
22466
22520
  mask?: Array<Locator>;
22467
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
- }