rebrowser-playwright-core 1.47.100 → 1.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/ThirdPartyNotices.txt +70 -384
- package/bin/reinstall_chrome_beta_linux.sh +10 -8
- package/bin/reinstall_chrome_stable_linux.sh +10 -8
- package/bin/reinstall_msedge_beta_linux.sh +11 -9
- package/bin/reinstall_msedge_dev_linux.sh +11 -9
- package/bin/reinstall_msedge_stable_linux.sh +11 -9
- package/browsers.json +24 -12
- package/lib/cli/program.js +49 -19
- package/lib/client/api.js +6 -0
- package/lib/client/browserContext.js +20 -2
- package/lib/client/channelOwner.js +6 -2
- package/lib/client/connection.js +3 -0
- package/lib/client/fetch.js +16 -21
- package/lib/client/jsHandle.js +0 -8
- package/lib/client/localUtils.js +1 -0
- package/lib/client/locator.js +7 -0
- package/lib/client/network.js +180 -17
- package/lib/client/page.js +25 -2
- package/lib/client/playwright.js +6 -3
- package/lib/client/tracing.js +29 -20
- package/lib/client/waiter.js +15 -11
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +7 -0
- package/lib/generated/webSocketMockSource.js +7 -0
- package/lib/protocol/validator.js +103 -17
- package/lib/server/ariaSnapshot.js +33 -0
- package/lib/server/bidi/bidiBrowser.js +23 -8
- package/lib/server/bidi/bidiChromium.js +124 -0
- package/lib/server/bidi/bidiConnection.js +1 -3
- package/lib/server/bidi/bidiExecutionContext.js +0 -6
- package/lib/server/bidi/bidiFirefox.js +15 -21
- package/lib/server/bidi/bidiInput.js +16 -32
- package/lib/server/bidi/bidiNetworkManager.js +39 -5
- package/lib/server/bidi/bidiOverCdp.js +103 -0
- package/lib/server/bidi/bidiPage.js +98 -25
- package/lib/server/bidi/bidiPdf.js +140 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
- package/lib/server/browser.js +13 -2
- package/lib/server/browserContext.js +6 -23
- package/lib/server/browserType.js +43 -12
- package/lib/server/chromium/chromium.js +9 -17
- package/lib/server/chromium/chromiumSwitches.js +3 -1
- package/lib/server/chromium/crBrowser.js +4 -3
- package/lib/server/chromium/crConnection.js +153 -0
- package/lib/server/chromium/crExecutionContext.js +0 -20
- package/lib/server/chromium/crPage.js +13 -7
- package/lib/server/chromium/videoRecorder.js +1 -1
- package/lib/server/codegen/csharp.js +12 -17
- package/lib/server/codegen/java.js +5 -8
- package/lib/server/codegen/javascript.js +29 -7
- package/lib/server/codegen/language.js +14 -2
- package/lib/server/codegen/python.js +13 -17
- package/lib/server/cookieStore.js +73 -0
- package/lib/server/debugController.js +10 -7
- package/lib/server/deviceDescriptorsSource.json +127 -127
- package/lib/server/dialog.js +1 -0
- package/lib/server/dispatchers/androidDispatcher.js +13 -2
- package/lib/server/dispatchers/browserContextDispatcher.js +19 -2
- package/lib/server/dispatchers/debugControllerDispatcher.js +1 -1
- package/lib/server/dispatchers/dispatcher.js +1 -1
- package/lib/server/dispatchers/frameDispatcher.js +8 -1
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -5
- package/lib/server/dispatchers/pageDispatcher.js +9 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +2 -1
- package/lib/server/dispatchers/tracingDispatcher.js +10 -0
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +189 -0
- package/lib/server/dom.js +79 -36
- package/lib/server/download.js +9 -2
- package/lib/server/fetch.js +105 -96
- package/lib/server/firefox/ffBrowser.js +6 -4
- package/lib/server/firefox/ffExecutionContext.js +0 -15
- package/lib/server/firefox/ffNetworkManager.js +1 -1
- package/lib/server/firefox/ffPage.js +6 -3
- package/lib/server/firefox/firefox.js +2 -13
- package/lib/server/frameSelectors.js +1 -1
- package/lib/server/frames.js +68 -67
- package/lib/server/har/harTracer.js +11 -0
- package/lib/server/index.js +0 -6
- package/lib/server/input.js +0 -1
- package/lib/server/javascript.js +0 -13
- package/lib/server/page.js +53 -9
- package/lib/server/playwright.js +5 -2
- package/lib/server/progress.js +0 -3
- package/lib/server/recorder/contextRecorder.js +33 -50
- package/lib/server/recorder/recorderApp.js +22 -25
- package/lib/server/recorder/recorderCollection.js +68 -79
- package/lib/server/recorder/recorderInTraceViewer.js +144 -0
- package/lib/server/recorder/recorderRunner.js +75 -97
- package/lib/server/recorder/recorderUtils.js +48 -6
- package/lib/server/recorder.js +87 -47
- package/lib/server/registry/index.js +154 -26
- package/lib/server/registry/nativeDeps.js +6 -3
- package/lib/server/socksClientCertificatesInterceptor.js +15 -3
- package/lib/server/trace/recorder/snapshotter.js +2 -12
- package/lib/server/trace/recorder/snapshotterInjected.js +21 -3
- package/lib/server/trace/recorder/tracing.js +127 -17
- package/lib/server/trace/test/inMemorySnapshotter.js +4 -4
- package/lib/server/trace/viewer/traceViewer.js +4 -6
- package/lib/server/webkit/webkit.js +1 -1
- package/lib/server/webkit/wkBrowser.js +8 -7
- package/lib/server/webkit/wkExecutionContext.js +0 -16
- package/lib/server/webkit/wkPage.js +11 -4
- package/lib/utils/comparators.js +12 -30
- package/lib/utils/crypto.js +1 -4
- package/lib/utils/happy-eyeballs.js +13 -0
- package/lib/utils/hostPlatform.js +8 -2
- package/lib/utils/httpServer.js +1 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +267 -0
- package/lib/utils/isomorphic/locatorGenerators.js +30 -21
- package/lib/utils/isomorphic/locatorParser.js +2 -2
- package/lib/utils/isomorphic/recorderUtils.js +227 -0
- package/lib/utils/isomorphic/stringUtils.js +30 -0
- package/lib/utils/isomorphic/urlMatch.js +5 -1
- package/lib/utils/network.js +1 -1
- package/lib/utils/sequence.js +64 -0
- package/lib/utils/stackTrace.js +16 -3
- package/lib/utils/zones.js +32 -23
- package/lib/utilsBundle.js +4 -5
- package/lib/utilsBundleImpl/index.js +190 -33
- package/lib/vite/htmlReport/index.html +19 -16
- package/lib/vite/recorder/assets/codeMirrorModule-AFvV6hAs.js +24 -0
- package/lib/vite/recorder/assets/index-_cTWgVuJ.js +184 -0
- package/lib/vite/recorder/assets/{index-B-MT5gKo.css → index-iA1aAGZg.css} +1 -1
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-KatbITLF.js +24 -0
- package/lib/vite/traceViewer/assets/inspectorTab-DdpLd2bb.js +68 -0
- package/lib/vite/traceViewer/assets/workbench-CdYbzWFD.js +9 -0
- package/lib/vite/traceViewer/embedded.6m3UZh7r.js +2 -0
- package/lib/vite/traceViewer/embedded.html +5 -3
- package/lib/vite/traceViewer/index.WUV-8boJ.js +2 -0
- package/lib/vite/traceViewer/index.html +24 -5
- package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +1 -0
- package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- package/lib/vite/traceViewer/recorder.OT2tVHgn.js +2 -0
- package/lib/vite/traceViewer/recorder.html +17 -0
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.BZBTyvGn.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +6 -4
- package/lib/vite/traceViewer/{uiMode.D3cNFP6u.css → uiMode.voC1ZiOQ.css} +1 -1
- package/lib/vite/traceViewer/workbench.C-zR9ysA.css +1 -0
- package/package.json +1 -1
- package/types/protocol.d.ts +135 -16
- package/types/types.d.ts +2149 -965
- package/lib/generated/recorderSource.js +0 -7
- package/lib/third_party/diff_match_patch.js +0 -2222
- package/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +0 -24
- package/lib/vite/recorder/assets/index-DCpXOVIh.js +0 -47
- package/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +0 -24
- package/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +0 -72
- package/lib/vite/traceViewer/embedded.BkuvsLJp.js +0 -2
- package/lib/vite/traceViewer/index.C968kAiC.js +0 -2
- package/lib/vite/traceViewer/uiMode.BkFnr4V0.js +0 -10
- package/lib/vite/traceViewer/workbench.DjbIuxix.css +0 -1
- /package/lib/server/recorder/{recorderActions.js → recorderFrontend.js} +0 -0
|
@@ -121,11 +121,11 @@ class FFPage {
|
|
|
121
121
|
const frame = this._page._frameManager.frame(auxData.frameId);
|
|
122
122
|
if (!frame) return;
|
|
123
123
|
const delegate = new _ffExecutionContext.FFExecutionContext(this._session, executionContextId);
|
|
124
|
-
let worldName;
|
|
125
|
-
if (auxData.name === UTILITY_WORLD_NAME) worldName = 'utility';else if (!auxData.name) worldName = 'main';
|
|
124
|
+
let worldName = null;
|
|
125
|
+
if (auxData.name === UTILITY_WORLD_NAME) worldName = 'utility';else if (!auxData.name) worldName = 'main';
|
|
126
126
|
const context = new dom.FrameExecutionContext(delegate, frame, worldName);
|
|
127
127
|
context[contextDelegateSymbol] = delegate;
|
|
128
|
-
frame._contextCreated(worldName, context);
|
|
128
|
+
if (worldName) frame._contextCreated(worldName, context);
|
|
129
129
|
this._contextIdToContext.set(executionContextId, context);
|
|
130
130
|
}
|
|
131
131
|
_onExecutionContextDestroyed(payload) {
|
|
@@ -360,6 +360,9 @@ class FFPage {
|
|
|
360
360
|
});
|
|
361
361
|
return success;
|
|
362
362
|
}
|
|
363
|
+
async requestGC() {
|
|
364
|
+
await this._session.send('Heap.collectGarbage');
|
|
365
|
+
}
|
|
363
366
|
async addInitScript(initScript, worldName) {
|
|
364
367
|
this._initScripts.push({
|
|
365
368
|
initScript,
|
|
@@ -92,19 +92,8 @@ class Firefox extends _browserType.BrowserType {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
exports.Firefox = Firefox;
|
|
95
|
-
class JugglerReadyState {
|
|
96
|
-
constructor() {
|
|
97
|
-
this._jugglerPromise = new _utils.ManualPromise();
|
|
98
|
-
}
|
|
95
|
+
class JugglerReadyState extends _browserType.BrowserReadyState {
|
|
99
96
|
onBrowserOutput(message) {
|
|
100
|
-
if (message.includes('Juggler listening to the pipe')) this.
|
|
101
|
-
}
|
|
102
|
-
onBrowserExit() {
|
|
103
|
-
// Unblock launch when browser prematurely exits.
|
|
104
|
-
this._jugglerPromise.resolve();
|
|
105
|
-
}
|
|
106
|
-
async waitUntilReady() {
|
|
107
|
-
await this._jugglerPromise;
|
|
108
|
-
return {};
|
|
97
|
+
if (message.includes('Juggler listening to the pipe')) this._wsEndpoint.resolve(undefined);
|
|
109
98
|
}
|
|
110
99
|
}
|
|
@@ -165,7 +165,7 @@ class FrameSelectors {
|
|
|
165
165
|
exports.FrameSelectors = FrameSelectors;
|
|
166
166
|
async function adoptIfNeeded(handle, context) {
|
|
167
167
|
if (handle._context === context) return handle;
|
|
168
|
-
const adopted = handle._page._delegate.adoptElementHandle(handle, context);
|
|
168
|
+
const adopted = await handle._page._delegate.adoptElementHandle(handle, context);
|
|
169
169
|
handle.dispose();
|
|
170
170
|
return adopted;
|
|
171
171
|
}
|
package/lib/server/frames.js
CHANGED
|
@@ -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._isolatedContext = 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.
|
|
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,43 +588,29 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
584
588
|
async frameElement() {
|
|
585
589
|
return this._page._delegate.getFrameElement(this);
|
|
586
590
|
}
|
|
587
|
-
_context(world) {
|
|
588
|
-
if (process.env['REBROWSER_PATCHES_RUNTIME_FIX_MODE']
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
const utilityWorldName = process.env['REBROWSER_PATCHES_UTILITY_WORLD_NAME'] !== '0' ? process.env['REBROWSER_PATCHES_UTILITY_WORLD_NAME'] || 'util' : '__playwright_utility_world__';
|
|
594
|
-
return this._page._delegate._mainFrameSession._client.send('Page.createIsolatedWorld', {
|
|
595
|
-
frameId: this._id,
|
|
596
|
-
grantUniveralAccess: true,
|
|
597
|
-
worldName: utilityWorldName
|
|
598
|
-
}).then(createIsolatedWorldResult => {
|
|
599
|
-
const contextPayload = {
|
|
600
|
-
id: createIsolatedWorldResult.executionContextId,
|
|
601
|
-
name: utilityWorldName,
|
|
602
|
-
auxData: {
|
|
603
|
-
frameId: this._id,
|
|
604
|
-
isDefault: false
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
const delegate = new _crExecutionContext.CRExecutionContext(this._page._delegate._mainFrameSession._client, contextPayload);
|
|
608
|
-
this._isolatedContext = new dom.FrameExecutionContext(delegate, this, 'utility');
|
|
609
|
-
return this._isolatedContext;
|
|
610
|
-
}).catch(error => {
|
|
611
|
-
if (error.message.includes('No frame for given id found')) {
|
|
612
|
-
// ignore, frame is already gone
|
|
613
|
-
return {
|
|
614
|
-
destroyedReason: 'Frame was detached'
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
_debugLogger.debugLogger.log('error', error);
|
|
618
|
-
console.error('[rebrowser-patches][frames._context] cannot create utility 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);
|
|
619
596
|
});
|
|
620
597
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
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);
|
|
624
614
|
});
|
|
625
615
|
}
|
|
626
616
|
_mainContext() {
|
|
@@ -659,14 +649,15 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
659
649
|
if (!['attached', 'detached', 'visible', 'hidden'].includes(state)) throw new Error(`state: expected one of (attached|detached|visible|hidden)`);
|
|
660
650
|
return controller.run(async progress => {
|
|
661
651
|
progress.log(`waiting for ${this._asLocator(selector)}${state === 'attached' ? '' : ' to be ' + state}`);
|
|
662
|
-
return await this.waitForSelectorInternal(progress, selector, options, scope);
|
|
652
|
+
return await this.waitForSelectorInternal(progress, selector, true, options, scope);
|
|
663
653
|
}, this._page._timeoutSettings.timeout(options));
|
|
664
654
|
}
|
|
665
|
-
async waitForSelectorInternal(progress, selector, options, scope) {
|
|
655
|
+
async waitForSelectorInternal(progress, selector, performActionPreChecks, options, scope) {
|
|
666
656
|
const {
|
|
667
657
|
state = 'visible'
|
|
668
658
|
} = options;
|
|
669
659
|
const promise = this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async continuePolling => {
|
|
660
|
+
if (performActionPreChecks) await this._page.performActionPreChecks(progress);
|
|
670
661
|
const resolved = await this.selectors.resolveInjectedForSelector(selector, options, scope);
|
|
671
662
|
progress.throwIfAborted();
|
|
672
663
|
if (!resolved) {
|
|
@@ -677,6 +668,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
677
668
|
info,
|
|
678
669
|
root
|
|
679
670
|
}) => {
|
|
671
|
+
if (root && !root.isConnected) throw injected.createStacklessError('Element is not attached to the DOM');
|
|
680
672
|
const elements = injected.querySelectorAll(info.parsed, root || document);
|
|
681
673
|
const element = elements[0];
|
|
682
674
|
const visible = element ? injected.utils.isElementVisible(element) : false;
|
|
@@ -800,11 +792,10 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
800
792
|
const controller = new _progress.ProgressController(metadata, this);
|
|
801
793
|
return controller.run(async progress => {
|
|
802
794
|
await this.raceNavigationAction(progress, options, async () => {
|
|
803
|
-
var _this$_page$_delegate, _this$_page$_delegate2;
|
|
804
795
|
const waitUntil = options.waitUntil === undefined ? 'load' : options.waitUntil;
|
|
805
796
|
progress.log(`setting frame content, waiting until "${waitUntil}"`);
|
|
806
797
|
const tag = `--playwright--set--content--${this._id}--${++this._setContentCounter}--`;
|
|
807
|
-
const context =
|
|
798
|
+
const context = await this._utilityContext();
|
|
808
799
|
const lifecyclePromise = new Promise((resolve, reject) => {
|
|
809
800
|
this._page._frameManager._consoleMessageTags.set(tag, () => {
|
|
810
801
|
// Clear lifecycle right after document.open() - see 'tag' below.
|
|
@@ -983,19 +974,21 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
983
974
|
// Retry upon all other errors.
|
|
984
975
|
return false;
|
|
985
976
|
}
|
|
986
|
-
async _retryWithProgressIfNotConnected(progress, selector, strict,
|
|
977
|
+
async _retryWithProgressIfNotConnected(progress, selector, strict, performActionPreChecks, action) {
|
|
987
978
|
progress.log(`waiting for ${this._asLocator(selector)}`);
|
|
988
979
|
return this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async continuePolling => {
|
|
989
|
-
if (
|
|
980
|
+
if (performActionPreChecks) await this._page.performActionPreChecks(progress);
|
|
990
981
|
const resolved = await this.selectors.resolveInjectedForSelector(selector, {
|
|
991
982
|
strict
|
|
992
983
|
});
|
|
993
984
|
progress.throwIfAborted();
|
|
994
985
|
if (!resolved) return continuePolling;
|
|
995
986
|
const result = await resolved.injected.evaluateHandle((injected, {
|
|
996
|
-
info
|
|
987
|
+
info,
|
|
988
|
+
callId
|
|
997
989
|
}) => {
|
|
998
990
|
const elements = injected.querySelectorAll(info.parsed, document);
|
|
991
|
+
if (callId) injected.markTargetElements(new Set(elements), callId);
|
|
999
992
|
const element = elements[0];
|
|
1000
993
|
let log = '';
|
|
1001
994
|
if (elements.length > 1) {
|
|
@@ -1010,7 +1003,8 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1010
1003
|
element
|
|
1011
1004
|
};
|
|
1012
1005
|
}, {
|
|
1013
|
-
info: resolved.info
|
|
1006
|
+
info: resolved.info,
|
|
1007
|
+
callId: progress.metadata.id
|
|
1014
1008
|
});
|
|
1015
1009
|
const {
|
|
1016
1010
|
log,
|
|
@@ -1039,7 +1033,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1039
1033
|
});
|
|
1040
1034
|
}
|
|
1041
1035
|
async rafrafTimeoutScreenshotElementWithProgress(progress, selector, timeout, options) {
|
|
1042
|
-
return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */, true /*
|
|
1036
|
+
return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */, true /* performActionPreChecks */, async handle => {
|
|
1043
1037
|
await handle._frame.rafrafTimeout(timeout);
|
|
1044
1038
|
return await this._page._screenshotter.screenshotElement(progress, handle, options);
|
|
1045
1039
|
});
|
|
@@ -1047,7 +1041,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1047
1041
|
async click(metadata, selector, options) {
|
|
1048
1042
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1049
1043
|
return controller.run(async progress => {
|
|
1050
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1044
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._click(progress, {
|
|
1051
1045
|
...options,
|
|
1052
1046
|
waitAfter: !options.noWaitAfter
|
|
1053
1047
|
})));
|
|
@@ -1056,13 +1050,13 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1056
1050
|
async dblclick(metadata, selector, options = {}) {
|
|
1057
1051
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1058
1052
|
return controller.run(async progress => {
|
|
1059
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1053
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._dblclick(progress, options)));
|
|
1060
1054
|
}, this._page._timeoutSettings.timeout(options));
|
|
1061
1055
|
}
|
|
1062
1056
|
async dragAndDrop(metadata, source, target, options = {}) {
|
|
1063
1057
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1064
1058
|
await controller.run(async progress => {
|
|
1065
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict, !options.force /*
|
|
1059
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict, !options.force /* performActionPreChecks */, async handle => {
|
|
1066
1060
|
return handle._retryPointerAction(progress, 'move and down', false, async point => {
|
|
1067
1061
|
await this._page.mouse.move(point.x, point.y);
|
|
1068
1062
|
await this._page.mouse.down();
|
|
@@ -1074,7 +1068,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1074
1068
|
});
|
|
1075
1069
|
}));
|
|
1076
1070
|
// Note: do not perform locator handlers checkpoint to avoid moving the mouse in the middle of a drag operation.
|
|
1077
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, false /*
|
|
1071
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, false /* performActionPreChecks */, async handle => {
|
|
1078
1072
|
return handle._retryPointerAction(progress, 'move and up', false, async point => {
|
|
1079
1073
|
await this._page.mouse.move(point.x, point.y);
|
|
1080
1074
|
await this._page.mouse.up();
|
|
@@ -1091,25 +1085,25 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1091
1085
|
if (!this._page._browserContext._options.hasTouch) throw new Error('The page does not support tap. Use hasTouch context option to enable touch support.');
|
|
1092
1086
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1093
1087
|
return controller.run(async progress => {
|
|
1094
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1088
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._tap(progress, options)));
|
|
1095
1089
|
}, this._page._timeoutSettings.timeout(options));
|
|
1096
1090
|
}
|
|
1097
1091
|
async fill(metadata, selector, value, options) {
|
|
1098
1092
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1099
1093
|
return controller.run(async progress => {
|
|
1100
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1094
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._fill(progress, value, options)));
|
|
1101
1095
|
}, this._page._timeoutSettings.timeout(options));
|
|
1102
1096
|
}
|
|
1103
1097
|
async focus(metadata, selector, options = {}) {
|
|
1104
1098
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1105
1099
|
await controller.run(async progress => {
|
|
1106
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /*
|
|
1100
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._focus(progress)));
|
|
1107
1101
|
}, this._page._timeoutSettings.timeout(options));
|
|
1108
1102
|
}
|
|
1109
1103
|
async blur(metadata, selector, options = {}) {
|
|
1110
1104
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1111
1105
|
await controller.run(async progress => {
|
|
1112
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /*
|
|
1106
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._blur(progress)));
|
|
1113
1107
|
}, this._page._timeoutSettings.timeout(options));
|
|
1114
1108
|
}
|
|
1115
1109
|
async textContent(metadata, selector, options = {}, scope) {
|
|
@@ -1209,44 +1203,44 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1209
1203
|
async hover(metadata, selector, options = {}) {
|
|
1210
1204
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1211
1205
|
return controller.run(async progress => {
|
|
1212
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1206
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._hover(progress, options)));
|
|
1213
1207
|
}, this._page._timeoutSettings.timeout(options));
|
|
1214
1208
|
}
|
|
1215
1209
|
async selectOption(metadata, selector, elements, values, options = {}) {
|
|
1216
1210
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1217
1211
|
return controller.run(async progress => {
|
|
1218
|
-
return await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1212
|
+
return await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._selectOption(progress, elements, values, options));
|
|
1219
1213
|
}, this._page._timeoutSettings.timeout(options));
|
|
1220
1214
|
}
|
|
1221
1215
|
async setInputFiles(metadata, selector, params) {
|
|
1222
1216
|
const inputFileItems = await (0, _fileUploadUtils.prepareFilesForUpload)(this, params);
|
|
1223
1217
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1224
1218
|
return controller.run(async progress => {
|
|
1225
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, params.strict, true /*
|
|
1219
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, params.strict, true /* performActionPreChecks */, handle => handle._setInputFiles(progress, inputFileItems)));
|
|
1226
1220
|
}, this._page._timeoutSettings.timeout(params));
|
|
1227
1221
|
}
|
|
1228
1222
|
async type(metadata, selector, text, options = {}) {
|
|
1229
1223
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1230
1224
|
return controller.run(async progress => {
|
|
1231
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /*
|
|
1225
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._type(progress, text, options)));
|
|
1232
1226
|
}, this._page._timeoutSettings.timeout(options));
|
|
1233
1227
|
}
|
|
1234
1228
|
async press(metadata, selector, key, options = {}) {
|
|
1235
1229
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1236
1230
|
return controller.run(async progress => {
|
|
1237
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /*
|
|
1231
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performActionPreChecks */, handle => handle._press(progress, key, options)));
|
|
1238
1232
|
}, this._page._timeoutSettings.timeout(options));
|
|
1239
1233
|
}
|
|
1240
1234
|
async check(metadata, selector, options = {}) {
|
|
1241
1235
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1242
1236
|
return controller.run(async progress => {
|
|
1243
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1237
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._setChecked(progress, true, options)));
|
|
1244
1238
|
}, this._page._timeoutSettings.timeout(options));
|
|
1245
1239
|
}
|
|
1246
1240
|
async uncheck(metadata, selector, options = {}) {
|
|
1247
1241
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1248
1242
|
return controller.run(async progress => {
|
|
1249
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /*
|
|
1243
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performActionPreChecks */, handle => handle._setChecked(progress, false, options)));
|
|
1250
1244
|
}, this._page._timeoutSettings.timeout(options));
|
|
1251
1245
|
}
|
|
1252
1246
|
async waitForTimeout(metadata, timeout) {
|
|
@@ -1255,6 +1249,12 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1255
1249
|
await new Promise(resolve => setTimeout(resolve, timeout));
|
|
1256
1250
|
});
|
|
1257
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
|
+
}
|
|
1258
1258
|
async expect(metadata, selector, options) {
|
|
1259
1259
|
const result = await this._expectImpl(metadata, selector, options);
|
|
1260
1260
|
// Library mode special case for the expect errors which are return values, not exceptions.
|
|
@@ -1278,7 +1278,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1278
1278
|
await new _progress.ProgressController(metadata, this).run(async progress => {
|
|
1279
1279
|
progress.log(`${metadata.apiName}${timeout ? ` with timeout ${timeout}ms` : ''}`);
|
|
1280
1280
|
progress.log(`waiting for ${this._asLocator(selector)}`);
|
|
1281
|
-
await this._page.
|
|
1281
|
+
await this._page.performActionPreChecks(progress);
|
|
1282
1282
|
}, timeout);
|
|
1283
1283
|
|
|
1284
1284
|
// Step 2: perform one-shot expect check without a timeout.
|
|
@@ -1299,7 +1299,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
if (timeout < 0) return {
|
|
1301
1301
|
matches: options.isNot,
|
|
1302
|
-
log: metadata.log,
|
|
1302
|
+
log: (0, _utils.compressCallLog)(metadata.log),
|
|
1303
1303
|
timedOut: true,
|
|
1304
1304
|
received: lastIntermediateResult.received
|
|
1305
1305
|
};
|
|
@@ -1307,7 +1307,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1307
1307
|
// Step 3: auto-retry expect with increasing timeouts. Bounded by the total remaining time.
|
|
1308
1308
|
return await new _progress.ProgressController(metadata, this).run(async progress => {
|
|
1309
1309
|
return await this.retryWithProgressAndTimeouts(progress, [100, 250, 500, 1000], async continuePolling => {
|
|
1310
|
-
await this._page.
|
|
1310
|
+
await this._page.performActionPreChecks(progress);
|
|
1311
1311
|
const {
|
|
1312
1312
|
matches,
|
|
1313
1313
|
received
|
|
@@ -1330,7 +1330,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1330
1330
|
if (js.isJavaScriptErrorInEvaluate(e) || (0, _selectorParser.isInvalidSelectorError)(e)) throw e;
|
|
1331
1331
|
const result = {
|
|
1332
1332
|
matches: options.isNot,
|
|
1333
|
-
log: metadata.log
|
|
1333
|
+
log: (0, _utils.compressCallLog)(metadata.log)
|
|
1334
1334
|
};
|
|
1335
1335
|
if (lastIntermediateResult.isSet) result.received = lastIntermediateResult.received;
|
|
1336
1336
|
if (e instanceof _errors.TimeoutError) result.timedOut = true;
|
|
@@ -1365,10 +1365,10 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1365
1365
|
callId
|
|
1366
1366
|
}) => {
|
|
1367
1367
|
const elements = info ? injected.querySelectorAll(info.parsed, document) : [];
|
|
1368
|
+
if (callId) injected.markTargetElements(new Set(elements), callId);
|
|
1368
1369
|
const isArray = options.expression === 'to.have.count' || options.expression.endsWith('.array');
|
|
1369
1370
|
let log = '';
|
|
1370
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])}`;
|
|
1371
|
-
if (callId) injected.markTargetElements(new Set(elements), callId);
|
|
1372
1372
|
return {
|
|
1373
1373
|
log,
|
|
1374
1374
|
...(await injected.expect(elements[0], options, elements))
|
|
@@ -1686,5 +1686,6 @@ function renderUnexpectedValue(expression, received) {
|
|
|
1686
1686
|
if (expression === 'to.be.readonly') return received ? 'readonly' : 'editable';
|
|
1687
1687
|
if (expression === 'to.be.empty') return received ? 'empty' : 'not empty';
|
|
1688
1688
|
if (expression === 'to.be.focused') return received ? 'focused' : 'not focused';
|
|
1689
|
+
if (expression === 'to.match.aria') return received ? received.raw : received;
|
|
1689
1690
|
return received;
|
|
1690
1691
|
}
|
|
@@ -156,12 +156,22 @@ class HarTracer {
|
|
|
156
156
|
if (this._started) this._delegate.onEntryStarted(harEntry);
|
|
157
157
|
}
|
|
158
158
|
_onAPIRequestFinished(event) {
|
|
159
|
+
var _event$body$length, _event$body;
|
|
159
160
|
const harEntry = this._entryForRequest(event.requestEvent);
|
|
160
161
|
if (!harEntry) return;
|
|
161
162
|
harEntry.response.status = event.statusCode;
|
|
162
163
|
harEntry.response.statusText = event.statusMessage;
|
|
163
164
|
harEntry.response.httpVersion = event.httpVersion;
|
|
164
165
|
harEntry.response.redirectURL = event.headers.location || '';
|
|
166
|
+
if (!this._options.omitServerIP) {
|
|
167
|
+
harEntry.serverIPAddress = event.serverIPAddress;
|
|
168
|
+
harEntry._serverPort = event.serverPort;
|
|
169
|
+
}
|
|
170
|
+
if (!this._options.omitTiming) {
|
|
171
|
+
harEntry.timings = event.timings;
|
|
172
|
+
this._computeHarEntryTotalTime(harEntry);
|
|
173
|
+
}
|
|
174
|
+
if (!this._options.omitSecurityDetails) harEntry._securityDetails = event.securityDetails;
|
|
165
175
|
for (let i = 0; i < event.rawHeaders.length; i += 2) {
|
|
166
176
|
harEntry.response.headers.push({
|
|
167
177
|
name: event.rawHeaders[i],
|
|
@@ -178,6 +188,7 @@ class HarTracer {
|
|
|
178
188
|
const contentType = event.headers['content-type'];
|
|
179
189
|
if (contentType) content.mimeType = contentType;
|
|
180
190
|
this._storeResponseContent(event.body, content, 'other');
|
|
191
|
+
if (!this._options.omitSizes) harEntry.response.bodySize = (_event$body$length = (_event$body = event.body) === null || _event$body === void 0 ? void 0 : _event$body.length) !== null && _event$body$length !== void 0 ? _event$body$length : 0;
|
|
181
192
|
if (this._started) this._delegate.onEntryFinished(harEntry);
|
|
182
193
|
}
|
|
183
194
|
_onRequest(request) {
|
package/lib/server/index.js
CHANGED
|
@@ -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 () {
|
package/lib/server/input.js
CHANGED
package/lib/server/javascript.js
CHANGED
|
@@ -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
|
}
|
|
@@ -85,9 +82,6 @@ class ExecutionContext extends _instrumentation.SdkObject {
|
|
|
85
82
|
}
|
|
86
83
|
return this._utilityScriptPromise;
|
|
87
84
|
}
|
|
88
|
-
async objectCount(objectId) {
|
|
89
|
-
return this._delegate.objectCount(objectId);
|
|
90
|
-
}
|
|
91
85
|
async doSlowMo() {
|
|
92
86
|
// overridden in FrameExecutionContext
|
|
93
87
|
}
|
|
@@ -111,9 +105,6 @@ class JSHandle extends _instrumentation.SdkObject {
|
|
|
111
105
|
this._preview = this._objectId ? preview || `JSHandle@${this._objectType}` : String(value);
|
|
112
106
|
if (this._objectId && globalThis.leakedJSHandles) globalThis.leakedJSHandles.set(this, new Error('Leaked JSHandle'));
|
|
113
107
|
}
|
|
114
|
-
callFunctionNoReply(func, arg) {
|
|
115
|
-
this._context.rawCallFunctionNoReply(func, this, arg);
|
|
116
|
-
}
|
|
117
108
|
async evaluate(pageFunction, arg) {
|
|
118
109
|
return evaluate(this._context, true /* returnByValue */, pageFunction, this, arg);
|
|
119
110
|
}
|
|
@@ -189,10 +180,6 @@ class JSHandle extends _instrumentation.SdkObject {
|
|
|
189
180
|
this._preview = preview;
|
|
190
181
|
if (this._previewCallback) this._previewCallback(preview);
|
|
191
182
|
}
|
|
192
|
-
async objectCount() {
|
|
193
|
-
if (!this._objectId) throw new Error('Can only count objects for a handle that points to the constructor prototype');
|
|
194
|
-
return this._context.objectCount(this._objectId);
|
|
195
|
-
}
|
|
196
183
|
}
|
|
197
184
|
exports.JSHandle = JSHandle;
|
|
198
185
|
async function evaluate(context, returnByValue, pageFunction, ...args) {
|