patchright-core 1.52.4 → 1.55.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/ThirdPartyNotices.txt +65 -123
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +14 -14
- package/index.js +1 -1
- package/lib/androidServerImpl.js +4 -2
- package/lib/browserServerImpl.js +47 -12
- package/lib/cli/program.js +116 -50
- package/lib/cli/programWithTestStub.js +1 -1
- package/lib/client/android.js +30 -34
- package/lib/client/browser.js +54 -17
- package/lib/client/browserContext.js +67 -71
- package/lib/client/browserType.js +25 -34
- package/lib/client/channelOwner.js +20 -24
- package/lib/client/connection.js +6 -10
- package/lib/client/electron.js +8 -3
- package/lib/client/elementHandle.js +18 -21
- package/lib/client/fetch.js +5 -3
- package/lib/client/frame.js +57 -35
- package/lib/client/input.js +3 -1
- package/lib/client/jsHandle.js +4 -0
- package/lib/client/localUtils.js +0 -1
- package/lib/client/locator.js +32 -28
- package/lib/client/network.js +5 -12
- package/lib/client/page.js +32 -32
- package/lib/client/playwright.js +6 -16
- package/lib/client/selectors.js +18 -38
- package/lib/client/timeoutSettings.js +12 -8
- package/lib/client/tracing.js +24 -20
- package/lib/client/waiter.js +2 -2
- package/lib/client/webSocket.js +4 -22
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/generated/storageScriptSource.js +28 -0
- package/lib/generated/utilityScriptSource.js +1 -1
- package/lib/generated/webSocketMockSource.js +12 -50
- package/lib/inProcessFactory.js +9 -6
- package/lib/outofprocess.js +0 -2
- package/lib/protocol/validator.js +423 -346
- package/lib/protocol/validatorPrimitives.js +18 -4
- package/lib/remote/playwrightConnection.js +29 -166
- package/lib/remote/playwrightServer.js +233 -35
- package/lib/server/android/android.js +97 -83
- package/lib/server/android/backendAdb.js +0 -2
- package/lib/server/bidi/bidiBrowser.js +139 -73
- package/lib/server/bidi/bidiChromium.js +23 -22
- package/lib/server/bidi/bidiExecutionContext.js +2 -1
- package/lib/server/bidi/bidiFirefox.js +17 -14
- package/lib/server/bidi/bidiInput.js +22 -22
- package/lib/server/bidi/bidiNetworkManager.js +8 -11
- package/lib/server/bidi/bidiPage.js +42 -86
- package/lib/server/bidi/third_party/bidiProtocol.js +5 -133
- package/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/lib/server/{dispatchers/selectorsDispatcher.js → bidi/third_party/bidiProtocolPermissions.js} +20 -18
- package/lib/server/browser.js +30 -21
- package/lib/server/browserContext.js +203 -165
- package/lib/server/browserType.js +109 -107
- package/lib/server/chromium/chromium.js +84 -69
- package/lib/server/chromium/chromiumSwitches.js +13 -20
- package/lib/server/chromium/crBrowser.js +74 -40
- package/lib/server/chromium/crConnection.js +8 -9
- package/lib/server/chromium/crCoverage.js +11 -8
- package/lib/server/chromium/crDragDrop.js +25 -20
- package/lib/server/chromium/crExecutionContext.js +2 -1
- package/lib/server/chromium/crInput.js +32 -29
- package/lib/server/chromium/crNetworkManager.js +45 -33
- package/lib/server/chromium/crPage.js +98 -73
- package/lib/server/chromium/crServiceWorker.js +13 -18
- package/lib/server/chromium/videoRecorder.js +10 -18
- package/lib/server/clock.js +51 -39
- package/lib/server/codegen/csharp.js +10 -5
- package/lib/server/codegen/java.js +1 -1
- package/lib/server/codegen/javascript.js +1 -1
- package/lib/server/codegen/jsonl.js +2 -1
- package/lib/server/codegen/language.js +22 -1
- package/lib/server/codegen/languages.js +4 -4
- package/lib/server/codegen/python.js +1 -1
- package/lib/server/cookieStore.js +3 -1
- package/lib/server/debugController.js +105 -71
- package/lib/server/debugger.js +6 -23
- package/lib/server/deviceDescriptorsSource.json +237 -127
- package/lib/server/dialog.js +50 -6
- package/lib/server/dispatchers/androidDispatcher.js +77 -62
- package/lib/server/dispatchers/artifactDispatcher.js +18 -18
- package/lib/server/dispatchers/browserContextDispatcher.js +141 -91
- package/lib/server/dispatchers/browserDispatcher.js +55 -88
- package/lib/server/dispatchers/browserTypeDispatcher.js +18 -9
- package/lib/server/dispatchers/cdpSessionDispatcher.js +4 -4
- package/lib/server/dispatchers/debugControllerDispatcher.js +12 -21
- package/lib/server/dispatchers/dialogDispatcher.js +4 -4
- package/lib/server/dispatchers/dispatcher.js +78 -53
- package/lib/server/dispatchers/electronDispatcher.js +19 -20
- package/lib/server/dispatchers/elementHandlerDispatcher.js +83 -93
- package/lib/server/dispatchers/frameDispatcher.js +99 -102
- package/lib/server/dispatchers/jsHandleDispatcher.js +21 -16
- package/lib/server/dispatchers/jsonPipeDispatcher.js +4 -4
- package/lib/server/dispatchers/localUtilsDispatcher.js +53 -59
- package/lib/server/dispatchers/networkDispatchers.js +41 -35
- package/lib/server/dispatchers/pageDispatcher.js +156 -107
- package/lib/server/dispatchers/playwrightDispatcher.js +37 -25
- package/lib/server/dispatchers/streamDispatcher.js +15 -8
- package/lib/server/dispatchers/tracingDispatcher.js +22 -13
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +46 -35
- package/lib/server/dispatchers/writableStreamDispatcher.js +16 -10
- package/lib/server/dom.js +198 -266
- package/lib/server/download.js +3 -3
- package/lib/server/electron/electron.js +96 -103
- package/lib/server/electron/loader.js +1 -1
- package/lib/server/fetch.js +22 -41
- package/lib/server/fileUploadUtils.js +1 -1
- package/lib/server/firefox/ffBrowser.js +79 -55
- package/lib/server/firefox/ffExecutionContext.js +2 -1
- package/lib/server/firefox/ffInput.js +23 -23
- package/lib/server/firefox/ffNetworkManager.js +8 -6
- package/lib/server/firefox/ffPage.js +39 -36
- package/lib/server/firefox/firefox.js +9 -10
- package/lib/server/frameSelectors.js +65 -22
- package/lib/server/frames.js +516 -544
- package/lib/server/har/harRecorder.js +1 -1
- package/lib/server/har/harTracer.js +4 -2
- package/lib/server/helper.js +3 -7
- package/lib/server/index.js +0 -3
- package/lib/server/input.js +47 -54
- package/lib/server/instrumentation.js +8 -14
- package/lib/server/javascript.js +9 -17
- package/lib/server/launchApp.js +48 -30
- package/lib/server/localUtils.js +45 -38
- package/lib/server/network.js +44 -10
- package/lib/server/page.js +233 -178
- package/lib/server/pageBinding.js +6 -7
- package/lib/server/playwright.js +4 -14
- package/lib/server/progress.js +57 -49
- package/lib/server/recorder/recorderApp.js +298 -95
- package/lib/server/recorder/recorderRunner.js +23 -24
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +67 -10
- package/lib/server/recorder.js +284 -146
- package/lib/server/registry/index.js +83 -48
- package/lib/server/registry/nativeDeps.js +175 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +1 -1
- package/lib/server/screenshotter.js +84 -83
- package/lib/server/selectors.js +12 -12
- package/lib/server/socksClientCertificatesInterceptor.js +198 -136
- package/lib/server/trace/recorder/snapshotter.js +12 -19
- package/lib/server/trace/recorder/tracing.js +36 -27
- package/lib/server/trace/viewer/traceViewer.js +11 -20
- package/lib/server/transport.js +20 -22
- package/lib/server/utils/comparators.js +2 -2
- package/lib/server/utils/debug.js +3 -8
- package/lib/server/utils/debugLogger.js +8 -0
- package/lib/server/utils/hostPlatform.js +3 -1
- package/lib/server/utils/network.js +35 -25
- package/lib/server/utils/nodePlatform.js +1 -1
- package/lib/server/utils/processLauncher.js +4 -1
- package/lib/server/utils/wsServer.js +11 -17
- package/lib/server/webkit/webkit.js +5 -2
- package/lib/server/webkit/wkBrowser.js +51 -28
- package/lib/server/webkit/wkExecutionContext.js +2 -1
- package/lib/server/webkit/wkInput.js +25 -25
- package/lib/server/webkit/wkInterceptableRequest.js +1 -1
- package/lib/server/webkit/wkPage.js +80 -59
- package/lib/server/webkit/wkProvisionalPage.js +1 -1
- package/lib/server/webkit/wkWorkers.js +7 -7
- package/lib/utils/isomorphic/ariaSnapshot.js +13 -7
- package/lib/utils/isomorphic/cssParser.js +1 -2
- package/lib/utils/isomorphic/locatorGenerators.js +18 -0
- package/lib/utils/isomorphic/manualPromise.js +1 -2
- package/lib/utils/isomorphic/mimeType.js +1 -2
- package/lib/utils/isomorphic/multimap.js +1 -2
- package/lib/utils/isomorphic/oldUtilityScriptSerializers.js +248 -0
- package/lib/utils/isomorphic/protocolFormatter.js +78 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +318 -0
- package/lib/utils/isomorphic/selectorParser.js +3 -4
- package/lib/utils/isomorphic/stringUtils.js +3 -24
- package/lib/utils/isomorphic/time.js +9 -4
- package/lib/utils/isomorphic/timeoutRunner.js +3 -4
- package/lib/utils/isomorphic/traceUtils.js +2 -3
- package/lib/utils/isomorphic/urlMatch.js +21 -7
- package/lib/utils/isomorphic/utilityScriptSerializers.js +208 -205
- package/lib/utils.js +8 -2
- package/lib/utilsBundleImpl/index.js +160 -150
- package/lib/vite/htmlReport/index.html +17 -17
- package/lib/vite/recorder/assets/{codeMirrorModule-CXVeovup.js → codeMirrorModule-DzQ0k89p.js} +1 -1
- package/lib/vite/recorder/assets/{index-eHBmevrY.css → index-CI4HQ-Zb.css} +1 -1
- package/lib/vite/recorder/assets/index-D7C7daHH.js +184 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/{codeMirrorModule-_GLjJL-7.js → codeMirrorModule-Di48jgWx.js} +1 -1
- package/lib/vite/traceViewer/assets/defaultSettingsView-szBn8781.js +256 -0
- package/lib/vite/traceViewer/defaultSettingsView.DVJHpiGt.css +1 -0
- package/lib/vite/traceViewer/index.BFsek2M6.css +1 -0
- package/lib/vite/traceViewer/index.DQvXoPLL.js +2 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.dBV3oN9h.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +4 -4
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +1 -1
- package/types/protocol.d.ts +712 -107
- package/types/types.d.ts +148 -37
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/protocol/debug.js +0 -211
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/utils/isomorphic/builtins.js +0 -86
- package/lib/vite/recorder/assets/index-BsWQsSGl.js +0 -184
- package/lib/vite/traceViewer/assets/defaultSettingsView-DtCQiGHe.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.cFZzK9RN.js +0 -2
- package/lib/vite/traceViewer/uiMode.XVPIqBeS.js +0 -5
|
@@ -40,6 +40,7 @@ class ElementHandle extends import_jsHandle.JSHandle {
|
|
|
40
40
|
}
|
|
41
41
|
constructor(parent, type, guid, initializer) {
|
|
42
42
|
super(parent, type, guid, initializer);
|
|
43
|
+
this._frame = parent;
|
|
43
44
|
this._elementChannel = this._channel;
|
|
44
45
|
}
|
|
45
46
|
asElement() {
|
|
@@ -51,10 +52,6 @@ class ElementHandle extends import_jsHandle.JSHandle {
|
|
|
51
52
|
async contentFrame() {
|
|
52
53
|
return import_frame.Frame.fromNullable((await this._elementChannel.contentFrame()).frame);
|
|
53
54
|
}
|
|
54
|
-
async _generateLocatorString() {
|
|
55
|
-
const value = (await this._elementChannel.generateLocatorString()).value;
|
|
56
|
-
return value === void 0 ? null : value;
|
|
57
|
-
}
|
|
58
55
|
async getAttribute(name) {
|
|
59
56
|
const value = (await this._elementChannel.getAttribute({ name })).value;
|
|
60
57
|
return value === void 0 ? null : value;
|
|
@@ -94,51 +91,51 @@ class ElementHandle extends import_jsHandle.JSHandle {
|
|
|
94
91
|
await this._elementChannel.dispatchEvent({ type, eventInit: (0, import_jsHandle.serializeArgument)(eventInit) });
|
|
95
92
|
}
|
|
96
93
|
async scrollIntoViewIfNeeded(options = {}) {
|
|
97
|
-
await this._elementChannel.scrollIntoViewIfNeeded(options);
|
|
94
|
+
await this._elementChannel.scrollIntoViewIfNeeded({ ...options, timeout: this._frame._timeout(options) });
|
|
98
95
|
}
|
|
99
96
|
async hover(options = {}) {
|
|
100
|
-
await this._elementChannel.hover(options);
|
|
97
|
+
await this._elementChannel.hover({ ...options, timeout: this._frame._timeout(options) });
|
|
101
98
|
}
|
|
102
99
|
async click(options = {}) {
|
|
103
|
-
return await this._elementChannel.click(options);
|
|
100
|
+
return await this._elementChannel.click({ ...options, timeout: this._frame._timeout(options) });
|
|
104
101
|
}
|
|
105
102
|
async dblclick(options = {}) {
|
|
106
|
-
return await this._elementChannel.dblclick(options);
|
|
103
|
+
return await this._elementChannel.dblclick({ ...options, timeout: this._frame._timeout(options) });
|
|
107
104
|
}
|
|
108
105
|
async tap(options = {}) {
|
|
109
|
-
return await this._elementChannel.tap(options);
|
|
106
|
+
return await this._elementChannel.tap({ ...options, timeout: this._frame._timeout(options) });
|
|
110
107
|
}
|
|
111
108
|
async selectOption(values, options = {}) {
|
|
112
|
-
const result = await this._elementChannel.selectOption({ ...convertSelectOptionValues(values), ...options });
|
|
109
|
+
const result = await this._elementChannel.selectOption({ ...convertSelectOptionValues(values), ...options, timeout: this._frame._timeout(options) });
|
|
113
110
|
return result.values;
|
|
114
111
|
}
|
|
115
112
|
async fill(value, options = {}) {
|
|
116
|
-
return await this._elementChannel.fill({ value, ...options });
|
|
113
|
+
return await this._elementChannel.fill({ value, ...options, timeout: this._frame._timeout(options) });
|
|
117
114
|
}
|
|
118
115
|
async selectText(options = {}) {
|
|
119
|
-
await this._elementChannel.selectText(options);
|
|
116
|
+
await this._elementChannel.selectText({ ...options, timeout: this._frame._timeout(options) });
|
|
120
117
|
}
|
|
121
118
|
async setInputFiles(files, options = {}) {
|
|
122
119
|
const frame = await this.ownerFrame();
|
|
123
120
|
if (!frame)
|
|
124
121
|
throw new Error("Cannot set input files to detached element");
|
|
125
122
|
const converted = await convertInputFiles(this._platform, files, frame.page().context());
|
|
126
|
-
await this._elementChannel.setInputFiles({ ...converted, ...options });
|
|
123
|
+
await this._elementChannel.setInputFiles({ ...converted, ...options, timeout: this._frame._timeout(options) });
|
|
127
124
|
}
|
|
128
125
|
async focus() {
|
|
129
126
|
await this._elementChannel.focus();
|
|
130
127
|
}
|
|
131
128
|
async type(text, options = {}) {
|
|
132
|
-
await this._elementChannel.type({ text, ...options });
|
|
129
|
+
await this._elementChannel.type({ text, ...options, timeout: this._frame._timeout(options) });
|
|
133
130
|
}
|
|
134
131
|
async press(key, options = {}) {
|
|
135
|
-
await this._elementChannel.press({ key, ...options });
|
|
132
|
+
await this._elementChannel.press({ key, ...options, timeout: this._frame._timeout(options) });
|
|
136
133
|
}
|
|
137
134
|
async check(options = {}) {
|
|
138
|
-
return await this._elementChannel.check(options);
|
|
135
|
+
return await this._elementChannel.check({ ...options, timeout: this._frame._timeout(options) });
|
|
139
136
|
}
|
|
140
137
|
async uncheck(options = {}) {
|
|
141
|
-
return await this._elementChannel.uncheck(options);
|
|
138
|
+
return await this._elementChannel.uncheck({ ...options, timeout: this._frame._timeout(options) });
|
|
142
139
|
}
|
|
143
140
|
async setChecked(checked, options) {
|
|
144
141
|
if (checked)
|
|
@@ -152,7 +149,7 @@ class ElementHandle extends import_jsHandle.JSHandle {
|
|
|
152
149
|
}
|
|
153
150
|
async screenshot(options = {}) {
|
|
154
151
|
const mask = options.mask;
|
|
155
|
-
const copy = { ...options, mask: void 0 };
|
|
152
|
+
const copy = { ...options, mask: void 0, timeout: this._frame._timeout(options) };
|
|
156
153
|
if (!copy.type)
|
|
157
154
|
copy.type = determineScreenshotType(options);
|
|
158
155
|
if (mask) {
|
|
@@ -184,10 +181,10 @@ class ElementHandle extends import_jsHandle.JSHandle {
|
|
|
184
181
|
return (0, import_jsHandle.parseResult)(result.value);
|
|
185
182
|
}
|
|
186
183
|
async waitForElementState(state, options = {}) {
|
|
187
|
-
return await this._elementChannel.waitForElementState({ state, ...options });
|
|
184
|
+
return await this._elementChannel.waitForElementState({ state, ...options, timeout: this._frame._timeout(options) });
|
|
188
185
|
}
|
|
189
186
|
async waitForSelector(selector, options = {}) {
|
|
190
|
-
const result = await this._elementChannel.waitForSelector({ selector, ...options });
|
|
187
|
+
const result = await this._elementChannel.waitForSelector({ selector, ...options, timeout: this._frame._timeout(options) });
|
|
191
188
|
return ElementHandle.fromNullable(result.element);
|
|
192
189
|
}
|
|
193
190
|
}
|
|
@@ -244,7 +241,7 @@ async function convertInputFiles(platform, files, context) {
|
|
|
244
241
|
lastModifiedMs
|
|
245
242
|
};
|
|
246
243
|
}))
|
|
247
|
-
}), true);
|
|
244
|
+
}), { internal: true });
|
|
248
245
|
for (let i = 0; i < files2.length; i++) {
|
|
249
246
|
const writable = import_writableStream.WritableStream.from(writableStreams[i]);
|
|
250
247
|
await platform.streamFile(files2[i], writable.stream());
|
package/lib/client/fetch.js
CHANGED
|
@@ -32,6 +32,7 @@ var import_assert = require("../utils/isomorphic/assert");
|
|
|
32
32
|
var import_fileUtils = require("./fileUtils");
|
|
33
33
|
var import_headers = require("../utils/isomorphic/headers");
|
|
34
34
|
var import_rtti = require("../utils/isomorphic/rtti");
|
|
35
|
+
var import_timeoutSettings = require("./timeoutSettings");
|
|
35
36
|
class APIRequest {
|
|
36
37
|
constructor(playwright) {
|
|
37
38
|
this._contexts = /* @__PURE__ */ new Set();
|
|
@@ -40,7 +41,6 @@ class APIRequest {
|
|
|
40
41
|
async newContext(options = {}) {
|
|
41
42
|
options = {
|
|
42
43
|
...this._playwright._defaultContextOptions,
|
|
43
|
-
timeout: this._playwright._defaultContextTimeout,
|
|
44
44
|
...options
|
|
45
45
|
};
|
|
46
46
|
const storageState = typeof options.storageState === "string" ? JSON.parse(await this._playwright._platform.fs().promises.readFile(options.storageState, "utf8")) : options.storageState;
|
|
@@ -54,6 +54,7 @@ class APIRequest {
|
|
|
54
54
|
})).request);
|
|
55
55
|
this._contexts.add(context);
|
|
56
56
|
context._request = this;
|
|
57
|
+
context._timeoutSettings.setDefaultTimeout(options.timeout ?? this._playwright._defaultContextTimeout);
|
|
57
58
|
context._tracing._tracesDir = this._playwright._defaultLaunchOptions?.tracesDir;
|
|
58
59
|
await context._instrumentation.runAfterCreateRequestContext(context);
|
|
59
60
|
return context;
|
|
@@ -66,6 +67,7 @@ class APIRequestContext extends import_channelOwner.ChannelOwner {
|
|
|
66
67
|
constructor(parent, type, guid, initializer) {
|
|
67
68
|
super(parent, type, guid, initializer);
|
|
68
69
|
this._tracing = import_tracing.Tracing.from(initializer.tracing);
|
|
70
|
+
this._timeoutSettings = new import_timeoutSettings.TimeoutSettings(this._platform);
|
|
69
71
|
}
|
|
70
72
|
async [Symbol.asyncDispose]() {
|
|
71
73
|
await this.dispose();
|
|
@@ -205,7 +207,7 @@ class APIRequestContext extends import_channelOwner.ChannelOwner {
|
|
|
205
207
|
jsonData,
|
|
206
208
|
formData,
|
|
207
209
|
multipartData,
|
|
208
|
-
timeout:
|
|
210
|
+
timeout: this._timeoutSettings.timeout(options),
|
|
209
211
|
failOnStatusCode: options.failOnStatusCode,
|
|
210
212
|
ignoreHTTPSErrors: options.ignoreHTTPSErrors,
|
|
211
213
|
maxRedirects: options.maxRedirects,
|
|
@@ -288,7 +290,7 @@ class APIResponse {
|
|
|
288
290
|
throw new Error("Response has been disposed");
|
|
289
291
|
throw e;
|
|
290
292
|
}
|
|
291
|
-
}, true);
|
|
293
|
+
}, { internal: true });
|
|
292
294
|
}
|
|
293
295
|
async text() {
|
|
294
296
|
const content = await this.body();
|
package/lib/client/frame.js
CHANGED
|
@@ -45,6 +45,7 @@ var import_waiter = require("./waiter");
|
|
|
45
45
|
var import_assert = require("../utils/isomorphic/assert");
|
|
46
46
|
var import_locatorUtils = require("../utils/isomorphic/locatorUtils");
|
|
47
47
|
var import_urlMatch = require("../utils/isomorphic/urlMatch");
|
|
48
|
+
var import_timeoutSettings = require("./timeoutSettings");
|
|
48
49
|
class Frame extends import_channelOwner.ChannelOwner {
|
|
49
50
|
constructor(parent, type, guid, initializer) {
|
|
50
51
|
super(parent, type, guid, initializer);
|
|
@@ -90,9 +91,17 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
90
91
|
page() {
|
|
91
92
|
return this._page;
|
|
92
93
|
}
|
|
94
|
+
_timeout(options) {
|
|
95
|
+
const timeoutSettings = this._page?._timeoutSettings || new import_timeoutSettings.TimeoutSettings(this._platform);
|
|
96
|
+
return timeoutSettings.timeout(options || {});
|
|
97
|
+
}
|
|
98
|
+
_navigationTimeout(options) {
|
|
99
|
+
const timeoutSettings = this._page?._timeoutSettings || new import_timeoutSettings.TimeoutSettings(this._platform);
|
|
100
|
+
return timeoutSettings.navigationTimeout(options || {});
|
|
101
|
+
}
|
|
93
102
|
async goto(url, options = {}) {
|
|
94
103
|
const waitUntil = verifyLoadState("waitUntil", options.waitUntil === void 0 ? "load" : options.waitUntil);
|
|
95
|
-
return network.Response.fromNullable((await this._channel.goto({ url, ...options, waitUntil })).response);
|
|
104
|
+
return network.Response.fromNullable((await this._channel.goto({ url, ...options, waitUntil, timeout: this._navigationTimeout(options) })).response);
|
|
96
105
|
}
|
|
97
106
|
_setupNavigationWaiter(options) {
|
|
98
107
|
const waiter = new import_waiter.Waiter(this._page, "");
|
|
@@ -132,7 +141,7 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
132
141
|
const response = request ? await waiter.waitForPromise(request._finalRequest()._internalResponse()) : null;
|
|
133
142
|
waiter.dispose();
|
|
134
143
|
return response;
|
|
135
|
-
});
|
|
144
|
+
}, { title: "Wait for navigation" });
|
|
136
145
|
}
|
|
137
146
|
async waitForLoadState(state = "load", options = {}) {
|
|
138
147
|
state = verifyLoadState("state", state);
|
|
@@ -147,7 +156,7 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
147
156
|
});
|
|
148
157
|
}
|
|
149
158
|
waiter.dispose();
|
|
150
|
-
});
|
|
159
|
+
}, { title: `Wait for load state "${state}"` });
|
|
151
160
|
}
|
|
152
161
|
async waitForURL(url, options = {}) {
|
|
153
162
|
if ((0, import_urlMatch.urlMatches)(this._page?.context()._options.baseURL, this.url(), url))
|
|
@@ -167,6 +176,10 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
167
176
|
const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg), isolatedContext });
|
|
168
177
|
return (0, import_jsHandle.parseResult)(result.value);
|
|
169
178
|
}
|
|
179
|
+
async _evaluateFunction(functionDeclaration) {
|
|
180
|
+
const result = await this._channel.evaluateExpression({ expression: functionDeclaration, isFunction: true, arg: (0, import_jsHandle.serializeArgument)(void 0) });
|
|
181
|
+
return (0, import_jsHandle.parseResult)(result.value);
|
|
182
|
+
}
|
|
170
183
|
async _evaluateExposeUtilityScript(pageFunction, arg) {
|
|
171
184
|
(0, import_jsHandle.assertMaxArguments)(arguments.length, 2);
|
|
172
185
|
const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
|
|
@@ -181,35 +194,35 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
181
194
|
throw new Error("options.visibility is not supported, did you mean options.state?");
|
|
182
195
|
if (options.waitFor && options.waitFor !== "visible")
|
|
183
196
|
throw new Error("options.waitFor is not supported, did you mean options.state?");
|
|
184
|
-
const result = await this._channel.waitForSelector({ selector, ...options });
|
|
197
|
+
const result = await this._channel.waitForSelector({ selector, ...options, timeout: this._timeout(options) });
|
|
185
198
|
return import_elementHandle.ElementHandle.fromNullable(result.element);
|
|
186
199
|
}
|
|
187
200
|
async dispatchEvent(selector, type, eventInit, options = {}) {
|
|
188
|
-
await this._channel.dispatchEvent({ selector, type, eventInit: (0, import_jsHandle.serializeArgument)(eventInit), ...options });
|
|
201
|
+
await this._channel.dispatchEvent({ selector, type, eventInit: (0, import_jsHandle.serializeArgument)(eventInit), ...options, timeout: this._timeout(options) });
|
|
189
202
|
}
|
|
190
203
|
async $eval(selector, pageFunction, arg) {
|
|
191
204
|
(0, import_jsHandle.assertMaxArguments)(arguments.length, 3);
|
|
192
205
|
const result = await this._channel.evalOnSelector({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
|
|
193
206
|
return (0, import_jsHandle.parseResult)(result.value);
|
|
194
207
|
}
|
|
195
|
-
async $$eval(selector, pageFunction, arg) {
|
|
196
|
-
(0, import_jsHandle.assertMaxArguments)(arguments.length,
|
|
197
|
-
const result = await this._channel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
|
|
208
|
+
async $$eval(selector, pageFunction, arg, isolatedContext = true) {
|
|
209
|
+
(0, import_jsHandle.assertMaxArguments)(arguments.length, 4);
|
|
210
|
+
const result = await this._channel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg), isolatedContext });
|
|
198
211
|
return (0, import_jsHandle.parseResult)(result.value);
|
|
199
212
|
}
|
|
200
213
|
async $$(selector) {
|
|
201
214
|
const result = await this._channel.querySelectorAll({ selector });
|
|
202
215
|
return result.elements.map((e) => import_elementHandle.ElementHandle.from(e));
|
|
203
216
|
}
|
|
204
|
-
async _queryCount(selector) {
|
|
205
|
-
return (await this._channel.queryCount({ selector })).value;
|
|
217
|
+
async _queryCount(selector, options) {
|
|
218
|
+
return (await this._channel.queryCount({ selector, ...options })).value;
|
|
206
219
|
}
|
|
207
220
|
async content() {
|
|
208
221
|
return (await this._channel.content()).value;
|
|
209
222
|
}
|
|
210
223
|
async setContent(html, options = {}) {
|
|
211
224
|
const waitUntil = verifyLoadState("waitUntil", options.waitUntil === void 0 ? "load" : options.waitUntil);
|
|
212
|
-
await this._channel.setContent({ html, ...options, waitUntil });
|
|
225
|
+
await this._channel.setContent({ html, ...options, waitUntil, timeout: this._navigationTimeout(options) });
|
|
213
226
|
}
|
|
214
227
|
name() {
|
|
215
228
|
return this._name || "";
|
|
@@ -243,19 +256,19 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
243
256
|
return import_elementHandle.ElementHandle.from((await this._channel.addStyleTag({ ...copy })).element);
|
|
244
257
|
}
|
|
245
258
|
async click(selector, options = {}) {
|
|
246
|
-
return await this._channel.click({ selector, ...options });
|
|
259
|
+
return await this._channel.click({ selector, ...options, timeout: this._timeout(options) });
|
|
247
260
|
}
|
|
248
261
|
async dblclick(selector, options = {}) {
|
|
249
|
-
return await this._channel.dblclick({ selector, ...options });
|
|
262
|
+
return await this._channel.dblclick({ selector, ...options, timeout: this._timeout(options) });
|
|
250
263
|
}
|
|
251
264
|
async dragAndDrop(source, target, options = {}) {
|
|
252
|
-
return await this._channel.dragAndDrop({ source, target, ...options });
|
|
265
|
+
return await this._channel.dragAndDrop({ source, target, ...options, timeout: this._timeout(options) });
|
|
253
266
|
}
|
|
254
267
|
async tap(selector, options = {}) {
|
|
255
|
-
return await this._channel.tap({ selector, ...options });
|
|
268
|
+
return await this._channel.tap({ selector, ...options, timeout: this._timeout(options) });
|
|
256
269
|
}
|
|
257
270
|
async fill(selector, value, options = {}) {
|
|
258
|
-
return await this._channel.fill({ selector, value, ...options });
|
|
271
|
+
return await this._channel.fill({ selector, value, ...options, timeout: this._timeout(options) });
|
|
259
272
|
}
|
|
260
273
|
async _highlight(selector) {
|
|
261
274
|
return await this._channel.highlight({ selector });
|
|
@@ -288,36 +301,36 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
288
301
|
return new import_locator.FrameLocator(this, selector);
|
|
289
302
|
}
|
|
290
303
|
async focus(selector, options = {}) {
|
|
291
|
-
await this._channel.focus({ selector, ...options });
|
|
304
|
+
await this._channel.focus({ selector, ...options, timeout: this._timeout(options) });
|
|
292
305
|
}
|
|
293
306
|
async textContent(selector, options = {}) {
|
|
294
|
-
const value = (await this._channel.textContent({ selector, ...options })).value;
|
|
307
|
+
const value = (await this._channel.textContent({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
295
308
|
return value === void 0 ? null : value;
|
|
296
309
|
}
|
|
297
310
|
async innerText(selector, options = {}) {
|
|
298
|
-
return (await this._channel.innerText({ selector, ...options })).value;
|
|
311
|
+
return (await this._channel.innerText({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
299
312
|
}
|
|
300
313
|
async innerHTML(selector, options = {}) {
|
|
301
|
-
return (await this._channel.innerHTML({ selector, ...options })).value;
|
|
314
|
+
return (await this._channel.innerHTML({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
302
315
|
}
|
|
303
316
|
async getAttribute(selector, name, options = {}) {
|
|
304
|
-
const value = (await this._channel.getAttribute({ selector, name, ...options })).value;
|
|
317
|
+
const value = (await this._channel.getAttribute({ selector, name, ...options, timeout: this._timeout(options) })).value;
|
|
305
318
|
return value === void 0 ? null : value;
|
|
306
319
|
}
|
|
307
320
|
async inputValue(selector, options = {}) {
|
|
308
|
-
return (await this._channel.inputValue({ selector, ...options })).value;
|
|
321
|
+
return (await this._channel.inputValue({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
309
322
|
}
|
|
310
323
|
async isChecked(selector, options = {}) {
|
|
311
|
-
return (await this._channel.isChecked({ selector, ...options })).value;
|
|
324
|
+
return (await this._channel.isChecked({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
312
325
|
}
|
|
313
326
|
async isDisabled(selector, options = {}) {
|
|
314
|
-
return (await this._channel.isDisabled({ selector, ...options })).value;
|
|
327
|
+
return (await this._channel.isDisabled({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
315
328
|
}
|
|
316
329
|
async isEditable(selector, options = {}) {
|
|
317
|
-
return (await this._channel.isEditable({ selector, ...options })).value;
|
|
330
|
+
return (await this._channel.isEditable({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
318
331
|
}
|
|
319
332
|
async isEnabled(selector, options = {}) {
|
|
320
|
-
return (await this._channel.isEnabled({ selector, ...options })).value;
|
|
333
|
+
return (await this._channel.isEnabled({ selector, ...options, timeout: this._timeout(options) })).value;
|
|
321
334
|
}
|
|
322
335
|
async isHidden(selector, options = {}) {
|
|
323
336
|
return (await this._channel.isHidden({ selector, ...options })).value;
|
|
@@ -326,26 +339,26 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
326
339
|
return (await this._channel.isVisible({ selector, ...options })).value;
|
|
327
340
|
}
|
|
328
341
|
async hover(selector, options = {}) {
|
|
329
|
-
await this._channel.hover({ selector, ...options });
|
|
342
|
+
await this._channel.hover({ selector, ...options, timeout: this._timeout(options) });
|
|
330
343
|
}
|
|
331
344
|
async selectOption(selector, values, options = {}) {
|
|
332
|
-
return (await this._channel.selectOption({ selector, ...(0, import_elementHandle.convertSelectOptionValues)(values), ...options })).values;
|
|
345
|
+
return (await this._channel.selectOption({ selector, ...(0, import_elementHandle.convertSelectOptionValues)(values), ...options, timeout: this._timeout(options) })).values;
|
|
333
346
|
}
|
|
334
347
|
async setInputFiles(selector, files, options = {}) {
|
|
335
348
|
const converted = await (0, import_elementHandle.convertInputFiles)(this._platform, files, this.page().context());
|
|
336
|
-
await this._channel.setInputFiles({ selector, ...converted, ...options });
|
|
349
|
+
await this._channel.setInputFiles({ selector, ...converted, ...options, timeout: this._timeout(options) });
|
|
337
350
|
}
|
|
338
351
|
async type(selector, text, options = {}) {
|
|
339
|
-
await this._channel.type({ selector, text, ...options });
|
|
352
|
+
await this._channel.type({ selector, text, ...options, timeout: this._timeout(options) });
|
|
340
353
|
}
|
|
341
354
|
async press(selector, key, options = {}) {
|
|
342
|
-
await this._channel.press({ selector, key, ...options });
|
|
355
|
+
await this._channel.press({ selector, key, ...options, timeout: this._timeout(options) });
|
|
343
356
|
}
|
|
344
357
|
async check(selector, options = {}) {
|
|
345
|
-
await this._channel.check({ selector, ...options });
|
|
358
|
+
await this._channel.check({ selector, ...options, timeout: this._timeout(options) });
|
|
346
359
|
}
|
|
347
360
|
async uncheck(selector, options = {}) {
|
|
348
|
-
await this._channel.uncheck({ selector, ...options });
|
|
361
|
+
await this._channel.uncheck({ selector, ...options, timeout: this._timeout(options) });
|
|
349
362
|
}
|
|
350
363
|
async setChecked(selector, checked, options) {
|
|
351
364
|
if (checked)
|
|
@@ -354,7 +367,7 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
354
367
|
await this.uncheck(selector, options);
|
|
355
368
|
}
|
|
356
369
|
async waitForTimeout(timeout) {
|
|
357
|
-
await this._channel.waitForTimeout({ timeout });
|
|
370
|
+
await this._channel.waitForTimeout({ waitTimeout: timeout });
|
|
358
371
|
}
|
|
359
372
|
async waitForFunction(pageFunction, arg, options = {}) {
|
|
360
373
|
if (typeof options.polling === "string")
|
|
@@ -364,13 +377,22 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
364
377
|
pollingInterval: options.polling === "raf" ? void 0 : options.polling,
|
|
365
378
|
expression: String(pageFunction),
|
|
366
379
|
isFunction: typeof pageFunction === "function",
|
|
367
|
-
arg: (0, import_jsHandle.serializeArgument)(arg)
|
|
380
|
+
arg: (0, import_jsHandle.serializeArgument)(arg),
|
|
381
|
+
timeout: this._timeout(options)
|
|
368
382
|
});
|
|
369
383
|
return import_jsHandle.JSHandle.from(result.handle);
|
|
370
384
|
}
|
|
371
385
|
async title() {
|
|
372
386
|
return (await this._channel.title()).value;
|
|
373
387
|
}
|
|
388
|
+
async _expect(expression, options) {
|
|
389
|
+
const params = { expression, ...options, isNot: !!options.isNot };
|
|
390
|
+
params.expectedValue = (0, import_jsHandle.serializeArgument)(options.expectedValue);
|
|
391
|
+
const result = await this._channel.expect(params);
|
|
392
|
+
if (result.received !== void 0)
|
|
393
|
+
result.received = (0, import_jsHandle.parseResult)(result.received);
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
374
396
|
}
|
|
375
397
|
function verifyLoadState(name, waitUntil) {
|
|
376
398
|
if (waitUntil === "networkidle0")
|
package/lib/client/input.js
CHANGED
|
@@ -60,7 +60,9 @@ class Mouse {
|
|
|
60
60
|
await this._page._channel.mouseClick({ x, y, ...options });
|
|
61
61
|
}
|
|
62
62
|
async dblclick(x, y, options = {}) {
|
|
63
|
-
await this.
|
|
63
|
+
await this._page._wrapApiCall(async () => {
|
|
64
|
+
await this.click(x, y, { ...options, clickCount: 2 });
|
|
65
|
+
}, { title: "Double click" });
|
|
64
66
|
}
|
|
65
67
|
async wheel(deltaX, deltaY) {
|
|
66
68
|
await this._page._channel.mouseWheel({ deltaX, deltaY });
|
package/lib/client/jsHandle.js
CHANGED
|
@@ -40,6 +40,10 @@ class JSHandle extends import_channelOwner.ChannelOwner {
|
|
|
40
40
|
const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: serializeArgument(arg), isolatedContext });
|
|
41
41
|
return parseResult(result.value);
|
|
42
42
|
}
|
|
43
|
+
async _evaluateFunction(functionDeclaration) {
|
|
44
|
+
const result = await this._channel.evaluateExpression({ expression: functionDeclaration, isFunction: true, arg: serializeArgument(void 0) });
|
|
45
|
+
return parseResult(result.value);
|
|
46
|
+
}
|
|
43
47
|
async evaluateHandle(pageFunction, arg, isolatedContext = true) {
|
|
44
48
|
const result = await this._channel.evaluateExpressionHandle({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: serializeArgument(arg), isolatedContext });
|
|
45
49
|
return JSHandle.from(result.handle);
|
package/lib/client/localUtils.js
CHANGED
|
@@ -25,7 +25,6 @@ var import_channelOwner = require("./channelOwner");
|
|
|
25
25
|
class LocalUtils extends import_channelOwner.ChannelOwner {
|
|
26
26
|
constructor(parent, type, guid, initializer) {
|
|
27
27
|
super(parent, type, guid, initializer);
|
|
28
|
-
this.markAsInternalType();
|
|
29
28
|
this.devices = {};
|
|
30
29
|
for (const { name, descriptor } of initializer.deviceDescriptors)
|
|
31
30
|
this.devices[name] = descriptor;
|
package/lib/client/locator.js
CHANGED
|
@@ -26,7 +26,6 @@ __export(locator_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(locator_exports);
|
|
27
27
|
var import_jsHandle = require("./jsHandle");
|
|
28
28
|
var import_elementHandle = require("./elementHandle");
|
|
29
|
-
var import_jsHandle2 = require("./jsHandle");
|
|
30
29
|
var import_locatorGenerators = require("../utils/isomorphic/locatorGenerators");
|
|
31
30
|
var import_locatorUtils = require("../utils/isomorphic/locatorUtils");
|
|
32
31
|
var import_stringUtils = require("../utils/isomorphic/stringUtils");
|
|
@@ -57,8 +56,8 @@ class Locator {
|
|
|
57
56
|
if (this._frame._platform.inspectCustom)
|
|
58
57
|
this[this._frame._platform.inspectCustom] = () => this._inspect();
|
|
59
58
|
}
|
|
60
|
-
async _withElement(task,
|
|
61
|
-
timeout = this._frame.
|
|
59
|
+
async _withElement(task, options) {
|
|
60
|
+
const timeout = this._frame._timeout({ timeout: options.timeout });
|
|
62
61
|
const deadline = timeout ? (0, import_time.monotonicTime)() + timeout : 0;
|
|
63
62
|
return await this._frame._wrapApiCall(async () => {
|
|
64
63
|
const result = await this._frame._channel.waitForSelector({ selector: this._selector, strict: true, state: "attached", timeout });
|
|
@@ -70,7 +69,7 @@ class Locator {
|
|
|
70
69
|
} finally {
|
|
71
70
|
await handle.dispose();
|
|
72
71
|
}
|
|
73
|
-
});
|
|
72
|
+
}, { title: options.title, internal: options.internal });
|
|
74
73
|
}
|
|
75
74
|
_equals(locator) {
|
|
76
75
|
return this._frame === locator._frame && this._selector === locator._selector;
|
|
@@ -79,7 +78,7 @@ class Locator {
|
|
|
79
78
|
return this._frame.page();
|
|
80
79
|
}
|
|
81
80
|
async boundingBox(options) {
|
|
82
|
-
return await this._withElement((h) => h.boundingBox(), options?.timeout);
|
|
81
|
+
return await this._withElement((h) => h.boundingBox(), { title: "Bounding box", timeout: options?.timeout });
|
|
83
82
|
}
|
|
84
83
|
async check(options = {}) {
|
|
85
84
|
return await this._frame.check(this._selector, { strict: true, ...options });
|
|
@@ -88,7 +87,7 @@ class Locator {
|
|
|
88
87
|
return await this._frame.click(this._selector, { strict: true, ...options });
|
|
89
88
|
}
|
|
90
89
|
async dblclick(options = {}) {
|
|
91
|
-
|
|
90
|
+
await this._frame.dblclick(this._selector, { strict: true, ...options });
|
|
92
91
|
}
|
|
93
92
|
async dispatchEvent(type, eventInit = {}, options) {
|
|
94
93
|
return await this._frame.dispatchEvent(this._selector, type, eventInit, { strict: true, ...options });
|
|
@@ -101,19 +100,22 @@ class Locator {
|
|
|
101
100
|
}
|
|
102
101
|
async evaluate(pageFunction, arg, options, isolatedContext = true) {
|
|
103
102
|
return await this._withElement(
|
|
104
|
-
async (h) =>
|
|
103
|
+
async (h) => parseResult(
|
|
105
104
|
(await h._channel.evaluateExpression({
|
|
106
105
|
expression: String(pageFunction),
|
|
107
106
|
isFunction: typeof pageFunction === "function",
|
|
108
|
-
arg:
|
|
107
|
+
arg: serializeArgument(arg),
|
|
109
108
|
isolatedContext
|
|
110
109
|
})).value
|
|
111
110
|
),
|
|
112
111
|
options?.timeout
|
|
113
112
|
);
|
|
114
113
|
}
|
|
115
|
-
async
|
|
116
|
-
return await this.
|
|
114
|
+
async _evaluateFunction(functionDeclaration, options) {
|
|
115
|
+
return await this._withElement((h) => h._evaluateFunction(functionDeclaration), { title: "Evaluate", timeout: options?.timeout });
|
|
116
|
+
}
|
|
117
|
+
async evaluateAll(pageFunction, arg, isolatedContext = true) {
|
|
118
|
+
return await this._frame.$$eval(this._selector, pageFunction, arg, isolatedContext);
|
|
117
119
|
}
|
|
118
120
|
async evaluateHandle(pageFunction, arg, options, isolatedContext = true) {
|
|
119
121
|
return await this._withElement(
|
|
@@ -121,7 +123,7 @@ class Locator {
|
|
|
121
123
|
(await h._channel.evaluateExpressionHandle({
|
|
122
124
|
expression: String(pageFunction),
|
|
123
125
|
isFunction: typeof pageFunction === "function",
|
|
124
|
-
arg:
|
|
126
|
+
arg: serializeArgument(arg),
|
|
125
127
|
isolatedContext
|
|
126
128
|
})).handle
|
|
127
129
|
),
|
|
@@ -132,7 +134,7 @@ class Locator {
|
|
|
132
134
|
return await this._frame.fill(this._selector, value, { strict: true, ...options });
|
|
133
135
|
}
|
|
134
136
|
async clear(options = {}) {
|
|
135
|
-
|
|
137
|
+
await this._frame._wrapApiCall(() => this.fill("", options), { title: "Clear" });
|
|
136
138
|
}
|
|
137
139
|
async _highlight() {
|
|
138
140
|
return await this._frame._highlight(this._selector);
|
|
@@ -183,6 +185,9 @@ class Locator {
|
|
|
183
185
|
contentFrame() {
|
|
184
186
|
return new FrameLocator(this._frame, this._selector);
|
|
185
187
|
}
|
|
188
|
+
describe(description) {
|
|
189
|
+
return new Locator(this._frame, this._selector + " >> internal:describe=" + JSON.stringify(description));
|
|
190
|
+
}
|
|
186
191
|
first() {
|
|
187
192
|
return new Locator(this._frame, this._selector + " >> nth=0");
|
|
188
193
|
}
|
|
@@ -206,13 +211,14 @@ class Locator {
|
|
|
206
211
|
return await this._frame.focus(this._selector, { strict: true, ...options });
|
|
207
212
|
}
|
|
208
213
|
async blur(options) {
|
|
209
|
-
await this._frame._channel.blur({ selector: this._selector, strict: true, ...options });
|
|
214
|
+
await this._frame._channel.blur({ selector: this._selector, strict: true, ...options, timeout: this._frame._timeout(options) });
|
|
210
215
|
}
|
|
211
|
-
|
|
212
|
-
|
|
216
|
+
// options are only here for testing
|
|
217
|
+
async count(_options) {
|
|
218
|
+
return await this._frame._queryCount(this._selector, _options);
|
|
213
219
|
}
|
|
214
|
-
async
|
|
215
|
-
return await this.
|
|
220
|
+
async _resolveSelector() {
|
|
221
|
+
return await this._frame._channel.resolveSelector({ selector: this._selector });
|
|
216
222
|
}
|
|
217
223
|
async getAttribute(name, options) {
|
|
218
224
|
return await this._frame.getAttribute(this._selector, name, { strict: true, ...options });
|
|
@@ -252,20 +258,20 @@ class Locator {
|
|
|
252
258
|
}
|
|
253
259
|
async screenshot(options = {}) {
|
|
254
260
|
const mask = options.mask;
|
|
255
|
-
return await this._withElement((h, timeout) => h.screenshot({ ...options, mask, timeout }), options.timeout);
|
|
261
|
+
return await this._withElement((h, timeout) => h.screenshot({ ...options, mask, timeout }), { title: "Screenshot", timeout: options.timeout });
|
|
256
262
|
}
|
|
257
263
|
async ariaSnapshot(options) {
|
|
258
|
-
const result = await this._frame._channel.ariaSnapshot({ ...options,
|
|
264
|
+
const result = await this._frame._channel.ariaSnapshot({ ...options, selector: this._selector, timeout: this._frame._timeout(options) });
|
|
259
265
|
return result.snapshot;
|
|
260
266
|
}
|
|
261
267
|
async scrollIntoViewIfNeeded(options = {}) {
|
|
262
|
-
return await this._withElement((h, timeout) => h.scrollIntoViewIfNeeded({ ...options, timeout }), options.timeout);
|
|
268
|
+
return await this._withElement((h, timeout) => h.scrollIntoViewIfNeeded({ ...options, timeout }), { title: "Scroll into view", timeout: options.timeout });
|
|
263
269
|
}
|
|
264
270
|
async selectOption(values, options = {}) {
|
|
265
271
|
return await this._frame.selectOption(this._selector, values, { strict: true, ...options });
|
|
266
272
|
}
|
|
267
273
|
async selectText(options = {}) {
|
|
268
|
-
return await this._withElement((h, timeout) => h.selectText({ ...options, timeout }), options.timeout);
|
|
274
|
+
return await this._withElement((h, timeout) => h.selectText({ ...options, timeout }), { title: "Select text", timeout: options.timeout });
|
|
269
275
|
}
|
|
270
276
|
async setChecked(checked, options) {
|
|
271
277
|
if (checked)
|
|
@@ -301,15 +307,13 @@ class Locator {
|
|
|
301
307
|
return await this._frame.$$eval(this._selector, (ee) => ee.map((e) => e.textContent || ""));
|
|
302
308
|
}
|
|
303
309
|
async waitFor(options) {
|
|
304
|
-
await this._frame._channel.waitForSelector({ selector: this._selector, strict: true, omitReturnValue: true, ...options });
|
|
310
|
+
await this._frame._channel.waitForSelector({ selector: this._selector, strict: true, omitReturnValue: true, ...options, timeout: this._frame._timeout(options) });
|
|
305
311
|
}
|
|
306
312
|
async _expect(expression, options) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
result.received = (0, import_jsHandle2.parseResult)(result.received);
|
|
312
|
-
return result;
|
|
313
|
+
return this._frame._expect(expression, {
|
|
314
|
+
...options,
|
|
315
|
+
selector: this._selector
|
|
316
|
+
});
|
|
313
317
|
}
|
|
314
318
|
_inspect() {
|
|
315
319
|
return this.toString();
|