playwright-core 1.54.0-alpha-2025-06-23 → 1.54.0-alpha-2025-06-25
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/ThirdPartyNotices.txt +3 -3
- package/browsers.json +4 -4
- package/lib/cli/programWithTestStub.js +1 -1
- package/lib/client/elementHandle.js +0 -4
- package/lib/client/locator.js +2 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/protocol/validator.js +6 -4
- package/lib/remote/playwrightServer.js +5 -9
- package/lib/server/android/android.js +2 -2
- package/lib/server/bidi/bidiPage.js +2 -2
- package/lib/server/browser.js +1 -1
- package/lib/server/browserContext.js +3 -3
- package/lib/server/browserType.js +3 -3
- package/lib/server/chromium/chromium.js +7 -9
- package/lib/server/chromium/crPage.js +2 -3
- package/lib/server/chromium/videoRecorder.js +1 -1
- package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -3
- package/lib/server/dispatchers/frameDispatcher.js +3 -0
- package/lib/server/dispatchers/localUtilsDispatcher.js +2 -3
- package/lib/server/dom.js +20 -50
- package/lib/server/electron/electron.js +1 -1
- package/lib/server/fetch.js +1 -1
- package/lib/server/firefox/ffPage.js +2 -2
- package/lib/server/frames.js +77 -58
- package/lib/server/input.js +11 -11
- package/lib/server/page.js +5 -8
- package/lib/server/progress.js +41 -21
- package/lib/server/recorder/recorderApp.js +1 -1
- package/lib/server/registry/index.js +1 -1
- package/lib/server/registry/oopDownloadBrowserMain.js +1 -1
- package/lib/server/screenshotter.js +1 -1
- package/lib/server/trace/viewer/traceViewer.js +1 -1
- package/lib/server/transport.js +0 -2
- package/lib/server/utils/network.js +13 -14
- package/lib/server/webkit/wkPage.js +1 -1
- package/lib/utils/isomorphic/protocolMetainfo.js +1 -1
- package/lib/utilsBundleImpl/index.js +160 -150
- package/lib/vite/traceViewer/assets/{codeMirrorModule--amfWN3K.js → codeMirrorModule-KhY1IY1h.js} +1 -1
- package/lib/vite/traceViewer/assets/{defaultSettingsView-BFAIqAv2.js → defaultSettingsView-h9mbAVJF.js} +45 -45
- package/lib/vite/traceViewer/{index.amRtOpxT.js → index.Ckw7w8kC.js} +1 -1
- package/lib/vite/traceViewer/index.html +2 -2
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/lib/vite/traceViewer/{uiMode.hufuL2u6.js → uiMode.wzqlDRzc.js} +1 -1
- package/package.json +1 -1
|
@@ -1657,6 +1657,12 @@ import_validatorPrimitives.scheme.FrameFrameElementParams = (0, import_validator
|
|
|
1657
1657
|
import_validatorPrimitives.scheme.FrameFrameElementResult = (0, import_validatorPrimitives.tObject)({
|
|
1658
1658
|
element: (0, import_validatorPrimitives.tChannel)(["ElementHandle"])
|
|
1659
1659
|
});
|
|
1660
|
+
import_validatorPrimitives.scheme.FrameGenerateLocatorStringParams = (0, import_validatorPrimitives.tObject)({
|
|
1661
|
+
selector: import_validatorPrimitives.tString
|
|
1662
|
+
});
|
|
1663
|
+
import_validatorPrimitives.scheme.FrameGenerateLocatorStringResult = (0, import_validatorPrimitives.tObject)({
|
|
1664
|
+
value: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tString)
|
|
1665
|
+
});
|
|
1660
1666
|
import_validatorPrimitives.scheme.FrameHighlightParams = (0, import_validatorPrimitives.tObject)({
|
|
1661
1667
|
selector: import_validatorPrimitives.tString
|
|
1662
1668
|
});
|
|
@@ -2050,10 +2056,6 @@ import_validatorPrimitives.scheme.ElementHandleFillParams = (0, import_validator
|
|
|
2050
2056
|
import_validatorPrimitives.scheme.ElementHandleFillResult = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
|
|
2051
2057
|
import_validatorPrimitives.scheme.ElementHandleFocusParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
|
|
2052
2058
|
import_validatorPrimitives.scheme.ElementHandleFocusResult = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
|
|
2053
|
-
import_validatorPrimitives.scheme.ElementHandleGenerateLocatorStringParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
|
|
2054
|
-
import_validatorPrimitives.scheme.ElementHandleGenerateLocatorStringResult = (0, import_validatorPrimitives.tObject)({
|
|
2055
|
-
value: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tString)
|
|
2056
|
-
});
|
|
2057
2059
|
import_validatorPrimitives.scheme.ElementHandleGetAttributeParams = (0, import_validatorPrimitives.tObject)({
|
|
2058
2060
|
name: import_validatorPrimitives.tString
|
|
2059
2061
|
});
|
|
@@ -179,15 +179,11 @@ ${uaError}` };
|
|
|
179
179
|
preLaunchedBrowser: browser,
|
|
180
180
|
denyLaunch: true,
|
|
181
181
|
dispose: async () => {
|
|
182
|
-
for (const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
await context.stopPendingOperations("Connection closed");
|
|
188
|
-
}
|
|
189
|
-
if (!browser2.contexts())
|
|
190
|
-
await browser2.close({ reason: "Connection terminated" });
|
|
182
|
+
for (const context of browser.contexts()) {
|
|
183
|
+
if (!context.pages().length)
|
|
184
|
+
await context.close({ reason: "Connection terminated" });
|
|
185
|
+
else
|
|
186
|
+
await context.stopPendingOperations("Connection closed");
|
|
191
187
|
}
|
|
192
188
|
}
|
|
193
189
|
};
|
|
@@ -222,7 +222,7 @@ class AndroidDevice extends import_instrumentation.SdkObject {
|
|
|
222
222
|
this.emit(AndroidDevice.Events.Close);
|
|
223
223
|
}
|
|
224
224
|
async launchBrowser(metadata, pkg = "com.android.chrome", options) {
|
|
225
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
225
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
226
226
|
return controller.run(async (progress) => {
|
|
227
227
|
(0, import_utilsBundle.debug)("pw:android")("Force-stopping", pkg);
|
|
228
228
|
await this._backend.runCommand(`shell:am force-stop ${pkg}`);
|
|
@@ -264,7 +264,7 @@ class AndroidDevice extends import_instrumentation.SdkObject {
|
|
|
264
264
|
return chromeArguments;
|
|
265
265
|
}
|
|
266
266
|
async connectToWebView(metadata, socketName) {
|
|
267
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
267
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
268
268
|
return controller.run(async (progress) => {
|
|
269
269
|
const webView = this._webViews.get(socketName);
|
|
270
270
|
if (!webView)
|
|
@@ -332,7 +332,7 @@ class BidiPage {
|
|
|
332
332
|
}
|
|
333
333
|
async takeScreenshot(progress, format, documentRect, viewportRect, quality, fitsViewport, scale) {
|
|
334
334
|
const rect = documentRect || viewportRect;
|
|
335
|
-
const { data } = await this._session.send("browsingContext.captureScreenshot", {
|
|
335
|
+
const { data } = await progress.race(this._session.send("browsingContext.captureScreenshot", {
|
|
336
336
|
context: this._session.sessionId,
|
|
337
337
|
format: {
|
|
338
338
|
type: `image/${format === "png" ? "png" : "jpeg"}`,
|
|
@@ -343,7 +343,7 @@ class BidiPage {
|
|
|
343
343
|
type: "box",
|
|
344
344
|
...rect
|
|
345
345
|
}
|
|
346
|
-
});
|
|
346
|
+
}));
|
|
347
347
|
return Buffer.from(data, "base64");
|
|
348
348
|
}
|
|
349
349
|
async getContentFrame(handle) {
|
package/lib/server/browser.js
CHANGED
|
@@ -50,7 +50,7 @@ class Browser extends import_instrumentation.SdkObject {
|
|
|
50
50
|
return this.options.sdkLanguage || this.attribution.playwright.options.sdkLanguage;
|
|
51
51
|
}
|
|
52
52
|
newContextFromMetadata(metadata, options) {
|
|
53
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
53
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
54
54
|
return controller.run((progress) => this.newContext(progress, options));
|
|
55
55
|
}
|
|
56
56
|
async newContext(progress, options) {
|
|
@@ -160,7 +160,7 @@ if (navigator.serviceWorker) navigator.serviceWorker.register = async () => { co
|
|
|
160
160
|
return JSON.stringify(paramsCopy);
|
|
161
161
|
}
|
|
162
162
|
async resetForReuse(metadata, params) {
|
|
163
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
163
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
164
164
|
return controller.run((progress) => this.resetForReuseImpl(progress, params));
|
|
165
165
|
}
|
|
166
166
|
async resetForReuseImpl(progress, params) {
|
|
@@ -405,7 +405,7 @@ if (navigator.serviceWorker) navigator.serviceWorker.register = async () => { co
|
|
|
405
405
|
await this._closePromise;
|
|
406
406
|
}
|
|
407
407
|
newPageFromMetadata(metadata) {
|
|
408
|
-
const contoller = new import_progress.ProgressController(metadata, this
|
|
408
|
+
const contoller = new import_progress.ProgressController(metadata, this);
|
|
409
409
|
return contoller.run((progress) => this.newPage(progress, false));
|
|
410
410
|
}
|
|
411
411
|
async newPage(progress, isServerSide) {
|
|
@@ -422,7 +422,7 @@ if (navigator.serviceWorker) navigator.serviceWorker.register = async () => { co
|
|
|
422
422
|
this._origins.add(origin);
|
|
423
423
|
}
|
|
424
424
|
storageState(indexedDB = false) {
|
|
425
|
-
const controller = new import_progress.ProgressController((0, import_instrumentation.serverSideCallMetadata)(), this
|
|
425
|
+
const controller = new import_progress.ProgressController((0, import_instrumentation.serverSideCallMetadata)(), this);
|
|
426
426
|
return controller.run((progress) => this.storageStateImpl(progress, indexedDB));
|
|
427
427
|
}
|
|
428
428
|
async storageStateImpl(progress, indexedDB) {
|
|
@@ -67,7 +67,7 @@ class BrowserType extends import_instrumentation.SdkObject {
|
|
|
67
67
|
}
|
|
68
68
|
async launch(metadata, options, protocolLogger) {
|
|
69
69
|
options = this._validateLaunchOptions(options);
|
|
70
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
70
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
71
71
|
const browser = await controller.run((progress) => {
|
|
72
72
|
const seleniumHubUrl = options.__testHookSeleniumRemoteURL || process.env.SELENIUM_REMOTE_URL;
|
|
73
73
|
if (seleniumHubUrl)
|
|
@@ -80,7 +80,7 @@ class BrowserType extends import_instrumentation.SdkObject {
|
|
|
80
80
|
}
|
|
81
81
|
async launchPersistentContext(metadata, userDataDir, options) {
|
|
82
82
|
const launchOptions = this._validateLaunchOptions(options);
|
|
83
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
83
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
84
84
|
const browser = await controller.run(async (progress) => {
|
|
85
85
|
let clientCertificatesProxy;
|
|
86
86
|
if (options.clientCertificates?.length) {
|
|
@@ -239,7 +239,7 @@ class BrowserType extends import_instrumentation.SdkObject {
|
|
|
239
239
|
close: () => closeOrKill(options.__testHookBrowserCloseTimeout || import_time.DEFAULT_PLAYWRIGHT_TIMEOUT),
|
|
240
240
|
kill
|
|
241
241
|
};
|
|
242
|
-
progress.cleanupWhenAborted(() => closeOrKill(
|
|
242
|
+
progress.cleanupWhenAborted(() => closeOrKill(import_time.DEFAULT_PLAYWRIGHT_TIMEOUT));
|
|
243
243
|
const { wsEndpoint } = await progress.race([
|
|
244
244
|
this.waitForReadyState(options, browserLogsCollector),
|
|
245
245
|
exitPromise.then(() => ({ wsEndpoint: void 0 }))
|
|
@@ -62,7 +62,7 @@ class Chromium extends import_browserType.BrowserType {
|
|
|
62
62
|
this._devtools = this._createDevTools();
|
|
63
63
|
}
|
|
64
64
|
async connectOverCDP(metadata, endpointURL, options) {
|
|
65
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
65
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
66
66
|
return controller.run(async (progress) => {
|
|
67
67
|
return await this._connectOverCDPInternal(progress, endpointURL, options);
|
|
68
68
|
}, options.timeout);
|
|
@@ -179,7 +179,7 @@ class Chromium extends import_browserType.BrowserType {
|
|
|
179
179
|
headers = remoteHeaders;
|
|
180
180
|
}
|
|
181
181
|
progress.log(`<selenium> connecting to ${hubUrl}`);
|
|
182
|
-
const response = await (0, import_network.fetchData)({
|
|
182
|
+
const response = await (0, import_network.fetchData)(progress, {
|
|
183
183
|
url: hubUrl + "session",
|
|
184
184
|
method: "POST",
|
|
185
185
|
headers: {
|
|
@@ -188,15 +188,14 @@ class Chromium extends import_browserType.BrowserType {
|
|
|
188
188
|
},
|
|
189
189
|
data: JSON.stringify({
|
|
190
190
|
capabilities: { alwaysMatch: desiredCapabilities }
|
|
191
|
-
})
|
|
192
|
-
timeout: progress.timeUntilDeadline()
|
|
191
|
+
})
|
|
193
192
|
}, seleniumErrorHandler);
|
|
194
193
|
const value = JSON.parse(response).value;
|
|
195
194
|
const sessionId = value.sessionId;
|
|
196
195
|
progress.log(`<selenium> connected to sessionId=${sessionId}`);
|
|
197
196
|
const disconnectFromSelenium = async () => {
|
|
198
197
|
progress.log(`<selenium> disconnecting from sessionId=${sessionId}`);
|
|
199
|
-
await (0, import_network.fetchData)({
|
|
198
|
+
await (0, import_network.fetchData)(void 0, {
|
|
200
199
|
url: hubUrl + "session/" + sessionId,
|
|
201
200
|
method: "DELETE",
|
|
202
201
|
headers
|
|
@@ -227,10 +226,9 @@ class Chromium extends import_browserType.BrowserType {
|
|
|
227
226
|
if (endpointURL.hostname === "localhost" || endpointURL.hostname === "127.0.0.1") {
|
|
228
227
|
const sessionInfoUrl = new URL(hubUrl).origin + "/grid/api/testsession?session=" + sessionId;
|
|
229
228
|
try {
|
|
230
|
-
const sessionResponse = await (0, import_network.fetchData)({
|
|
229
|
+
const sessionResponse = await (0, import_network.fetchData)(progress, {
|
|
231
230
|
url: sessionInfoUrl,
|
|
232
231
|
method: "GET",
|
|
233
|
-
timeout: progress.timeUntilDeadline(),
|
|
234
232
|
headers
|
|
235
233
|
}, seleniumErrorHandler);
|
|
236
234
|
const proxyId = JSON.parse(sessionResponse).proxyId;
|
|
@@ -344,10 +342,10 @@ async function urlToWSEndpoint(progress, endpointURL, headers) {
|
|
|
344
342
|
url.pathname += "json/version/";
|
|
345
343
|
const httpURL = url.toString();
|
|
346
344
|
const json = await (0, import_network.fetchData)(
|
|
345
|
+
progress,
|
|
347
346
|
{
|
|
348
347
|
url: httpURL,
|
|
349
|
-
headers
|
|
350
|
-
timeout: progress.timeUntilDeadline()
|
|
348
|
+
headers
|
|
351
349
|
},
|
|
352
350
|
async (_, resp) => new Error(`Unexpected status ${resp.statusCode} when connecting to ${httpURL}.
|
|
353
351
|
This does not look like a DevTools server, try connecting via ws://.`)
|
|
@@ -210,7 +210,7 @@ class CRPage {
|
|
|
210
210
|
await this._mainFrameSession._client.send("Emulation.setDefaultBackgroundColorOverride", { color });
|
|
211
211
|
}
|
|
212
212
|
async takeScreenshot(progress, format, documentRect, viewportRect, quality, fitsViewport, scale) {
|
|
213
|
-
const { visualViewport } = await this._mainFrameSession._client.send("Page.getLayoutMetrics");
|
|
213
|
+
const { visualViewport } = await progress.race(this._mainFrameSession._client.send("Page.getLayoutMetrics"));
|
|
214
214
|
if (!documentRect) {
|
|
215
215
|
documentRect = {
|
|
216
216
|
x: visualViewport.pageX + viewportRect.x,
|
|
@@ -226,8 +226,7 @@ class CRPage {
|
|
|
226
226
|
const deviceScaleFactor = this._browserContext._options.deviceScaleFactor || 1;
|
|
227
227
|
clip.scale /= deviceScaleFactor;
|
|
228
228
|
}
|
|
229
|
-
progress.
|
|
230
|
-
const result = await this._mainFrameSession._client.send("Page.captureScreenshot", { format, quality, clip, captureBeyondViewport: !fitsViewport });
|
|
229
|
+
const result = await progress.race(this._mainFrameSession._client.send("Page.captureScreenshot", { format, quality, clip, captureBeyondViewport: !fitsViewport }));
|
|
231
230
|
return Buffer.from(result.data, "base64");
|
|
232
231
|
}
|
|
233
232
|
async getContentFrame(handle) {
|
|
@@ -44,7 +44,7 @@ class VideoRecorder {
|
|
|
44
44
|
static async launch(page, ffmpegPath, options) {
|
|
45
45
|
if (!options.outputFile.endsWith(".webm"))
|
|
46
46
|
throw new Error("File must have .webm extension");
|
|
47
|
-
const controller = new import_progress.ProgressController((0, import_instrumentation.serverSideCallMetadata)(), page
|
|
47
|
+
const controller = new import_progress.ProgressController((0, import_instrumentation.serverSideCallMetadata)(), page);
|
|
48
48
|
controller.setLogName("browser");
|
|
49
49
|
return await controller.run(async (progress) => {
|
|
50
50
|
const recorder = new VideoRecorder(page, ffmpegPath, progress);
|
|
@@ -55,9 +55,6 @@ class ElementHandleDispatcher extends import_jsHandleDispatcher.JSHandleDispatch
|
|
|
55
55
|
const frame = await this._elementHandle.contentFrame();
|
|
56
56
|
return { frame: frame ? import_frameDispatcher.FrameDispatcher.from(this._browserContextDispatcher(), frame) : void 0 };
|
|
57
57
|
}
|
|
58
|
-
async generateLocatorString(params, metadata) {
|
|
59
|
-
return { value: await this._elementHandle.generateLocatorString() };
|
|
60
|
-
}
|
|
61
58
|
async getAttribute(params, metadata) {
|
|
62
59
|
const value = await this._elementHandle.getAttribute(metadata, params.name);
|
|
63
60
|
return { value: value === null ? void 0 : value };
|
|
@@ -144,6 +144,9 @@ class FrameDispatcher extends import_dispatcher.Dispatcher {
|
|
|
144
144
|
async innerHTML(params, metadata) {
|
|
145
145
|
return { value: await this._frame.innerHTML(metadata, params.selector, params) };
|
|
146
146
|
}
|
|
147
|
+
async generateLocatorString(params, metadata) {
|
|
148
|
+
return { value: await this._frame.generateLocatorString(metadata, params.selector) };
|
|
149
|
+
}
|
|
147
150
|
async getAttribute(params, metadata) {
|
|
148
151
|
const value = await this._frame.getAttribute(metadata, params.selector, params.name, params);
|
|
149
152
|
return { value: value === null ? void 0 : value };
|
|
@@ -79,7 +79,7 @@ class LocalUtilsDispatcher extends import_dispatcher.Dispatcher {
|
|
|
79
79
|
return await localUtils.addStackToTracingNoReply(this._stackSessions, params);
|
|
80
80
|
}
|
|
81
81
|
async connect(params, metadata) {
|
|
82
|
-
const controller = new import_progress.ProgressController(metadata, this._object
|
|
82
|
+
const controller = new import_progress.ProgressController(metadata, this._object);
|
|
83
83
|
return await controller.run(async (progress) => {
|
|
84
84
|
const wsHeaders = {
|
|
85
85
|
"User-Agent": (0, import_userAgent.getUserAgent)(),
|
|
@@ -129,10 +129,9 @@ async function urlToWSEndpoint(progress, endpointURL) {
|
|
|
129
129
|
if (!fetchUrl.pathname.endsWith("/"))
|
|
130
130
|
fetchUrl.pathname += "/";
|
|
131
131
|
fetchUrl.pathname += "json";
|
|
132
|
-
const json = await (0, import_network.fetchData)({
|
|
132
|
+
const json = await (0, import_network.fetchData)(progress, {
|
|
133
133
|
url: fetchUrl.toString(),
|
|
134
134
|
method: "GET",
|
|
135
|
-
timeout: progress.timeUntilDeadline(),
|
|
136
135
|
headers: { "User-Agent": (0, import_userAgent.getUserAgent)() }
|
|
137
136
|
}, async (params, response) => {
|
|
138
137
|
return new Error(`Unexpected status ${response.statusCode} when connecting to ${fetchUrl.toString()}.
|
package/lib/server/dom.js
CHANGED
|
@@ -161,35 +161,6 @@ class ElementHandle extends js.JSHandle {
|
|
|
161
161
|
return null;
|
|
162
162
|
return this._page.delegate.getContentFrame(this);
|
|
163
163
|
}
|
|
164
|
-
async generateLocatorString() {
|
|
165
|
-
const selectors = await this._generateSelectorString();
|
|
166
|
-
if (!selectors.length)
|
|
167
|
-
return;
|
|
168
|
-
return (0, import_utils.asLocator)("javascript", selectors.reverse().join(" >> internal:control=enter-frame >> "));
|
|
169
|
-
}
|
|
170
|
-
async _generateSelectorString() {
|
|
171
|
-
const selector = await this.evaluateInUtility(async ([injected, node]) => {
|
|
172
|
-
return injected.generateSelectorSimple(node);
|
|
173
|
-
}, {});
|
|
174
|
-
if (selector === "error:notconnected")
|
|
175
|
-
return [];
|
|
176
|
-
let frame = this._frame;
|
|
177
|
-
const result = [selector];
|
|
178
|
-
while (frame?.parentFrame()) {
|
|
179
|
-
const frameElement = await frame.frameElement();
|
|
180
|
-
if (frameElement) {
|
|
181
|
-
const selector2 = await frameElement.evaluateInUtility(async ([injected, node]) => {
|
|
182
|
-
return injected.generateSelectorSimple(node);
|
|
183
|
-
}, {});
|
|
184
|
-
frameElement.dispose();
|
|
185
|
-
if (selector2 === "error:notconnected")
|
|
186
|
-
return [];
|
|
187
|
-
result.push(selector2);
|
|
188
|
-
}
|
|
189
|
-
frame = frame.parentFrame();
|
|
190
|
-
}
|
|
191
|
-
return result;
|
|
192
|
-
}
|
|
193
164
|
async getAttribute(metadata, name) {
|
|
194
165
|
return this._frame.getAttribute(metadata, ":scope", name, { timeout: 0 }, this);
|
|
195
166
|
}
|
|
@@ -224,7 +195,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
224
195
|
assertDone(throwRetargetableDOMError(result));
|
|
225
196
|
}
|
|
226
197
|
async scrollIntoViewIfNeeded(metadata, options) {
|
|
227
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
198
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
228
199
|
return controller.run(
|
|
229
200
|
(progress) => this._waitAndScrollIntoViewIfNeeded(
|
|
230
201
|
progress,
|
|
@@ -289,7 +260,6 @@ class ElementHandle extends js.JSHandle {
|
|
|
289
260
|
let retry = 0;
|
|
290
261
|
const waitTime = [0, 20, 100, 100, 500];
|
|
291
262
|
while (true) {
|
|
292
|
-
progress.throwIfAborted();
|
|
293
263
|
if (retry) {
|
|
294
264
|
progress.log(`retrying ${actionName} action${options.trial ? " (trial run)" : ""}`);
|
|
295
265
|
const timeout = waitTime[Math.min(retry - 1, waitTime.length - 1)];
|
|
@@ -322,6 +292,10 @@ class ElementHandle extends js.JSHandle {
|
|
|
322
292
|
progress.log(" did not find some options");
|
|
323
293
|
continue;
|
|
324
294
|
}
|
|
295
|
+
if (result === "error:optionnotenabled") {
|
|
296
|
+
progress.log(" option being selected is not enabled");
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
325
299
|
if (typeof result === "object" && "hitTargetDescription" in result) {
|
|
326
300
|
progress.log(` ${result.hitTargetDescription} intercepts pointer events`);
|
|
327
301
|
continue;
|
|
@@ -359,7 +333,6 @@ class ElementHandle extends js.JSHandle {
|
|
|
359
333
|
return await this._scrollRectIntoViewIfNeeded(progress, position ? { x: position.x, y: position.y, width: 0, height: 0 } : void 0);
|
|
360
334
|
};
|
|
361
335
|
if (this._frame.parentFrame()) {
|
|
362
|
-
progress.throwIfAborted();
|
|
363
336
|
await progress.race(doScrollIntoView().catch(() => {
|
|
364
337
|
}));
|
|
365
338
|
}
|
|
@@ -378,7 +351,6 @@ class ElementHandle extends js.JSHandle {
|
|
|
378
351
|
if (options.__testHookAfterStable)
|
|
379
352
|
await progress.race(options.__testHookAfterStable());
|
|
380
353
|
progress.log(" scrolling into view if needed");
|
|
381
|
-
progress.throwIfAborted();
|
|
382
354
|
const scrolled = await progress.race(doScrollIntoView());
|
|
383
355
|
if (scrolled !== "done")
|
|
384
356
|
return scrolled;
|
|
@@ -419,7 +391,6 @@ class ElementHandle extends js.JSHandle {
|
|
|
419
391
|
const actionResult = await this._page.frameManager.waitForSignalsCreatedBy(progress, options.waitAfter === true, async () => {
|
|
420
392
|
if (options.__testHookBeforePointerAction)
|
|
421
393
|
await progress.race(options.__testHookBeforePointerAction());
|
|
422
|
-
progress.throwIfAborted();
|
|
423
394
|
let restoreModifiers;
|
|
424
395
|
if (options && options.modifiers)
|
|
425
396
|
restoreModifiers = await this._page.keyboard.ensureModifiers(progress, options.modifiers);
|
|
@@ -459,7 +430,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
459
430
|
}, progress.metadata.id));
|
|
460
431
|
}
|
|
461
432
|
async hover(metadata, options) {
|
|
462
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
433
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
463
434
|
return controller.run(async (progress) => {
|
|
464
435
|
await this._markAsTargetElement(progress);
|
|
465
436
|
const result = await this._hover(progress, options);
|
|
@@ -470,7 +441,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
470
441
|
return this._retryPointerAction(progress, "hover", false, (point) => this._page.mouse._move(progress, point.x, point.y), { ...options, waitAfter: "disabled" });
|
|
471
442
|
}
|
|
472
443
|
async click(metadata, options) {
|
|
473
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
444
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
474
445
|
return controller.run(async (progress) => {
|
|
475
446
|
await this._markAsTargetElement(progress);
|
|
476
447
|
const result = await this._click(progress, { ...options, waitAfter: !options.noWaitAfter });
|
|
@@ -481,7 +452,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
481
452
|
return this._retryPointerAction(progress, "click", true, (point) => this._page.mouse._click(progress, point.x, point.y, options), options);
|
|
482
453
|
}
|
|
483
454
|
async dblclick(metadata, options) {
|
|
484
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
455
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
485
456
|
return controller.run(async (progress) => {
|
|
486
457
|
await this._markAsTargetElement(progress);
|
|
487
458
|
const result = await this._dblclick(progress, options);
|
|
@@ -492,7 +463,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
492
463
|
return this._retryPointerAction(progress, "dblclick", true, (point) => this._page.mouse._click(progress, point.x, point.y, { ...options, clickCount: 2 }), { ...options, waitAfter: "disabled" });
|
|
493
464
|
}
|
|
494
465
|
async tap(metadata, options) {
|
|
495
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
466
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
496
467
|
return controller.run(async (progress) => {
|
|
497
468
|
await this._markAsTargetElement(progress);
|
|
498
469
|
const result = await this._tap(progress, options);
|
|
@@ -503,7 +474,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
503
474
|
return this._retryPointerAction(progress, "tap", true, (point) => this._page.touchscreen._tap(progress, point.x, point.y), { ...options, waitAfter: "disabled" });
|
|
504
475
|
}
|
|
505
476
|
async selectOption(metadata, elements, values, options) {
|
|
506
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
477
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
507
478
|
return controller.run(async (progress) => {
|
|
508
479
|
await this._markAsTargetElement(progress);
|
|
509
480
|
const result = await this._selectOption(progress, elements, values, options);
|
|
@@ -537,7 +508,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
537
508
|
return resultingOptions;
|
|
538
509
|
}
|
|
539
510
|
async fill(metadata, value, options) {
|
|
540
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
511
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
541
512
|
return controller.run(async (progress) => {
|
|
542
513
|
await this._markAsTargetElement(progress);
|
|
543
514
|
const result = await this._fill(progress, value, options);
|
|
@@ -558,7 +529,6 @@ class ElementHandle extends js.JSHandle {
|
|
|
558
529
|
}
|
|
559
530
|
return injected.fill(node, value2);
|
|
560
531
|
}, { value, force: options.force }));
|
|
561
|
-
progress.throwIfAborted();
|
|
562
532
|
if (result === "needsinput") {
|
|
563
533
|
if (value)
|
|
564
534
|
await this._page.keyboard._insertText(progress, value);
|
|
@@ -571,7 +541,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
571
541
|
}, options);
|
|
572
542
|
}
|
|
573
543
|
async selectText(metadata, options) {
|
|
574
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
544
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
575
545
|
return controller.run(async (progress) => {
|
|
576
546
|
const result = await this._retryAction(progress, "selectText", async () => {
|
|
577
547
|
if (!options.force)
|
|
@@ -589,7 +559,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
589
559
|
}, options.timeout);
|
|
590
560
|
}
|
|
591
561
|
async setInputFiles(metadata, params) {
|
|
592
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
562
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
593
563
|
return controller.run(async (progress) => {
|
|
594
564
|
const inputFileItems = await progress.race((0, import_fileUploadUtils.prepareFilesForUpload)(this._frame, params));
|
|
595
565
|
await this._markAsTargetElement(progress);
|
|
@@ -634,7 +604,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
634
604
|
return "done";
|
|
635
605
|
}
|
|
636
606
|
async focus(metadata) {
|
|
637
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
607
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
638
608
|
await controller.run(async (progress) => {
|
|
639
609
|
await this._markAsTargetElement(progress);
|
|
640
610
|
const result = await this._focus(progress);
|
|
@@ -648,7 +618,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
648
618
|
return await progress.race(this.evaluateInUtility(([injected, node]) => injected.blurNode(node), {}));
|
|
649
619
|
}
|
|
650
620
|
async type(metadata, text, options) {
|
|
651
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
621
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
652
622
|
return controller.run(async (progress) => {
|
|
653
623
|
await this._markAsTargetElement(progress);
|
|
654
624
|
const result = await this._type(progress, text, options);
|
|
@@ -669,7 +639,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
669
639
|
return "done";
|
|
670
640
|
}
|
|
671
641
|
async press(metadata, key, options) {
|
|
672
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
642
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
673
643
|
return controller.run(async (progress) => {
|
|
674
644
|
await this._markAsTargetElement(progress);
|
|
675
645
|
const result = await this._press(progress, key, options);
|
|
@@ -692,14 +662,14 @@ class ElementHandle extends js.JSHandle {
|
|
|
692
662
|
});
|
|
693
663
|
}
|
|
694
664
|
async check(metadata, options) {
|
|
695
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
665
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
696
666
|
return controller.run(async (progress) => {
|
|
697
667
|
const result = await this._setChecked(progress, true, options);
|
|
698
668
|
return assertDone(throwRetargetableDOMError(result));
|
|
699
669
|
}, options.timeout);
|
|
700
670
|
}
|
|
701
671
|
async uncheck(metadata, options) {
|
|
702
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
672
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
703
673
|
return controller.run(async (progress) => {
|
|
704
674
|
const result = await this._setChecked(progress, false, options);
|
|
705
675
|
return assertDone(throwRetargetableDOMError(result));
|
|
@@ -731,7 +701,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
731
701
|
return await this.evaluateInUtility(([injected, element, options2]) => injected.ariaSnapshot(element, options2), options);
|
|
732
702
|
}
|
|
733
703
|
async screenshot(metadata, options) {
|
|
734
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
704
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
735
705
|
return controller.run(
|
|
736
706
|
(progress) => this._page.screenshotter.screenshotElement(progress, this, options),
|
|
737
707
|
options.timeout
|
|
@@ -768,7 +738,7 @@ class ElementHandle extends js.JSHandle {
|
|
|
768
738
|
return this._frame.isChecked(metadata, ":scope", { timeout: 0 }, this);
|
|
769
739
|
}
|
|
770
740
|
async waitForElementState(metadata, state, options) {
|
|
771
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
741
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
772
742
|
return controller.run(async (progress) => {
|
|
773
743
|
const actionName = `wait for ${state}`;
|
|
774
744
|
const result = await this._retryAction(progress, actionName, async () => {
|
|
@@ -129,7 +129,7 @@ class Electron extends import_instrumentation.SdkObject {
|
|
|
129
129
|
this.logName = "browser";
|
|
130
130
|
}
|
|
131
131
|
async launch(metadata, options) {
|
|
132
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
132
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
133
133
|
return controller.run(async (progress) => {
|
|
134
134
|
let app = void 0;
|
|
135
135
|
let electronArguments = ["--inspect=0", "--remote-debugging-port=0", ...options.args || []];
|
package/lib/server/fetch.js
CHANGED
|
@@ -135,7 +135,7 @@ class APIRequestContext extends import_instrumentation.SdkObject {
|
|
|
135
135
|
const postData = serializePostData(params, headers);
|
|
136
136
|
if (postData)
|
|
137
137
|
setHeader(headers, "content-length", String(postData.byteLength));
|
|
138
|
-
const controller = new import_progress.ProgressController(metadata, this
|
|
138
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
139
139
|
const fetchResponse = await controller.run((progress) => {
|
|
140
140
|
return this._sendRequestWithRetries(progress, requestUrl, options, postData, params.maxRetries);
|
|
141
141
|
}, params.timeout);
|
|
@@ -363,12 +363,12 @@ class FFPage {
|
|
|
363
363
|
height: viewportRect.height
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
const { data } = await this._session.send("Page.screenshot", {
|
|
366
|
+
const { data } = await progress.race(this._session.send("Page.screenshot", {
|
|
367
367
|
mimeType: "image/" + format,
|
|
368
368
|
clip: documentRect,
|
|
369
369
|
quality,
|
|
370
370
|
omitDeviceScaleFactor: scale === "css"
|
|
371
|
-
});
|
|
371
|
+
}));
|
|
372
372
|
return Buffer.from(data, "base64");
|
|
373
373
|
}
|
|
374
374
|
async getContentFrame(handle) {
|