rebrowser-playwright-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 (112) 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/crConnection.js +153 -0
  28. package/lib/server/chromium/crExecutionContext.js +0 -13
  29. package/lib/server/chromium/crPage.js +8 -10
  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 +66 -196
  46. package/lib/server/index.js +0 -6
  47. package/lib/server/javascript.js +0 -6
  48. package/lib/server/launchApp.js +5 -5
  49. package/lib/server/page.js +52 -8
  50. package/lib/server/progress.js +0 -3
  51. package/lib/server/recorder/recorderApp.js +6 -15
  52. package/lib/server/recorder/recorderCollection.js +1 -1
  53. package/lib/server/recorder/recorderInTraceViewer.js +3 -3
  54. package/lib/server/recorder/recorderUtils.js +2 -1
  55. package/lib/server/recorder.js +66 -31
  56. package/lib/server/registry/index.js +70 -23
  57. package/lib/server/registry/nativeDeps.js +6 -3
  58. package/lib/server/socksClientCertificatesInterceptor.js +1 -1
  59. package/lib/server/trace/recorder/snapshotter.js +1 -12
  60. package/lib/server/trace/recorder/snapshotterInjected.js +19 -1
  61. package/lib/server/trace/recorder/tracing.js +69 -15
  62. package/lib/server/trace/test/inMemorySnapshotter.js +3 -3
  63. package/lib/server/trace/viewer/traceViewer.js +2 -1
  64. package/lib/server/webkit/wkBrowser.js +2 -2
  65. package/lib/server/webkit/wkExecutionContext.js +0 -13
  66. package/lib/server/webkit/wkPage.js +6 -0
  67. package/lib/utils/comparators.js +12 -30
  68. package/lib/utils/crypto.js +1 -4
  69. package/lib/utils/hostPlatform.js +6 -0
  70. package/lib/utils/isomorphic/ariaSnapshot.js +267 -0
  71. package/lib/utils/isomorphic/locatorGenerators.js +23 -5
  72. package/lib/utils/isomorphic/recorderUtils.js +36 -4
  73. package/lib/utils/isomorphic/stringUtils.js +30 -0
  74. package/lib/utils/isomorphic/urlMatch.js +5 -1
  75. package/lib/utils/network.js +1 -1
  76. package/lib/utils/sequence.js +64 -0
  77. package/lib/utils/stackTrace.js +16 -3
  78. package/lib/utils/zones.js +32 -23
  79. package/lib/utilsBundle.js +4 -5
  80. package/lib/utilsBundleImpl/index.js +190 -33
  81. package/lib/vite/htmlReport/index.html +19 -16
  82. package/lib/vite/recorder/assets/codeMirrorModule-C5j27SYZ.js +24 -0
  83. package/lib/vite/recorder/assets/{index-BW-aOBcL.css → index-iA1aAGZg.css} +1 -1
  84. package/lib/vite/recorder/assets/index-m0XdVJHe.js +184 -0
  85. package/lib/vite/recorder/index.html +2 -2
  86. package/lib/vite/traceViewer/assets/codeMirrorModule-BBCX0spr.js +24 -0
  87. package/lib/vite/traceViewer/assets/inspectorTab-B4Iw34Ow.js +68 -0
  88. package/lib/vite/traceViewer/assets/workbench-DFlGYqou.js +9 -0
  89. package/lib/vite/traceViewer/{embedded.BlHoW5LY.js → embedded.CmarehFk.js} +1 -1
  90. package/lib/vite/traceViewer/embedded.html +5 -5
  91. package/lib/vite/traceViewer/{index.DaWVfou1.js → index.FBucu_gE.js} +1 -1
  92. package/lib/vite/traceViewer/index.html +24 -7
  93. package/lib/vite/traceViewer/{inspectorTab.DLjBDrQR.css → inspectorTab.DEOUW62d.css} +1 -1
  94. package/lib/vite/traceViewer/recorder.CW_rzcEp.js +2 -0
  95. package/lib/vite/traceViewer/recorder.html +3 -3
  96. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  97. package/lib/vite/traceViewer/uiMode.CDUVjusr.js +5 -0
  98. package/lib/vite/traceViewer/uiMode.html +6 -6
  99. package/lib/vite/traceViewer/{uiMode.CAYqod-m.css → uiMode.voC1ZiOQ.css} +1 -1
  100. package/lib/vite/traceViewer/workbench.C-zR9ysA.css +1 -0
  101. package/package.json +1 -1
  102. package/types/protocol.d.ts +58 -10
  103. package/types/types.d.ts +134 -29
  104. package/lib/third_party/diff_match_patch.js +0 -2222
  105. package/lib/vite/recorder/assets/codeMirrorModule-baozm8ur.js +0 -24
  106. package/lib/vite/recorder/assets/index-2ElAIWFB.js +0 -42
  107. package/lib/vite/traceViewer/assets/codeMirrorModule-Bh1rfd2w.js +0 -24
  108. package/lib/vite/traceViewer/assets/inspectorTab-7GHnKvSD.js +0 -64
  109. package/lib/vite/traceViewer/assets/workbench-DPQnTHYP.js +0 -9
  110. package/lib/vite/traceViewer/recorder.C4zxcvd2.js +0 -2
  111. package/lib/vite/traceViewer/uiMode.mTXWniJb.js +0 -5
  112. package/lib/vite/traceViewer/workbench.D3JVcA9K.css +0 -1
@@ -22,7 +22,6 @@ var _selectorParser = require("../utils/isomorphic/selectorParser");
22
22
  var _frameSelectors = require("./frameSelectors");
23
23
  var _errors = require("./errors");
24
24
  var _fileUploadUtils = require("./fileUploadUtils");
25
- var _crExecutionContext = require("./chromium/crExecutionContext");
26
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
27
  /**
@@ -61,7 +60,6 @@ class FrameManager {
61
60
  this._webSockets = new Map();
62
61
  this._openedDialogs = new Set();
63
62
  this._closeAllOpeningDialogs = false;
64
- this.__re__contexts = undefined;
65
63
  this._page = page;
66
64
  this._mainFrame = undefined;
67
65
  }
@@ -197,6 +195,11 @@ class FrameManager {
197
195
  frameCommittedSameDocumentNavigation(frameId, url) {
198
196
  const frame = this._frames.get(frameId);
199
197
  if (!frame) return;
198
+ const pending = frame.pendingDocument();
199
+ if (pending && pending.documentId === undefined && pending.request === undefined) {
200
+ // WebKit has notified about the same-document navigation being requested, so clear it.
201
+ frame.setPendingDocument(undefined);
202
+ }
200
203
  frame._url = url;
201
204
  const navigationEvent = {
202
205
  url,
@@ -429,7 +432,8 @@ class Frame extends _instrumentation.SdkObject {
429
432
  if (this._inflightRequests.size === 0) this._startNetworkIdleTimer();
430
433
  this._page.mainFrame()._recalculateNetworkIdle(this);
431
434
  this._onLifecycleEvent('commit');
432
- this.__re__contexts = undefined;
435
+ const crSession = (this._page._delegate._sessions.get(this._id) || this._page._delegate._mainFrameSession)._client;
436
+ crSession.emit('Runtime.executionContextsCleared');
433
437
  }
434
438
  setPendingDocument(documentInfo) {
435
439
  this._pendingDocument = documentInfo;
@@ -584,174 +588,29 @@ class Frame extends _instrumentation.SdkObject {
584
588
  async frameElement() {
585
589
  return this._page._delegate.getFrameElement(this);
586
590
  }
587
- async __re__getMainWorld({
588
- client,
589
- frameId
590
- }) {
591
- let contextId;
592
-
593
- // random name to make it harder to detect for any 3rd party script by watching window object and events
594
- const randomName = [...Array(Math.floor(Math.random() * (10 + 1)) + 10)].map(() => Math.random().toString(36)[2]).join('');
595
- process.env['REBROWSER_PATCHES_DEBUG'] && console.log(`[rebrowser-patches][getMainWorld] binding name = ${randomName}`);
596
-
597
- // add the binding
598
- await client.send('Runtime.addBinding', {
599
- name: randomName
600
- });
601
-
602
- // listen for 'Runtime.bindingCalled' event
603
- const bindingCalledHandler = ({
604
- name,
605
- payload,
606
- executionContextId
607
- }) => {
608
- process.env['REBROWSER_PATCHES_DEBUG'] && console.log('[rebrowser-patches][bindingCalledHandler]', {
609
- name,
610
- payload,
611
- executionContextId
612
- });
613
- if (contextId > 0) {
614
- // already acquired the id
615
- return;
616
- }
617
- if (name !== randomName) {
618
- // ignore irrelevant bindings
619
- return;
620
- }
621
- if (payload !== frameId) {
622
- // ignore irrelevant frames
623
- return;
624
- }
625
- contextId = executionContextId;
626
- // remove this listener
627
- client.off('Runtime.bindingCalled', bindingCalledHandler);
628
- };
629
- client.on('Runtime.bindingCalled', bindingCalledHandler);
630
-
631
- // we could call the binding right from addScriptToEvaluateOnNewDocument, but this way it will be called in all existing frames and it's hard to distinguish children from the parent
632
- await client.send('Page.addScriptToEvaluateOnNewDocument', {
633
- source: `document.addEventListener('${randomName}', (e) => self['${randomName}'](e.detail.frameId))`,
634
- runImmediately: true
635
- });
636
-
637
- // create new isolated world for this frame
638
- const createIsolatedWorldResult = await client.send('Page.createIsolatedWorld', {
639
- frameId,
640
- // use randomName for worldName to distinguish from normal utility world
641
- worldName: randomName,
642
- grantUniveralAccess: true
643
- });
644
-
645
- // emit event in the specific frame from the isolated world
646
- await client.send('Runtime.evaluate', {
647
- expression: `document.dispatchEvent(new CustomEvent('${randomName}', { detail: { frameId: '${frameId}' } }))`,
648
- contextId: createIsolatedWorldResult.executionContextId
649
- });
650
- process.env['REBROWSER_PATCHES_DEBUG'] && console.log(`[rebrowser-patches][getMainWorld] result:`, {
651
- contextId
652
- });
653
- return contextId;
654
- }
655
- async __re__getIsolatedWorld({
656
- client,
657
- frameId,
658
- worldName
659
- }) {
660
- const createIsolatedWorldResult = await client.send('Page.createIsolatedWorld', {
661
- frameId,
662
- worldName,
663
- grantUniveralAccess: true
664
- });
665
- process.env['REBROWSER_PATCHES_DEBUG'] && console.log(`[rebrowser-patches][getIsolatedWorld] result:`, createIsolatedWorldResult);
666
- return createIsolatedWorldResult.executionContextId;
667
- }
668
- _context(world) {
669
- const fixMode = process.env['REBROWSER_PATCHES_RUNTIME_FIX_MODE'] || 'addBinding';
670
- process.env['REBROWSER_PATCHES_DEBUG'] && console.log(`[rebrowser-patches][frames._context] frameId = ${this._id}, world = ${world}, fixMode = ${fixMode}`);
671
- if (fixMode !== '0') {
672
- if (typeof this.__re__contexts === 'undefined') {
673
- this.__re__contexts = {};
674
- }
675
- const frameSession = this._page._delegate._sessions.get(this._id) || this._page._delegate._mainFrameSession;
676
- const client = frameSession._client;
677
- const utilityWorldName = process.env['REBROWSER_PATCHES_UTILITY_WORLD_NAME'] !== '0' ? process.env['REBROWSER_PATCHES_UTILITY_WORLD_NAME'] || 'util' : '__playwright_utility_world__';
678
- let getWorldPromise;
679
- if (fixMode === 'addBinding') {
680
- if (this.__re__contexts[world] !== undefined) {
681
- return Promise.resolve(this.__re__contexts[world]);
682
- }
683
- if (world === 'utility') {
684
- getWorldPromise = this.__re__getIsolatedWorld({
685
- client,
686
- frameId: this._id,
687
- worldName: utilityWorldName
688
- }).then(contextId => {
689
- return {
690
- id: contextId,
691
- name: utilityWorldName,
692
- auxData: {
693
- frameId: this._id,
694
- isDefault: false
695
- }
696
- };
697
- });
698
- } else if (world === 'main') {
699
- getWorldPromise = this.__re__getMainWorld({
700
- client,
701
- frameId: this._id
702
- }).then(contextId => {
703
- return {
704
- id: contextId,
705
- name: '',
706
- auxData: {
707
- frameId: this._id,
708
- isDefault: true
709
- }
710
- };
711
- });
712
- }
713
- getWorldPromise = getWorldPromise.then(contextPayload => {
714
- const delegate = new _crExecutionContext.CRExecutionContext(client, contextPayload);
715
- this.__re__contexts[world] = new dom.FrameExecutionContext(delegate, this, world);
716
- return this.__re__contexts[world];
717
- });
718
- } else if (fixMode === 'alwaysIsolated') {
719
- // use only utility context
720
- if (this.__re__contexts.utility !== undefined) {
721
- return Promise.resolve(this.__re__contexts.utility);
722
- }
723
- getWorldPromise = this.__re__getIsolatedWorld({
724
- client,
725
- frameId: this._id,
726
- worldName: utilityWorldName
727
- }).then(contextId => {
728
- const contextPayload = {
729
- id: contextId,
730
- name: utilityWorldName,
731
- auxData: {
732
- frameId: this._id,
733
- isDefault: false
734
- }
735
- };
736
- const delegate = new _crExecutionContext.CRExecutionContext(client, contextPayload);
737
- this.__re__contexts.utility = new dom.FrameExecutionContext(delegate, this, 'utility');
738
- return this.__re__contexts.utility;
739
- });
740
- }
741
- return getWorldPromise.catch(error => {
742
- if (error.message.includes('No frame for given id found')) {
743
- // ignore, frame is already gone
744
- return {
745
- destroyedReason: 'Frame was detached'
746
- };
747
- }
748
- _debugLogger.debugLogger.log('error', error);
749
- console.error('[rebrowser-patches][frames._context] cannot get world, error:', error);
591
+ _context(world, useContextPromise = false) {
592
+ if (process.env['REBROWSER_PATCHES_RUNTIME_FIX_MODE'] === '0' || this._contextData.get(world).context || useContextPromise) {
593
+ return this._contextData.get(world).contextPromise.then(contextOrDestroyedReason => {
594
+ if (contextOrDestroyedReason instanceof js.ExecutionContext) return contextOrDestroyedReason;
595
+ throw new Error(contextOrDestroyedReason.destroyedReason);
750
596
  });
751
597
  }
752
- return this._contextData.get(world).contextPromise.then(contextOrDestroyedReason => {
753
- if (contextOrDestroyedReason instanceof js.ExecutionContext) return contextOrDestroyedReason;
754
- throw new Error(contextOrDestroyedReason.destroyedReason);
598
+ const crSession = (this._page._delegate._sessions.get(this._id) || this._page._delegate._mainFrameSession)._client;
599
+ return crSession.__re__emitExecutionContext({
600
+ world,
601
+ targetId: this._id,
602
+ frame: this
603
+ }).then(() => {
604
+ return this._context(world, true);
605
+ }).catch(error => {
606
+ if (error.message.includes('No frame for given id found')) {
607
+ // ignore, frame is already gone
608
+ return {
609
+ destroyedReason: 'Frame was detached'
610
+ };
611
+ }
612
+ _debugLogger.debugLogger.log('error', error);
613
+ console.error('[rebrowser-patches][frames._context] cannot get world, error:', error);
755
614
  });
756
615
  }
757
616
  _mainContext() {
@@ -793,12 +652,12 @@ class Frame extends _instrumentation.SdkObject {
793
652
  return await this.waitForSelectorInternal(progress, selector, true, options, scope);
794
653
  }, this._page._timeoutSettings.timeout(options));
795
654
  }
796
- async waitForSelectorInternal(progress, selector, performLocatorHandlersCheckpoint, options, scope) {
655
+ async waitForSelectorInternal(progress, selector, performActionPreChecks, options, scope) {
797
656
  const {
798
657
  state = 'visible'
799
658
  } = options;
800
659
  const promise = this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async continuePolling => {
801
- if (performLocatorHandlersCheckpoint) await this._page.performLocatorHandlersCheckpoint(progress);
660
+ if (performActionPreChecks) await this._page.performActionPreChecks(progress);
802
661
  const resolved = await this.selectors.resolveInjectedForSelector(selector, options, scope);
803
662
  progress.throwIfAborted();
804
663
  if (!resolved) {
@@ -809,6 +668,7 @@ class Frame extends _instrumentation.SdkObject {
809
668
  info,
810
669
  root
811
670
  }) => {
671
+ if (root && !root.isConnected) throw injected.createStacklessError('Element is not attached to the DOM');
812
672
  const elements = injected.querySelectorAll(info.parsed, root || document);
813
673
  const element = elements[0];
814
674
  const visible = element ? injected.utils.isElementVisible(element) : false;
@@ -1114,19 +974,21 @@ class Frame extends _instrumentation.SdkObject {
1114
974
  // Retry upon all other errors.
1115
975
  return false;
1116
976
  }
1117
- async _retryWithProgressIfNotConnected(progress, selector, strict, performLocatorHandlersCheckpoint, action) {
977
+ async _retryWithProgressIfNotConnected(progress, selector, strict, performActionPreChecks, action) {
1118
978
  progress.log(`waiting for ${this._asLocator(selector)}`);
1119
979
  return this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async continuePolling => {
1120
- if (performLocatorHandlersCheckpoint) await this._page.performLocatorHandlersCheckpoint(progress);
980
+ if (performActionPreChecks) await this._page.performActionPreChecks(progress);
1121
981
  const resolved = await this.selectors.resolveInjectedForSelector(selector, {
1122
982
  strict
1123
983
  });
1124
984
  progress.throwIfAborted();
1125
985
  if (!resolved) return continuePolling;
1126
986
  const result = await resolved.injected.evaluateHandle((injected, {
1127
- info
987
+ info,
988
+ callId
1128
989
  }) => {
1129
990
  const elements = injected.querySelectorAll(info.parsed, document);
991
+ if (callId) injected.markTargetElements(new Set(elements), callId);
1130
992
  const element = elements[0];
1131
993
  let log = '';
1132
994
  if (elements.length > 1) {
@@ -1141,7 +1003,8 @@ class Frame extends _instrumentation.SdkObject {
1141
1003
  element
1142
1004
  };
1143
1005
  }, {
1144
- info: resolved.info
1006
+ info: resolved.info,
1007
+ callId: progress.metadata.id
1145
1008
  });
1146
1009
  const {
1147
1010
  log,
@@ -1170,7 +1033,7 @@ class Frame extends _instrumentation.SdkObject {
1170
1033
  });
1171
1034
  }
1172
1035
  async rafrafTimeoutScreenshotElementWithProgress(progress, selector, timeout, options) {
1173
- return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */, true /* performLocatorHandlersCheckpoint */, async handle => {
1036
+ return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */, true /* performActionPreChecks */, async handle => {
1174
1037
  await handle._frame.rafrafTimeout(timeout);
1175
1038
  return await this._page._screenshotter.screenshotElement(progress, handle, options);
1176
1039
  });
@@ -1178,7 +1041,7 @@ class Frame extends _instrumentation.SdkObject {
1178
1041
  async click(metadata, selector, options) {
1179
1042
  const controller = new _progress.ProgressController(metadata, this);
1180
1043
  return controller.run(async progress => {
1181
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._click(progress, {
1044
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._click(progress, {
1182
1045
  ...options,
1183
1046
  waitAfter: !options.noWaitAfter
1184
1047
  })));
@@ -1187,13 +1050,13 @@ class Frame extends _instrumentation.SdkObject {
1187
1050
  async dblclick(metadata, selector, options = {}) {
1188
1051
  const controller = new _progress.ProgressController(metadata, this);
1189
1052
  return controller.run(async progress => {
1190
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._dblclick(progress, options)));
1053
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._dblclick(progress, options)));
1191
1054
  }, this._page._timeoutSettings.timeout(options));
1192
1055
  }
1193
1056
  async dragAndDrop(metadata, source, target, options = {}) {
1194
1057
  const controller = new _progress.ProgressController(metadata, this);
1195
1058
  await controller.run(async progress => {
1196
- dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict, !options.force /* performLocatorHandlersCheckpoint */, async handle => {
1059
+ dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict, !options.force /* performActionPreChecks */, async handle => {
1197
1060
  return handle._retryPointerAction(progress, 'move and down', false, async point => {
1198
1061
  await this._page.mouse.move(point.x, point.y);
1199
1062
  await this._page.mouse.down();
@@ -1205,7 +1068,7 @@ class Frame extends _instrumentation.SdkObject {
1205
1068
  });
1206
1069
  }));
1207
1070
  // Note: do not perform locator handlers checkpoint to avoid moving the mouse in the middle of a drag operation.
1208
- dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, false /* performLocatorHandlersCheckpoint */, async handle => {
1071
+ dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, false /* performActionPreChecks */, async handle => {
1209
1072
  return handle._retryPointerAction(progress, 'move and up', false, async point => {
1210
1073
  await this._page.mouse.move(point.x, point.y);
1211
1074
  await this._page.mouse.up();
@@ -1222,25 +1085,25 @@ class Frame extends _instrumentation.SdkObject {
1222
1085
  if (!this._page._browserContext._options.hasTouch) throw new Error('The page does not support tap. Use hasTouch context option to enable touch support.');
1223
1086
  const controller = new _progress.ProgressController(metadata, this);
1224
1087
  return controller.run(async progress => {
1225
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._tap(progress, options)));
1088
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._tap(progress, options)));
1226
1089
  }, this._page._timeoutSettings.timeout(options));
1227
1090
  }
1228
1091
  async fill(metadata, selector, value, options) {
1229
1092
  const controller = new _progress.ProgressController(metadata, this);
1230
1093
  return controller.run(async progress => {
1231
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._fill(progress, value, options)));
1094
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._fill(progress, value, options)));
1232
1095
  }, this._page._timeoutSettings.timeout(options));
1233
1096
  }
1234
1097
  async focus(metadata, selector, options = {}) {
1235
1098
  const controller = new _progress.ProgressController(metadata, this);
1236
1099
  await controller.run(async progress => {
1237
- dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._focus(progress)));
1100
+ dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._focus(progress)));
1238
1101
  }, this._page._timeoutSettings.timeout(options));
1239
1102
  }
1240
1103
  async blur(metadata, selector, options = {}) {
1241
1104
  const controller = new _progress.ProgressController(metadata, this);
1242
1105
  await controller.run(async progress => {
1243
- dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._blur(progress)));
1106
+ dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._blur(progress)));
1244
1107
  }, this._page._timeoutSettings.timeout(options));
1245
1108
  }
1246
1109
  async textContent(metadata, selector, options = {}, scope) {
@@ -1340,44 +1203,44 @@ class Frame extends _instrumentation.SdkObject {
1340
1203
  async hover(metadata, selector, options = {}) {
1341
1204
  const controller = new _progress.ProgressController(metadata, this);
1342
1205
  return controller.run(async progress => {
1343
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._hover(progress, options)));
1206
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._hover(progress, options)));
1344
1207
  }, this._page._timeoutSettings.timeout(options));
1345
1208
  }
1346
1209
  async selectOption(metadata, selector, elements, values, options = {}) {
1347
1210
  const controller = new _progress.ProgressController(metadata, this);
1348
1211
  return controller.run(async progress => {
1349
- return await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._selectOption(progress, elements, values, options));
1212
+ return await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._selectOption(progress, elements, values, options));
1350
1213
  }, this._page._timeoutSettings.timeout(options));
1351
1214
  }
1352
1215
  async setInputFiles(metadata, selector, params) {
1353
1216
  const inputFileItems = await (0, _fileUploadUtils.prepareFilesForUpload)(this, params);
1354
1217
  const controller = new _progress.ProgressController(metadata, this);
1355
1218
  return controller.run(async progress => {
1356
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, params.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._setInputFiles(progress, inputFileItems)));
1219
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, params.strict, true /* performActionPreChecks */, handle => handle._setInputFiles(progress, inputFileItems)));
1357
1220
  }, this._page._timeoutSettings.timeout(params));
1358
1221
  }
1359
1222
  async type(metadata, selector, text, options = {}) {
1360
1223
  const controller = new _progress.ProgressController(metadata, this);
1361
1224
  return controller.run(async progress => {
1362
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._type(progress, text, options)));
1225
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._type(progress, text, options)));
1363
1226
  }, this._page._timeoutSettings.timeout(options));
1364
1227
  }
1365
1228
  async press(metadata, selector, key, options = {}) {
1366
1229
  const controller = new _progress.ProgressController(metadata, this);
1367
1230
  return controller.run(async progress => {
1368
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._press(progress, key, options)));
1231
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._press(progress, key, options)));
1369
1232
  }, this._page._timeoutSettings.timeout(options));
1370
1233
  }
1371
1234
  async check(metadata, selector, options = {}) {
1372
1235
  const controller = new _progress.ProgressController(metadata, this);
1373
1236
  return controller.run(async progress => {
1374
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._setChecked(progress, true, options)));
1237
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._setChecked(progress, true, options)));
1375
1238
  }, this._page._timeoutSettings.timeout(options));
1376
1239
  }
1377
1240
  async uncheck(metadata, selector, options = {}) {
1378
1241
  const controller = new _progress.ProgressController(metadata, this);
1379
1242
  return controller.run(async progress => {
1380
- return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._setChecked(progress, false, options)));
1243
+ return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._setChecked(progress, false, options)));
1381
1244
  }, this._page._timeoutSettings.timeout(options));
1382
1245
  }
1383
1246
  async waitForTimeout(metadata, timeout) {
@@ -1386,6 +1249,12 @@ class Frame extends _instrumentation.SdkObject {
1386
1249
  await new Promise(resolve => setTimeout(resolve, timeout));
1387
1250
  });
1388
1251
  }
1252
+ async ariaSnapshot(metadata, selector, options = {}) {
1253
+ const controller = new _progress.ProgressController(metadata, this);
1254
+ return controller.run(async progress => {
1255
+ return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */, true /* performActionPreChecks */, handle => handle.ariaSnapshot());
1256
+ }, this._page._timeoutSettings.timeout(options));
1257
+ }
1389
1258
  async expect(metadata, selector, options) {
1390
1259
  const result = await this._expectImpl(metadata, selector, options);
1391
1260
  // Library mode special case for the expect errors which are return values, not exceptions.
@@ -1409,7 +1278,7 @@ class Frame extends _instrumentation.SdkObject {
1409
1278
  await new _progress.ProgressController(metadata, this).run(async progress => {
1410
1279
  progress.log(`${metadata.apiName}${timeout ? ` with timeout ${timeout}ms` : ''}`);
1411
1280
  progress.log(`waiting for ${this._asLocator(selector)}`);
1412
- await this._page.performLocatorHandlersCheckpoint(progress);
1281
+ await this._page.performActionPreChecks(progress);
1413
1282
  }, timeout);
1414
1283
 
1415
1284
  // Step 2: perform one-shot expect check without a timeout.
@@ -1430,7 +1299,7 @@ class Frame extends _instrumentation.SdkObject {
1430
1299
  }
1431
1300
  if (timeout < 0) return {
1432
1301
  matches: options.isNot,
1433
- log: metadata.log,
1302
+ log: (0, _utils.compressCallLog)(metadata.log),
1434
1303
  timedOut: true,
1435
1304
  received: lastIntermediateResult.received
1436
1305
  };
@@ -1438,7 +1307,7 @@ class Frame extends _instrumentation.SdkObject {
1438
1307
  // Step 3: auto-retry expect with increasing timeouts. Bounded by the total remaining time.
1439
1308
  return await new _progress.ProgressController(metadata, this).run(async progress => {
1440
1309
  return await this.retryWithProgressAndTimeouts(progress, [100, 250, 500, 1000], async continuePolling => {
1441
- await this._page.performLocatorHandlersCheckpoint(progress);
1310
+ await this._page.performActionPreChecks(progress);
1442
1311
  const {
1443
1312
  matches,
1444
1313
  received
@@ -1461,7 +1330,7 @@ class Frame extends _instrumentation.SdkObject {
1461
1330
  if (js.isJavaScriptErrorInEvaluate(e) || (0, _selectorParser.isInvalidSelectorError)(e)) throw e;
1462
1331
  const result = {
1463
1332
  matches: options.isNot,
1464
- log: metadata.log
1333
+ log: (0, _utils.compressCallLog)(metadata.log)
1465
1334
  };
1466
1335
  if (lastIntermediateResult.isSet) result.received = lastIntermediateResult.received;
1467
1336
  if (e instanceof _errors.TimeoutError) result.timedOut = true;
@@ -1496,10 +1365,10 @@ class Frame extends _instrumentation.SdkObject {
1496
1365
  callId
1497
1366
  }) => {
1498
1367
  const elements = info ? injected.querySelectorAll(info.parsed, document) : [];
1368
+ if (callId) injected.markTargetElements(new Set(elements), callId);
1499
1369
  const isArray = options.expression === 'to.have.count' || options.expression.endsWith('.array');
1500
1370
  let log = '';
1501
1371
  if (isArray) log = ` locator resolved to ${elements.length} element${elements.length === 1 ? '' : 's'}`;else if (elements.length > 1) throw injected.strictModeViolationError(info.parsed, elements);else if (elements.length) log = ` locator resolved to ${injected.previewNode(elements[0])}`;
1502
- if (callId) injected.markTargetElements(new Set(elements), callId);
1503
1372
  return {
1504
1373
  log,
1505
1374
  ...(await injected.expect(elements[0], options, elements))
@@ -1817,5 +1686,6 @@ function renderUnexpectedValue(expression, received) {
1817
1686
  if (expression === 'to.be.readonly') return received ? 'readonly' : 'editable';
1818
1687
  if (expression === 'to.be.empty') return received ? 'empty' : 'not empty';
1819
1688
  if (expression === 'to.be.focused') return received ? 'focused' : 'not focused';
1689
+ if (expression === 'to.match.aria') return received ? received.raw : received;
1820
1690
  return received;
1821
1691
  }
@@ -45,12 +45,6 @@ Object.defineProperty(exports, "installBrowsersForNpmInstall", {
45
45
  return _registry.installBrowsersForNpmInstall;
46
46
  }
47
47
  });
48
- Object.defineProperty(exports, "installDefaultBrowsersForNpmInstall", {
49
- enumerable: true,
50
- get: function () {
51
- return _registry.installDefaultBrowsersForNpmInstall;
52
- }
53
- });
54
48
  Object.defineProperty(exports, "installRootRedirect", {
55
49
  enumerable: true,
56
50
  get: function () {
@@ -55,9 +55,6 @@ class ExecutionContext extends _instrumentation.SdkObject {
55
55
  rawEvaluateHandle(expression) {
56
56
  return this._raceAgainstContextDestroyed(this._delegate.rawEvaluateHandle(expression));
57
57
  }
58
- rawCallFunctionNoReply(func, ...args) {
59
- this._delegate.rawCallFunctionNoReply(func, ...args);
60
- }
61
58
  evaluateWithArguments(expression, returnByValue, utilityScript, values, objectIds) {
62
59
  return this._raceAgainstContextDestroyed(this._delegate.evaluateWithArguments(expression, returnByValue, utilityScript, values, objectIds));
63
60
  }
@@ -108,9 +105,6 @@ class JSHandle extends _instrumentation.SdkObject {
108
105
  this._preview = this._objectId ? preview || `JSHandle@${this._objectType}` : String(value);
109
106
  if (this._objectId && globalThis.leakedJSHandles) globalThis.leakedJSHandles.set(this, new Error('Leaked JSHandle'));
110
107
  }
111
- callFunctionNoReply(func, arg) {
112
- this._context.rawCallFunctionNoReply(func, this, arg);
113
- }
114
108
  async evaluate(pageFunction, arg) {
115
109
  return evaluate(this._context, true /* returnByValue */, pageFunction, this, arg);
116
110
  }
@@ -28,18 +28,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
28
28
  */
29
29
 
30
30
  async function launchApp(browserType, options) {
31
- var _options$persistentCo, _options$persistentCo2, _options$persistentCo3;
31
+ var _options$persistentCo, _options$persistentCo2, _options$persistentCo3, _options$persistentCo4, _options$persistentCo5, _options$persistentCo6, _options$persistentCo7, _options$persistentCo8, _options$persistentCo9, _options$persistentCo10, _options$persistentCo11;
32
32
  const args = [...((_options$persistentCo = (_options$persistentCo2 = options.persistentContextOptions) === null || _options$persistentCo2 === void 0 ? void 0 : _options$persistentCo2.args) !== null && _options$persistentCo !== void 0 ? _options$persistentCo : [])];
33
33
  if (browserType.name() === 'chromium') {
34
34
  args.push('--app=data:text/html,', `--window-size=${options.windowSize.width},${options.windowSize.height}`, ...(options.windowPosition ? [`--window-position=${options.windowPosition.x},${options.windowPosition.y}`] : []), '--test-type=');
35
35
  }
36
36
  const context = await browserType.launchPersistentContext((0, _instrumentation.serverSideCallMetadata)(), '', {
37
- channel: !((_options$persistentCo3 = options.persistentContextOptions) !== null && _options$persistentCo3 !== void 0 && _options$persistentCo3.executablePath) ? (0, _registry.findChromiumChannel)(options.sdkLanguage) : undefined,
38
- noDefaultViewport: true,
39
37
  ignoreDefaultArgs: ['--enable-automation'],
40
- colorScheme: 'no-override',
41
- acceptDownloads: (0, _utils.isUnderTest)() ? 'accept' : 'internal-browser-default',
42
38
  ...(options === null || options === void 0 ? void 0 : options.persistentContextOptions),
39
+ channel: (_options$persistentCo3 = (_options$persistentCo4 = options.persistentContextOptions) === null || _options$persistentCo4 === void 0 ? void 0 : _options$persistentCo4.channel) !== null && _options$persistentCo3 !== void 0 ? _options$persistentCo3 : !((_options$persistentCo5 = options.persistentContextOptions) !== null && _options$persistentCo5 !== void 0 && _options$persistentCo5.executablePath) ? (0, _registry.findChromiumChannel)(options.sdkLanguage) : undefined,
40
+ noDefaultViewport: (_options$persistentCo6 = (_options$persistentCo7 = options.persistentContextOptions) === null || _options$persistentCo7 === void 0 ? void 0 : _options$persistentCo7.noDefaultViewport) !== null && _options$persistentCo6 !== void 0 ? _options$persistentCo6 : true,
41
+ acceptDownloads: (_options$persistentCo8 = options === null || options === void 0 || (_options$persistentCo9 = options.persistentContextOptions) === null || _options$persistentCo9 === void 0 ? void 0 : _options$persistentCo9.acceptDownloads) !== null && _options$persistentCo8 !== void 0 ? _options$persistentCo8 : (0, _utils.isUnderTest)() ? 'accept' : 'internal-browser-default',
42
+ colorScheme: (_options$persistentCo10 = options === null || options === void 0 || (_options$persistentCo11 = options.persistentContextOptions) === null || _options$persistentCo11 === void 0 ? void 0 : _options$persistentCo11.colorScheme) !== null && _options$persistentCo10 !== void 0 ? _options$persistentCo10 : 'no-override',
43
43
  args
44
44
  });
45
45
  const [page] = context.pages();