patchright-core 1.48.2 → 1.49.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 (110) hide show
  1. package/README.md +2 -2
  2. package/ThirdPartyNotices.txt +70 -384
  3. package/bin/reinstall_chrome_beta_linux.sh +10 -8
  4. package/bin/reinstall_chrome_stable_linux.sh +10 -8
  5. package/bin/reinstall_msedge_beta_linux.sh +11 -9
  6. package/bin/reinstall_msedge_dev_linux.sh +11 -9
  7. package/bin/reinstall_msedge_stable_linux.sh +11 -9
  8. package/browsers.json +19 -11
  9. package/lib/cli/program.js +23 -5
  10. package/lib/client/channelOwner.js +2 -2
  11. package/lib/client/locator.js +7 -0
  12. package/lib/client/network.js +5 -0
  13. package/lib/client/page.js +4 -2
  14. package/lib/client/tracing.js +13 -0
  15. package/lib/client/waiter.js +15 -11
  16. package/lib/generated/consoleApiSource.js +1 -1
  17. package/lib/generated/injectedScriptSource.js +1 -1
  18. package/lib/generated/pollingRecorderSource.js +1 -1
  19. package/lib/generated/webSocketMockSource.js +1 -1
  20. package/lib/protocol/validator.js +23 -3
  21. package/lib/server/ariaSnapshot.js +33 -0
  22. package/lib/server/bidi/bidiChromium.js +1 -1
  23. package/lib/server/bidi/bidiConnection.js +0 -2
  24. package/lib/server/bidi/bidiExecutionContext.js +0 -3
  25. package/lib/server/browserType.js +4 -1
  26. package/lib/server/chromium/chromium.js +6 -2
  27. package/lib/server/chromium/crExecutionContext.js +0 -13
  28. package/lib/server/chromium/crNetworkManager.js +1 -1
  29. package/lib/server/chromium/crPage.js +4 -5
  30. package/lib/server/codegen/csharp.js +11 -16
  31. package/lib/server/codegen/java.js +4 -7
  32. package/lib/server/codegen/javascript.js +28 -6
  33. package/lib/server/codegen/python.js +12 -16
  34. package/lib/server/debugController.js +8 -5
  35. package/lib/server/deviceDescriptorsSource.json +127 -127
  36. package/lib/server/dispatchers/androidDispatcher.js +13 -2
  37. package/lib/server/dispatchers/debugControllerDispatcher.js +1 -1
  38. package/lib/server/dispatchers/dispatcher.js +1 -1
  39. package/lib/server/dispatchers/frameDispatcher.js +8 -1
  40. package/lib/server/dispatchers/tracingDispatcher.js +10 -0
  41. package/lib/server/dom.js +79 -36
  42. package/lib/server/fetch.js +30 -17
  43. package/lib/server/firefox/ffExecutionContext.js +0 -12
  44. package/lib/server/firefox/ffNetworkManager.js +1 -1
  45. package/lib/server/frames.js +55 -62
  46. package/lib/server/index.js +0 -6
  47. package/lib/server/javascript.js +0 -6
  48. package/lib/server/page.js +32 -5
  49. package/lib/server/progress.js +0 -3
  50. package/lib/server/recorder/recorderApp.js +6 -15
  51. package/lib/server/recorder/recorderInTraceViewer.js +3 -3
  52. package/lib/server/recorder/recorderUtils.js +2 -1
  53. package/lib/server/recorder.js +66 -31
  54. package/lib/server/registry/index.js +70 -23
  55. package/lib/server/registry/nativeDeps.js +6 -3
  56. package/lib/server/socksClientCertificatesInterceptor.js +1 -1
  57. package/lib/server/trace/recorder/snapshotter.js +1 -12
  58. package/lib/server/trace/recorder/snapshotterInjected.js +19 -1
  59. package/lib/server/trace/recorder/tracing.js +69 -15
  60. package/lib/server/trace/test/inMemorySnapshotter.js +3 -3
  61. package/lib/server/trace/viewer/traceViewer.js +2 -1
  62. package/lib/server/webkit/wkBrowser.js +2 -2
  63. package/lib/server/webkit/wkExecutionContext.js +0 -13
  64. package/lib/server/webkit/wkPage.js +4 -0
  65. package/lib/utils/comparators.js +12 -30
  66. package/lib/utils/crypto.js +1 -4
  67. package/lib/utils/hostPlatform.js +6 -0
  68. package/lib/utils/isomorphic/ariaSnapshot.js +267 -0
  69. package/lib/utils/isomorphic/locatorGenerators.js +23 -5
  70. package/lib/utils/isomorphic/recorderUtils.js +36 -4
  71. package/lib/utils/isomorphic/stringUtils.js +30 -0
  72. package/lib/utils/isomorphic/urlMatch.js +5 -1
  73. package/lib/utils/network.js +1 -1
  74. package/lib/utils/sequence.js +64 -0
  75. package/lib/utils/stackTrace.js +16 -3
  76. package/lib/utils/zones.js +32 -23
  77. package/lib/utilsBundle.js +4 -5
  78. package/lib/utilsBundleImpl/index.js +190 -33
  79. package/lib/vite/htmlReport/index.html +19 -16
  80. package/lib/vite/recorder/assets/codeMirrorModule-AFvV6hAs.js +24 -0
  81. package/lib/vite/recorder/assets/index-_cTWgVuJ.js +184 -0
  82. package/lib/vite/recorder/assets/{index-BW-aOBcL.css → index-iA1aAGZg.css} +1 -1
  83. package/lib/vite/recorder/index.html +2 -2
  84. package/lib/vite/traceViewer/assets/codeMirrorModule-BWCrdKft.js +24 -0
  85. package/lib/vite/traceViewer/assets/inspectorTab-C_9qyxv5.js +68 -0
  86. package/lib/vite/traceViewer/assets/workbench-DsQEOQud.js +9 -0
  87. package/lib/vite/traceViewer/{embedded.BlHoW5LY.js → embedded.D4x_-tXl.js} +1 -1
  88. package/lib/vite/traceViewer/embedded.html +5 -5
  89. package/lib/vite/traceViewer/{index.DaWVfou1.js → index.BskMikzx.js} +1 -1
  90. package/lib/vite/traceViewer/index.html +24 -7
  91. package/lib/vite/traceViewer/{inspectorTab.DLjBDrQR.css → inspectorTab.DEOUW62d.css} +1 -1
  92. package/lib/vite/traceViewer/recorder.Dsk1wX5k.js +2 -0
  93. package/lib/vite/traceViewer/recorder.html +3 -3
  94. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  95. package/lib/vite/traceViewer/uiMode.CzKr-TMc.js +5 -0
  96. package/lib/vite/traceViewer/uiMode.html +6 -6
  97. package/lib/vite/traceViewer/{uiMode.CAYqod-m.css → uiMode.voC1ZiOQ.css} +1 -1
  98. package/lib/vite/traceViewer/workbench.C-zR9ysA.css +1 -0
  99. package/package.json +1 -1
  100. package/types/protocol.d.ts +58 -10
  101. package/types/types.d.ts +116 -20
  102. package/lib/third_party/diff_match_patch.js +0 -2222
  103. package/lib/vite/recorder/assets/codeMirrorModule-baozm8ur.js +0 -24
  104. package/lib/vite/recorder/assets/index-2ElAIWFB.js +0 -42
  105. package/lib/vite/traceViewer/assets/codeMirrorModule-Bh1rfd2w.js +0 -24
  106. package/lib/vite/traceViewer/assets/inspectorTab-7GHnKvSD.js +0 -64
  107. package/lib/vite/traceViewer/assets/workbench-DPQnTHYP.js +0 -9
  108. package/lib/vite/traceViewer/recorder.C4zxcvd2.js +0 -2
  109. package/lib/vite/traceViewer/uiMode.mTXWniJb.js +0 -5
  110. package/lib/vite/traceViewer/workbench.D3JVcA9K.css +0 -1
package/types/types.d.ts CHANGED
@@ -2553,16 +2553,15 @@ export interface Page {
2553
2553
  * // → true
2554
2554
  * await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
2555
2555
  * // → false
2556
- * await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches);
2557
- * // → false
2558
2556
  * ```
2559
2557
  *
2560
2558
  * @param options
2561
2559
  */
2562
2560
  emulateMedia(options?: {
2563
2561
  /**
2564
- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`.
2565
- * Passing `null` disables color scheme emulation.
2562
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
2563
+ * media feature, supported values are `'light'` and `'dark'`. Passing `null` disables color scheme emulation.
2564
+ * `'no-preference'` is deprecated.
2566
2565
  */
2567
2566
  colorScheme?: null|"light"|"dark"|"no-preference";
2568
2567
 
@@ -9761,7 +9760,8 @@ export interface Browser {
9761
9760
  }>;
9762
9761
 
9763
9762
  /**
9764
- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
9763
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
9764
+ * media feature, supported values are `'light'` and `'dark'`. See
9765
9765
  * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
9766
9766
  * Passing `null` resets emulation to system defaults. Defaults to `'light'`.
9767
9767
  */
@@ -12424,6 +12424,57 @@ export interface Locator {
12424
12424
  */
12425
12425
  and(locator: Locator): Locator;
12426
12426
 
12427
+ /**
12428
+ * Captures the aria snapshot of the given element. Read more about [aria snapshots](https://playwright.dev/docs/aria-snapshots) and
12429
+ * [expect(locator).toMatchAriaSnapshot(expected[, options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-match-aria-snapshot)
12430
+ * for the corresponding assertion.
12431
+ *
12432
+ * **Usage**
12433
+ *
12434
+ * ```js
12435
+ * await page.getByRole('link').ariaSnapshot();
12436
+ * ```
12437
+ *
12438
+ * **Details**
12439
+ *
12440
+ * This method captures the aria snapshot of the given element. The snapshot is a string that represents the state of
12441
+ * the element and its children. The snapshot can be used to assert the state of the element in the test, or to
12442
+ * compare it to state in the future.
12443
+ *
12444
+ * The ARIA snapshot is represented using [YAML](https://yaml.org/spec/1.2.2/) markup language:
12445
+ * - The keys of the objects are the roles and optional accessible names of the elements.
12446
+ * - The values are either text content or an array of child elements.
12447
+ * - Generic static text can be represented with the `text` key.
12448
+ *
12449
+ * Below is the HTML markup and the respective ARIA snapshot:
12450
+ *
12451
+ * ```html
12452
+ * <ul aria-label="Links">
12453
+ * <li><a href="/">Home</a></li>
12454
+ * <li><a href="/about">About</a></li>
12455
+ * <ul>
12456
+ * ```
12457
+ *
12458
+ * ```yml
12459
+ * - list "Links":
12460
+ * - listitem:
12461
+ * - link "Home"
12462
+ * - listitem:
12463
+ * - link "About"
12464
+ * ```
12465
+ *
12466
+ * @param options
12467
+ */
12468
+ ariaSnapshot(options?: {
12469
+ /**
12470
+ * Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
12471
+ * option in the config, or by using the
12472
+ * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
12473
+ * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
12474
+ */
12475
+ timeout?: number;
12476
+ }): Promise<string>;
12477
+
12427
12478
  /**
12428
12479
  * Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur) on the element.
12429
12480
  * @param options
@@ -14726,7 +14777,8 @@ export interface BrowserType<Unused = {}> {
14726
14777
  }>;
14727
14778
 
14728
14779
  /**
14729
- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
14780
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
14781
+ * media feature, supported values are `'light'` and `'dark'`. See
14730
14782
  * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
14731
14783
  * Passing `null` resets emulation to system defaults. Defaults to `'light'`.
14732
14784
  */
@@ -16534,7 +16586,8 @@ export interface AndroidDevice {
16534
16586
  bypassCSP?: boolean;
16535
16587
 
16536
16588
  /**
16537
- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
16589
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
16590
+ * media feature, supported values are `'light'` and `'dark'`. See
16538
16591
  * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
16539
16592
  * Passing `null` resets emulation to system defaults. Defaults to `'light'`.
16540
16593
  */
@@ -18554,6 +18607,10 @@ export interface Clock {
18554
18607
  /**
18555
18608
  * Makes `Date.now` and `new Date()` return fixed fake time at all times, keeps all the timers running.
18556
18609
  *
18610
+ * Use this method for simple scenarios where you only need to test with a predefined time. For more advanced
18611
+ * scenarios, use [clock.install([options])](https://playwright.dev/docs/api/class-clock#clock-install) instead. Read
18612
+ * docs on [clock emulation](https://playwright.dev/docs/clock) to learn more.
18613
+ *
18557
18614
  * **Usage**
18558
18615
  *
18559
18616
  * ```js
@@ -18567,7 +18624,8 @@ export interface Clock {
18567
18624
  setFixedTime(time: number|string|Date): Promise<void>;
18568
18625
 
18569
18626
  /**
18570
- * Sets current system time but does not trigger any timers.
18627
+ * Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for
18628
+ * example switching from summer to winter time, or changing time zones.
18571
18629
  *
18572
18630
  * **Usage**
18573
18631
  *
@@ -19010,7 +19068,8 @@ export interface Electron {
19010
19068
  bypassCSP?: boolean;
19011
19069
 
19012
19070
  /**
19013
- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
19071
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
19072
+ * media feature, supported values are `'light'` and `'dark'`. See
19014
19073
  * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
19015
19074
  * Passing `null` resets emulation to system defaults. Defaults to `'light'`.
19016
19075
  */
@@ -19760,10 +19819,7 @@ export interface FrameLocator {
19760
19819
  * An example to trigger select-all with the keyboard
19761
19820
  *
19762
19821
  * ```js
19763
- * // on Windows and Linux
19764
- * await page.keyboard.press('Control+A');
19765
- * // on macOS
19766
- * await page.keyboard.press('Meta+A');
19822
+ * await page.keyboard.press('ControlOrMeta+A');
19767
19823
  * ```
19768
19824
  *
19769
19825
  */
@@ -20618,12 +20674,12 @@ export interface Route {
20618
20674
  *
20619
20675
  * **Details**
20620
20676
  *
20621
- * Note that any overrides such as [`url`](https://playwright.dev/docs/api/class-route#route-continue-option-url) or
20622
- * [`headers`](https://playwright.dev/docs/api/class-route#route-continue-option-headers) only apply to the request
20623
- * being routed. If this request results in a redirect, overrides will not be applied to the new redirected request.
20624
- * If you want to propagate a header through redirects, use the combination of
20625
- * [route.fetch([options])](https://playwright.dev/docs/api/class-route#route-fetch) and
20626
- * [route.fulfill([options])](https://playwright.dev/docs/api/class-route#route-fulfill) instead.
20677
+ * The [`headers`](https://playwright.dev/docs/api/class-route#route-continue-option-headers) option applies to both
20678
+ * the routed request and any redirects it initiates. However,
20679
+ * [`url`](https://playwright.dev/docs/api/class-route#route-continue-option-url),
20680
+ * [`method`](https://playwright.dev/docs/api/class-route#route-continue-option-method), and
20681
+ * [`postData`](https://playwright.dev/docs/api/class-route#route-continue-option-post-data) only apply to the
20682
+ * original request and are not carried over to redirected requests.
20627
20683
  *
20628
20684
  * [route.continue([options])](https://playwright.dev/docs/api/class-route#route-continue) will immediately send the
20629
20685
  * request to the network, other matching handlers won't be invoked. Use
@@ -20999,6 +21055,45 @@ export interface Touchscreen {
20999
21055
  *
21000
21056
  */
21001
21057
  export interface Tracing {
21058
+ /**
21059
+ * **NOTE** Use `test.step` instead when available.
21060
+ *
21061
+ * Creates a new group within the trace, assigning any subsequent API calls to this group, until
21062
+ * [tracing.groupEnd()](https://playwright.dev/docs/api/class-tracing#tracing-group-end) is called. Groups can be
21063
+ * nested and will be visible in the trace viewer.
21064
+ *
21065
+ * **Usage**
21066
+ *
21067
+ * ```js
21068
+ * // use test.step instead
21069
+ * await test.step('Log in', async () => {
21070
+ * // ...
21071
+ * });
21072
+ * ```
21073
+ *
21074
+ * @param name Group name shown in the trace viewer.
21075
+ * @param options
21076
+ */
21077
+ group(name: string, options?: {
21078
+ /**
21079
+ * Specifies a custom location for the group to be shown in the trace viewer. Defaults to the location of the
21080
+ * [tracing.group(name[, options])](https://playwright.dev/docs/api/class-tracing#tracing-group) call.
21081
+ */
21082
+ location?: {
21083
+ file: string;
21084
+
21085
+ line?: number;
21086
+
21087
+ column?: number;
21088
+ };
21089
+ }): Promise<void>;
21090
+
21091
+ /**
21092
+ * Closes the last group created by
21093
+ * [tracing.group(name[, options])](https://playwright.dev/docs/api/class-tracing#tracing-group).
21094
+ */
21095
+ groupEnd(): Promise<void>;
21096
+
21002
21097
  /**
21003
21098
  * Start tracing.
21004
21099
  *
@@ -21832,7 +21927,8 @@ export interface BrowserContextOptions {
21832
21927
  }>;
21833
21928
 
21834
21929
  /**
21835
- * Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
21930
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
21931
+ * media feature, supported values are `'light'` and `'dark'`. See
21836
21932
  * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
21837
21933
  * Passing `null` resets emulation to system defaults. Defaults to `'light'`.
21838
21934
  */