rebrowser-playwright-core 1.49.1 → 1.52.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 +381 -55
- package/bin/reinstall_msedge_beta_linux.sh +6 -0
- package/bin/reinstall_msedge_dev_linux.sh +6 -0
- package/bin/reinstall_msedge_stable_linux.sh +6 -0
- package/browsers.json +28 -13
- package/index.js +0 -1
- package/lib/androidServerImpl.js +42 -48
- package/lib/browserServerImpl.js +60 -64
- package/lib/cli/driver.js +71 -69
- package/lib/cli/program.js +314 -354
- package/lib/cli/programWithTestStub.js +51 -44
- package/lib/client/accessibility.js +31 -32
- package/lib/client/android.js +146 -254
- package/lib/client/api.js +135 -283
- package/lib/client/artifact.js +39 -39
- package/lib/client/browser.js +59 -68
- package/lib/client/browserContext.js +302 -322
- package/lib/client/browserType.js +95 -143
- package/lib/client/cdpSession.js +29 -31
- package/lib/client/channelOwner.js +109 -139
- package/lib/client/clientHelper.js +49 -42
- package/lib/client/clientInstrumentation.js +40 -35
- package/lib/client/clientStackTrace.js +69 -0
- package/lib/client/clock.js +36 -36
- package/lib/client/connection.js +203 -218
- package/lib/client/consoleMessage.js +33 -33
- package/lib/client/coverage.js +25 -22
- package/lib/client/dialog.js +30 -31
- package/lib/client/download.js +25 -25
- package/lib/client/electron.js +74 -76
- package/lib/client/elementHandle.js +126 -163
- package/lib/client/errors.js +53 -53
- package/lib/client/eventEmitter.js +127 -127
- package/lib/client/events.js +72 -68
- package/lib/client/fetch.js +154 -178
- package/lib/client/fileChooser.js +25 -24
- package/lib/client/fileUtils.js +34 -0
- package/lib/client/frame.js +189 -307
- package/lib/client/harRouter.js +44 -56
- package/lib/client/input.js +40 -69
- package/lib/client/jsHandle.js +55 -71
- package/lib/client/jsonPipe.js +27 -23
- package/lib/client/localUtils.js +53 -28
- package/lib/client/locator.js +144 -230
- package/lib/client/network.js +285 -301
- package/lib/client/page.js +273 -312
- package/lib/client/platform.js +74 -0
- package/lib/client/playwright.js +62 -57
- package/lib/client/selectors.js +51 -43
- package/lib/client/stream.js +30 -45
- package/lib/client/timeoutSettings.js +75 -0
- package/lib/client/tracing.js +49 -82
- package/lib/client/types.js +26 -22
- package/lib/client/video.js +35 -27
- package/lib/client/waiter.js +71 -91
- package/lib/client/webError.js +25 -23
- package/lib/client/webSocket.js +111 -0
- package/lib/client/worker.js +48 -56
- package/lib/client/writableStream.js +28 -43
- package/lib/generated/clockSource.js +26 -5
- package/lib/generated/consoleApiSource.js +26 -5
- package/lib/generated/injectedScriptSource.js +26 -5
- package/lib/generated/pollingRecorderSource.js +26 -5
- package/lib/generated/utilityScriptSource.js +26 -5
- package/lib/generated/webSocketMockSource.js +375 -4
- package/lib/inProcessFactory.js +53 -48
- package/lib/inprocess.js +2 -19
- package/lib/outofprocess.js +53 -42
- package/lib/protocol/debug.js +209 -25
- package/lib/protocol/serializers.js +153 -134
- package/lib/protocol/validator.js +2712 -2667
- package/lib/protocol/validatorPrimitives.js +115 -75
- package/lib/remote/playwrightConnection.js +144 -152
- package/lib/remote/playwrightServer.js +106 -77
- package/lib/server/accessibility.js +44 -37
- package/lib/server/android/android.js +216 -206
- package/lib/server/android/backendAdb.js +89 -82
- package/lib/server/artifact.js +78 -55
- package/lib/server/bidi/bidiBrowser.js +227 -158
- package/lib/server/bidi/bidiChromium.js +106 -78
- package/lib/server/bidi/bidiConnection.js +66 -83
- package/lib/server/bidi/bidiExecutionContext.js +161 -97
- package/lib/server/bidi/bidiFirefox.js +76 -68
- package/lib/server/bidi/bidiInput.js +90 -102
- package/lib/server/bidi/bidiNetworkManager.js +141 -159
- package/lib/server/bidi/bidiOverCdp.js +57 -58
- package/lib/server/bidi/bidiPage.js +262 -261
- package/lib/server/bidi/bidiPdf.js +52 -86
- package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/lib/server/bidi/third_party/bidiDeserializer.js +55 -50
- package/lib/server/bidi/third_party/bidiKeyboard.js +241 -223
- package/lib/server/bidi/third_party/bidiProtocol.js +144 -131
- package/lib/server/bidi/third_party/bidiSerializer.js +67 -63
- package/lib/server/bidi/third_party/firefoxPrefs.js +149 -111
- package/lib/server/browser.js +76 -84
- package/lib/server/browserContext.js +343 -360
- package/lib/server/browserType.js +169 -181
- package/lib/server/callLog.js +82 -0
- package/lib/server/chromium/chromium.js +212 -190
- package/lib/server/chromium/chromiumSwitches.js +99 -44
- package/lib/server/chromium/crAccessibility.js +157 -131
- package/lib/server/chromium/crBrowser.js +262 -280
- package/lib/server/chromium/crConnection.js +121 -178
- package/lib/server/chromium/crCoverage.js +113 -127
- package/lib/server/chromium/crDevTools.js +64 -55
- package/lib/server/chromium/crDragDrop.js +62 -79
- package/lib/server/chromium/crExecutionContext.js +100 -91
- package/lib/server/chromium/crInput.js +101 -88
- package/lib/server/chromium/crNetworkManager.js +269 -370
- package/lib/server/chromium/crPage.js +509 -597
- package/lib/server/chromium/crPdf.js +54 -86
- package/lib/server/chromium/crProtocolHelper.js +92 -80
- package/lib/server/chromium/crServiceWorker.js +85 -69
- package/lib/server/chromium/defaultFontFamilies.js +152 -135
- package/lib/server/chromium/protocol.d.js +16 -0
- package/lib/server/chromium/videoRecorder.js +65 -99
- package/lib/server/clock.js +58 -46
- package/lib/server/codegen/csharp.js +191 -156
- package/lib/server/codegen/java.js +163 -125
- package/lib/server/codegen/javascript.js +166 -143
- package/lib/server/codegen/jsonl.js +33 -29
- package/lib/server/codegen/language.js +75 -52
- package/lib/server/codegen/languages.js +65 -27
- package/lib/server/codegen/python.js +141 -125
- package/lib/server/codegen/types.js +15 -4
- package/lib/server/console.js +28 -32
- package/lib/server/cookieStore.js +105 -86
- package/lib/server/debugController.js +102 -154
- package/lib/server/debugger.js +82 -78
- package/lib/server/deviceDescriptors.js +37 -24
- package/lib/server/deviceDescriptorsSource.json +131 -131
- package/lib/server/dialog.js +36 -35
- package/lib/server/dispatchers/androidDispatcher.js +196 -107
- package/lib/server/dispatchers/artifactDispatcher.js +62 -62
- package/lib/server/dispatchers/browserContextDispatcher.js +177 -217
- package/lib/server/dispatchers/browserDispatcher.js +78 -97
- package/lib/server/dispatchers/browserTypeDispatcher.js +35 -35
- package/lib/server/dispatchers/cdpSessionDispatcher.js +32 -36
- package/lib/server/dispatchers/debugControllerDispatcher.js +48 -64
- package/lib/server/dispatchers/dialogDispatcher.js +30 -27
- package/lib/server/dispatchers/dispatcher.js +180 -229
- package/lib/server/dispatchers/electronDispatcher.js +54 -57
- package/lib/server/dispatchers/elementHandlerDispatcher.js +79 -116
- package/lib/server/dispatchers/frameDispatcher.js +93 -162
- package/lib/server/dispatchers/jsHandleDispatcher.js +49 -66
- package/lib/server/dispatchers/jsonPipeDispatcher.js +35 -36
- package/lib/server/dispatchers/localUtilsDispatcher.js +107 -365
- package/lib/server/dispatchers/networkDispatchers.js +92 -109
- package/lib/server/dispatchers/pageDispatcher.js +130 -169
- package/lib/server/dispatchers/playwrightDispatcher.js +69 -76
- package/lib/server/dispatchers/selectorsDispatcher.js +28 -24
- package/lib/server/dispatchers/streamDispatcher.js +42 -44
- package/lib/server/dispatchers/tracingDispatcher.js +36 -41
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +100 -135
- package/lib/server/dispatchers/writableStreamDispatcher.js +54 -39
- package/lib/server/dom.js +424 -443
- package/lib/server/download.js +45 -35
- package/lib/server/electron/electron.js +156 -175
- package/lib/server/electron/loader.js +8 -36
- package/lib/server/errors.js +47 -46
- package/lib/server/fetch.js +302 -331
- package/lib/server/fileChooser.js +25 -24
- package/lib/server/fileUploadUtils.js +66 -57
- package/lib/server/firefox/ffAccessibility.js +153 -131
- package/lib/server/firefox/ffBrowser.js +218 -274
- package/lib/server/firefox/ffConnection.js +63 -84
- package/lib/server/firefox/ffExecutionContext.js +103 -77
- package/lib/server/firefox/ffInput.js +72 -63
- package/lib/server/firefox/ffNetworkManager.js +131 -110
- package/lib/server/firefox/ffPage.js +244 -302
- package/lib/server/firefox/firefox.js +76 -69
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/formData.js +107 -35
- package/lib/server/frameSelectors.js +77 -111
- package/lib/server/frames.js +719 -855
- package/lib/server/har/harRecorder.js +85 -77
- package/lib/server/har/harTracer.js +288 -224
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +56 -59
- package/lib/server/index.js +59 -106
- package/lib/server/input.js +136 -166
- package/lib/server/instrumentation.js +49 -44
- package/lib/server/javascript.js +157 -151
- package/lib/server/launchApp.js +92 -73
- package/lib/server/localUtils.js +211 -0
- package/lib/server/macEditingCommands.js +141 -137
- package/lib/server/network.js +263 -297
- package/lib/server/page.js +351 -434
- package/lib/server/pageBinding.js +88 -0
- package/lib/server/pipeTransport.js +49 -45
- package/lib/server/playwright.js +60 -67
- package/lib/server/progress.js +56 -51
- package/lib/server/protocolError.js +34 -31
- package/lib/server/recorder/chat.js +161 -0
- package/lib/server/recorder/contextRecorder.js +135 -148
- package/lib/server/recorder/recorderApp.js +129 -132
- package/lib/server/recorder/recorderCollection.js +57 -57
- package/lib/server/recorder/recorderFrontend.js +15 -4
- package/lib/server/recorder/recorderRunner.js +80 -100
- package/lib/server/recorder/recorderUtils.js +59 -72
- package/lib/server/recorder/throttledFile.js +42 -31
- package/lib/server/recorder.js +186 -190
- package/lib/server/registry/browserFetcher.js +107 -100
- package/lib/server/registry/dependencies.js +247 -198
- package/lib/server/registry/index.js +928 -709
- package/lib/server/registry/nativeDeps.js +1073 -461
- package/lib/server/registry/oopDownloadBrowserMain.js +57 -75
- package/lib/server/screenshotter.js +166 -182
- package/lib/server/selectors.js +85 -46
- package/lib/server/socksClientCertificatesInterceptor.js +166 -185
- package/lib/server/socksInterceptor.js +62 -67
- package/lib/server/storageScript.js +154 -0
- package/lib/server/timeoutSettings.js +89 -0
- package/lib/server/trace/recorder/snapshotter.js +70 -88
- package/lib/server/trace/recorder/snapshotterInjected.js +246 -218
- package/lib/server/trace/recorder/tracing.js +324 -327
- package/lib/server/trace/test/inMemorySnapshotter.js +46 -52
- package/lib/server/trace/viewer/traceViewer.js +172 -137
- package/lib/server/transport.js +125 -133
- package/lib/server/types.js +26 -22
- package/lib/server/usKeyboardLayout.js +135 -545
- package/lib/server/utils/ascii.js +44 -0
- package/lib/server/utils/comparators.js +161 -0
- package/lib/server/utils/crypto.js +216 -0
- package/lib/server/utils/debug.js +47 -0
- package/lib/server/utils/debugLogger.js +114 -0
- package/lib/server/utils/env.js +68 -0
- package/lib/server/utils/eventsHelper.js +39 -0
- package/lib/server/utils/expectUtils.js +38 -0
- package/lib/server/utils/fileUtils.js +191 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +109 -0
- package/lib/server/utils/httpServer.js +218 -0
- package/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/lib/{image_tools → server/utils/image_tools}/compare.js +44 -43
- package/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/lib/{image_tools → server/utils/image_tools}/stats.js +40 -40
- package/lib/server/utils/linuxUtils.js +71 -0
- package/lib/server/utils/network.js +217 -0
- package/lib/server/utils/nodePlatform.js +148 -0
- package/lib/server/utils/pipeTransport.js +84 -0
- package/lib/server/utils/processLauncher.js +238 -0
- package/lib/server/utils/profiler.js +65 -0
- package/lib/server/utils/socksProxy.js +511 -0
- package/lib/server/utils/spawnAsync.js +41 -0
- package/lib/server/utils/task.js +51 -0
- package/lib/server/utils/userAgent.js +98 -0
- package/lib/server/utils/wsServer.js +132 -0
- package/lib/server/utils/zipFile.js +74 -0
- package/lib/server/utils/zones.js +57 -0
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/server/webkit/webkit.js +76 -63
- package/lib/server/webkit/wkAccessibility.js +161 -118
- package/lib/server/webkit/wkBrowser.js +163 -180
- package/lib/server/webkit/wkConnection.js +59 -83
- package/lib/server/webkit/wkExecutionContext.js +96 -73
- package/lib/server/webkit/wkInput.js +87 -75
- package/lib/server/webkit/wkInterceptableRequest.js +102 -95
- package/lib/server/webkit/wkPage.js +536 -647
- package/lib/server/webkit/wkProvisionalPage.js +45 -56
- package/lib/server/webkit/wkWorkers.js +77 -77
- package/lib/utils/isomorphic/ariaSnapshot.js +245 -128
- package/lib/utils/isomorphic/assert.js +31 -0
- package/lib/utils/isomorphic/builtins.js +90 -0
- package/lib/utils/isomorphic/colors.js +72 -0
- package/lib/utils/isomorphic/cssParser.js +123 -127
- package/lib/utils/isomorphic/cssTokenizer.js +436 -364
- package/lib/utils/isomorphic/headers.js +53 -0
- package/lib/utils/isomorphic/locatorGenerators.js +344 -349
- package/lib/utils/isomorphic/locatorParser.js +103 -106
- package/lib/utils/isomorphic/locatorUtils.js +63 -44
- package/lib/utils/isomorphic/manualPromise.js +115 -0
- package/lib/utils/isomorphic/mimeType.js +453 -22
- package/lib/utils/isomorphic/multimap.js +81 -0
- package/lib/utils/isomorphic/rtti.js +43 -0
- package/lib/utils/isomorphic/selectorParser.js +183 -193
- package/lib/utils/isomorphic/semaphore.js +54 -0
- package/lib/utils/isomorphic/stackTrace.js +158 -0
- package/lib/utils/isomorphic/stringUtils.js +113 -106
- package/lib/utils/isomorphic/time.js +44 -0
- package/lib/utils/isomorphic/timeoutRunner.js +67 -0
- package/lib/utils/isomorphic/traceUtils.js +52 -32
- package/lib/utils/isomorphic/types.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +114 -71
- package/lib/utils/isomorphic/utilityScriptSerializers.js +248 -0
- package/lib/utils.js +101 -0
- package/lib/utilsBundle.js +101 -76
- package/lib/utilsBundleImpl/index.js +114 -116
- package/lib/vite/htmlReport/index.html +26 -20
- package/lib/vite/recorder/assets/{codeMirrorModule-C5j27SYZ.js → codeMirrorModule-DVQi6prl.js} +13 -13
- package/lib/vite/recorder/assets/index-97EUAAbk.js +184 -0
- package/lib/vite/recorder/assets/{index-iA1aAGZg.css → index-eHBmevrY.css} +1 -1
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-DwAiTpyC.js +24 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-DkkRvn5X.js +265 -0
- package/lib/vite/traceViewer/assets/{xtermModule-BeNbaIVa.js → xtermModule-BoAIEibi.js} +7 -7
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +1 -0
- package/lib/vite/traceViewer/index.DvtSwn6E.js +2 -0
- package/lib/vite/traceViewer/index.html +4 -7
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/{uiMode.voC1ZiOQ.css → uiMode.BatfzHMG.css} +1 -1
- package/lib/vite/traceViewer/uiMode.Sdytl9wc.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +4 -7
- package/lib/zipBundle.js +32 -23
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +7 -7
- package/types/protocol.d.ts +819 -127
- package/types/types.d.ts +181 -69
- package/bin/PrintDeps.exe +0 -0
- package/bin/README.md +0 -2
- package/lib/common/socksProxy.js +0 -569
- package/lib/common/timeoutSettings.js +0 -73
- package/lib/common/types.js +0 -5
- package/lib/image_tools/colorUtils.js +0 -98
- package/lib/image_tools/imageChannel.js +0 -70
- package/lib/protocol/transport.js +0 -82
- package/lib/server/ariaSnapshot.js +0 -33
- package/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
- package/lib/server/recorder/recorderInTraceViewer.js +0 -144
- package/lib/utils/ascii.js +0 -31
- package/lib/utils/comparators.js +0 -153
- package/lib/utils/crypto.js +0 -171
- package/lib/utils/debug.js +0 -46
- package/lib/utils/debugLogger.js +0 -91
- package/lib/utils/env.js +0 -49
- package/lib/utils/eventsHelper.js +0 -38
- package/lib/utils/expectUtils.js +0 -33
- package/lib/utils/fileUtils.js +0 -205
- package/lib/utils/happy-eyeballs.js +0 -194
- package/lib/utils/headers.js +0 -52
- package/lib/utils/hostPlatform.js +0 -139
- package/lib/utils/httpServer.js +0 -237
- package/lib/utils/index.js +0 -368
- package/lib/utils/isomorphic/recorderUtils.js +0 -227
- package/lib/utils/linuxUtils.js +0 -78
- package/lib/utils/manualPromise.js +0 -109
- package/lib/utils/multimap.js +0 -75
- package/lib/utils/network.js +0 -160
- package/lib/utils/processLauncher.js +0 -248
- package/lib/utils/profiler.js +0 -53
- package/lib/utils/rtti.js +0 -44
- package/lib/utils/semaphore.js +0 -51
- package/lib/utils/sequence.js +0 -64
- package/lib/utils/spawnAsync.js +0 -45
- package/lib/utils/stackTrace.js +0 -134
- package/lib/utils/task.js +0 -58
- package/lib/utils/time.js +0 -37
- package/lib/utils/timeoutRunner.js +0 -66
- package/lib/utils/traceUtils.js +0 -44
- package/lib/utils/userAgent.js +0 -105
- package/lib/utils/wsServer.js +0 -127
- package/lib/utils/zipFile.js +0 -75
- package/lib/utils/zones.js +0 -71
- package/lib/vite/recorder/assets/index-m0XdVJHe.js +0 -184
- package/lib/vite/traceViewer/assets/codeMirrorModule-BBCX0spr.js +0 -24
- package/lib/vite/traceViewer/assets/inspectorTab-B4Iw34Ow.js +0 -68
- package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
- package/lib/vite/traceViewer/assets/workbench-DFlGYqou.js +0 -9
- package/lib/vite/traceViewer/embedded.CmarehFk.js +0 -2
- package/lib/vite/traceViewer/embedded.html +0 -18
- package/lib/vite/traceViewer/embedded.w7WN2u1R.css +0 -1
- package/lib/vite/traceViewer/index.FBucu_gE.js +0 -2
- package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +0 -1
- package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- package/lib/vite/traceViewer/recorder.CW_rzcEp.js +0 -2
- package/lib/vite/traceViewer/recorder.html +0 -17
- package/lib/vite/traceViewer/uiMode.CDUVjusr.js +0 -5
- package/lib/vite/traceViewer/workbench.C-zR9ysA.css +0 -1
- /package/lib/vite/recorder/assets/{codeMirrorModule-ez37Vkbh.css → codeMirrorModule-C3UTv-Ge.css} +0 -0
- /package/lib/vite/traceViewer/{codeMirrorModule.ez37Vkbh.css → codeMirrorModule.C3UTv-Ge.css} +0 -0
- /package/lib/vite/traceViewer/{index.CrbWWHbf.css → index.CFOW-Ezb.css} +0 -0
- /package/lib/vite/traceViewer/{xtermModule.DSXBckUd.css → xtermModule.Beg8tuEN.css} +0 -0
package/lib/client/locator.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var locator_exports = {};
|
|
20
|
+
__export(locator_exports, {
|
|
21
|
+
FrameLocator: () => FrameLocator,
|
|
22
|
+
Locator: () => Locator,
|
|
23
|
+
setTestIdAttribute: () => setTestIdAttribute,
|
|
24
|
+
testIdAttributeName: () => testIdAttributeName
|
|
5
25
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
|
|
15
|
-
let _util$inspect$custom;
|
|
16
|
-
/**
|
|
17
|
-
* Copyright (c) Microsoft Corporation.
|
|
18
|
-
*
|
|
19
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
-
* you may not use this file except in compliance with the License.
|
|
21
|
-
* You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
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); }
|
|
32
|
-
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; }
|
|
33
|
-
_util$inspect$custom = util.inspect.custom;
|
|
26
|
+
module.exports = __toCommonJS(locator_exports);
|
|
27
|
+
var import_elementHandle = require("./elementHandle");
|
|
28
|
+
var import_jsHandle = require("./jsHandle");
|
|
29
|
+
var import_locatorGenerators = require("../utils/isomorphic/locatorGenerators");
|
|
30
|
+
var import_locatorUtils = require("../utils/isomorphic/locatorUtils");
|
|
31
|
+
var import_stringUtils = require("../utils/isomorphic/stringUtils");
|
|
32
|
+
var import_rtti = require("../utils/isomorphic/rtti");
|
|
33
|
+
var import_time = require("../utils/isomorphic/time");
|
|
34
34
|
class Locator {
|
|
35
35
|
constructor(frame, selector, options) {
|
|
36
|
-
this._frame = void 0;
|
|
37
|
-
this._selector = void 0;
|
|
38
36
|
this._frame = frame;
|
|
39
37
|
this._selector = selector;
|
|
40
|
-
if (options
|
|
41
|
-
|
|
42
|
-
if (options
|
|
38
|
+
if (options?.hasText)
|
|
39
|
+
this._selector += ` >> internal:has-text=${(0, import_stringUtils.escapeForTextSelector)(options.hasText, false)}`;
|
|
40
|
+
if (options?.hasNotText)
|
|
41
|
+
this._selector += ` >> internal:has-not-text=${(0, import_stringUtils.escapeForTextSelector)(options.hasNotText, false)}`;
|
|
42
|
+
if (options?.has) {
|
|
43
43
|
const locator = options.has;
|
|
44
|
-
if (locator._frame !== frame)
|
|
44
|
+
if (locator._frame !== frame)
|
|
45
|
+
throw new Error(`Inner "has" locator must belong to the same frame.`);
|
|
45
46
|
this._selector += ` >> internal:has=` + JSON.stringify(locator._selector);
|
|
46
47
|
}
|
|
47
|
-
if (options
|
|
48
|
+
if (options?.hasNot) {
|
|
48
49
|
const locator = options.hasNot;
|
|
49
|
-
if (locator._frame !== frame)
|
|
50
|
+
if (locator._frame !== frame)
|
|
51
|
+
throw new Error(`Inner "hasNot" locator must belong to the same frame.`);
|
|
50
52
|
this._selector += ` >> internal:has-not=` + JSON.stringify(locator._selector);
|
|
51
53
|
}
|
|
54
|
+
if (options?.visible !== void 0)
|
|
55
|
+
this._selector += ` >> visible=${options.visible ? "true" : "false"}`;
|
|
56
|
+
if (this._frame._platform.inspectCustom)
|
|
57
|
+
this[this._frame._platform.inspectCustom] = () => this._inspect();
|
|
52
58
|
}
|
|
53
59
|
async _withElement(task, timeout) {
|
|
54
|
-
timeout = this._frame.page()._timeoutSettings.timeout({
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
const deadline = timeout ? (0, _utils.monotonicTime)() + timeout : 0;
|
|
60
|
+
timeout = this._frame.page()._timeoutSettings.timeout({ timeout });
|
|
61
|
+
const deadline = timeout ? (0, import_time.monotonicTime)() + timeout : 0;
|
|
58
62
|
return await this._frame._wrapApiCall(async () => {
|
|
59
|
-
const result = await this._frame._channel.waitForSelector({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
timeout
|
|
64
|
-
});
|
|
65
|
-
const handle = _elementHandle.ElementHandle.fromNullable(result.element);
|
|
66
|
-
if (!handle) throw new Error(`Could not resolve ${this._selector} to DOM Element`);
|
|
63
|
+
const result = await this._frame._channel.waitForSelector({ selector: this._selector, strict: true, state: "attached", timeout });
|
|
64
|
+
const handle = import_elementHandle.ElementHandle.fromNullable(result.element);
|
|
65
|
+
if (!handle)
|
|
66
|
+
throw new Error(`Could not resolve ${this._selector} to DOM Element`);
|
|
67
67
|
try {
|
|
68
|
-
return await task(handle, deadline ? deadline - (0,
|
|
68
|
+
return await task(handle, deadline ? deadline - (0, import_time.monotonicTime)() : 0);
|
|
69
69
|
} finally {
|
|
70
70
|
await handle.dispose();
|
|
71
71
|
}
|
|
@@ -78,31 +78,19 @@ class Locator {
|
|
|
78
78
|
return this._frame.page();
|
|
79
79
|
}
|
|
80
80
|
async boundingBox(options) {
|
|
81
|
-
return await this._withElement(h => h.boundingBox(), options
|
|
81
|
+
return await this._withElement((h) => h.boundingBox(), options?.timeout);
|
|
82
82
|
}
|
|
83
83
|
async check(options = {}) {
|
|
84
|
-
return await this._frame.check(this._selector, {
|
|
85
|
-
strict: true,
|
|
86
|
-
...options
|
|
87
|
-
});
|
|
84
|
+
return await this._frame.check(this._selector, { strict: true, ...options });
|
|
88
85
|
}
|
|
89
86
|
async click(options = {}) {
|
|
90
|
-
return await this._frame.click(this._selector, {
|
|
91
|
-
strict: true,
|
|
92
|
-
...options
|
|
93
|
-
});
|
|
87
|
+
return await this._frame.click(this._selector, { strict: true, ...options });
|
|
94
88
|
}
|
|
95
89
|
async dblclick(options = {}) {
|
|
96
|
-
return await this._frame.dblclick(this._selector, {
|
|
97
|
-
strict: true,
|
|
98
|
-
...options
|
|
99
|
-
});
|
|
90
|
+
return await this._frame.dblclick(this._selector, { strict: true, ...options });
|
|
100
91
|
}
|
|
101
92
|
async dispatchEvent(type, eventInit = {}, options) {
|
|
102
|
-
return await this._frame.dispatchEvent(this._selector, type, eventInit, {
|
|
103
|
-
strict: true,
|
|
104
|
-
...options
|
|
105
|
-
});
|
|
93
|
+
return await this._frame.dispatchEvent(this._selector, type, eventInit, { strict: true, ...options });
|
|
106
94
|
}
|
|
107
95
|
async dragTo(target, options = {}) {
|
|
108
96
|
return await this._frame.dragAndDrop(this._selector, target._selector, {
|
|
@@ -111,68 +99,62 @@ class Locator {
|
|
|
111
99
|
});
|
|
112
100
|
}
|
|
113
101
|
async evaluate(pageFunction, arg, options) {
|
|
114
|
-
return await this._withElement(h => h.evaluate(pageFunction, arg), options
|
|
102
|
+
return await this._withElement((h) => h.evaluate(pageFunction, arg), options?.timeout);
|
|
115
103
|
}
|
|
116
104
|
async evaluateAll(pageFunction, arg) {
|
|
117
105
|
return await this._frame.$$eval(this._selector, pageFunction, arg);
|
|
118
106
|
}
|
|
119
107
|
async evaluateHandle(pageFunction, arg, options) {
|
|
120
|
-
return await this._withElement(h => h.evaluateHandle(pageFunction, arg), options
|
|
108
|
+
return await this._withElement((h) => h.evaluateHandle(pageFunction, arg), options?.timeout);
|
|
121
109
|
}
|
|
122
110
|
async fill(value, options = {}) {
|
|
123
|
-
return await this._frame.fill(this._selector, value, {
|
|
124
|
-
strict: true,
|
|
125
|
-
...options
|
|
126
|
-
});
|
|
111
|
+
return await this._frame.fill(this._selector, value, { strict: true, ...options });
|
|
127
112
|
}
|
|
128
113
|
async clear(options = {}) {
|
|
129
|
-
return await this.fill(
|
|
114
|
+
return await this.fill("", options);
|
|
130
115
|
}
|
|
131
116
|
async _highlight() {
|
|
132
|
-
// VS Code extension uses this one, keep it for now.
|
|
133
117
|
return await this._frame._highlight(this._selector);
|
|
134
118
|
}
|
|
135
119
|
async highlight() {
|
|
136
120
|
return await this._frame._highlight(this._selector);
|
|
137
121
|
}
|
|
138
122
|
locator(selectorOrLocator, options) {
|
|
139
|
-
if ((0,
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
if ((0, import_rtti.isString)(selectorOrLocator))
|
|
124
|
+
return new Locator(this._frame, this._selector + " >> " + selectorOrLocator, options);
|
|
125
|
+
if (selectorOrLocator._frame !== this._frame)
|
|
126
|
+
throw new Error(`Locators must belong to the same frame.`);
|
|
127
|
+
return new Locator(this._frame, this._selector + " >> internal:chain=" + JSON.stringify(selectorOrLocator._selector), options);
|
|
142
128
|
}
|
|
143
129
|
getByTestId(testId) {
|
|
144
|
-
return this.locator((0,
|
|
130
|
+
return this.locator((0, import_locatorUtils.getByTestIdSelector)(testIdAttributeName(), testId));
|
|
145
131
|
}
|
|
146
132
|
getByAltText(text, options) {
|
|
147
|
-
return this.locator((0,
|
|
133
|
+
return this.locator((0, import_locatorUtils.getByAltTextSelector)(text, options));
|
|
148
134
|
}
|
|
149
135
|
getByLabel(text, options) {
|
|
150
|
-
return this.locator((0,
|
|
136
|
+
return this.locator((0, import_locatorUtils.getByLabelSelector)(text, options));
|
|
151
137
|
}
|
|
152
138
|
getByPlaceholder(text, options) {
|
|
153
|
-
return this.locator((0,
|
|
139
|
+
return this.locator((0, import_locatorUtils.getByPlaceholderSelector)(text, options));
|
|
154
140
|
}
|
|
155
141
|
getByText(text, options) {
|
|
156
|
-
return this.locator((0,
|
|
142
|
+
return this.locator((0, import_locatorUtils.getByTextSelector)(text, options));
|
|
157
143
|
}
|
|
158
144
|
getByTitle(text, options) {
|
|
159
|
-
return this.locator((0,
|
|
145
|
+
return this.locator((0, import_locatorUtils.getByTitleSelector)(text, options));
|
|
160
146
|
}
|
|
161
147
|
getByRole(role, options = {}) {
|
|
162
|
-
return this.locator((0,
|
|
148
|
+
return this.locator((0, import_locatorUtils.getByRoleSelector)(role, options));
|
|
163
149
|
}
|
|
164
150
|
frameLocator(selector) {
|
|
165
|
-
return new FrameLocator(this._frame, this._selector +
|
|
151
|
+
return new FrameLocator(this._frame, this._selector + " >> " + selector);
|
|
166
152
|
}
|
|
167
153
|
filter(options) {
|
|
168
154
|
return new Locator(this._frame, this._selector, options);
|
|
169
155
|
}
|
|
170
156
|
async elementHandle(options) {
|
|
171
|
-
return await this._frame.waitForSelector(this._selector, {
|
|
172
|
-
strict: true,
|
|
173
|
-
state: 'attached',
|
|
174
|
-
...options
|
|
175
|
-
});
|
|
157
|
+
return await this._frame.waitForSelector(this._selector, { strict: true, state: "attached", ...options });
|
|
176
158
|
}
|
|
177
159
|
async elementHandles() {
|
|
178
160
|
return await this._frame.$$(this._selector);
|
|
@@ -181,7 +163,7 @@ class Locator {
|
|
|
181
163
|
return new FrameLocator(this._frame, this._selector);
|
|
182
164
|
}
|
|
183
165
|
first() {
|
|
184
|
-
return new Locator(this._frame, this._selector +
|
|
166
|
+
return new Locator(this._frame, this._selector + " >> nth=0");
|
|
185
167
|
}
|
|
186
168
|
last() {
|
|
187
169
|
return new Locator(this._frame, this._selector + ` >> nth=-1`);
|
|
@@ -190,246 +172,172 @@ class Locator {
|
|
|
190
172
|
return new Locator(this._frame, this._selector + ` >> nth=${index}`);
|
|
191
173
|
}
|
|
192
174
|
and(locator) {
|
|
193
|
-
if (locator._frame !== this._frame)
|
|
175
|
+
if (locator._frame !== this._frame)
|
|
176
|
+
throw new Error(`Locators must belong to the same frame.`);
|
|
194
177
|
return new Locator(this._frame, this._selector + ` >> internal:and=` + JSON.stringify(locator._selector));
|
|
195
178
|
}
|
|
196
179
|
or(locator) {
|
|
197
|
-
if (locator._frame !== this._frame)
|
|
180
|
+
if (locator._frame !== this._frame)
|
|
181
|
+
throw new Error(`Locators must belong to the same frame.`);
|
|
198
182
|
return new Locator(this._frame, this._selector + ` >> internal:or=` + JSON.stringify(locator._selector));
|
|
199
183
|
}
|
|
200
184
|
async focus(options) {
|
|
201
|
-
return await this._frame.focus(this._selector, {
|
|
202
|
-
strict: true,
|
|
203
|
-
...options
|
|
204
|
-
});
|
|
185
|
+
return await this._frame.focus(this._selector, { strict: true, ...options });
|
|
205
186
|
}
|
|
206
187
|
async blur(options) {
|
|
207
|
-
await this._frame._channel.blur({
|
|
208
|
-
selector: this._selector,
|
|
209
|
-
strict: true,
|
|
210
|
-
...options
|
|
211
|
-
});
|
|
188
|
+
await this._frame._channel.blur({ selector: this._selector, strict: true, ...options });
|
|
212
189
|
}
|
|
213
190
|
async count() {
|
|
214
191
|
return await this._frame._queryCount(this._selector);
|
|
215
192
|
}
|
|
193
|
+
async _generateLocatorString() {
|
|
194
|
+
return await this._withElement((h) => h._generateLocatorString());
|
|
195
|
+
}
|
|
216
196
|
async getAttribute(name, options) {
|
|
217
|
-
return await this._frame.getAttribute(this._selector, name, {
|
|
218
|
-
strict: true,
|
|
219
|
-
...options
|
|
220
|
-
});
|
|
197
|
+
return await this._frame.getAttribute(this._selector, name, { strict: true, ...options });
|
|
221
198
|
}
|
|
222
199
|
async hover(options = {}) {
|
|
223
|
-
return await this._frame.hover(this._selector, {
|
|
224
|
-
strict: true,
|
|
225
|
-
...options
|
|
226
|
-
});
|
|
200
|
+
return await this._frame.hover(this._selector, { strict: true, ...options });
|
|
227
201
|
}
|
|
228
202
|
async innerHTML(options) {
|
|
229
|
-
return await this._frame.innerHTML(this._selector, {
|
|
230
|
-
strict: true,
|
|
231
|
-
...options
|
|
232
|
-
});
|
|
203
|
+
return await this._frame.innerHTML(this._selector, { strict: true, ...options });
|
|
233
204
|
}
|
|
234
205
|
async innerText(options) {
|
|
235
|
-
return await this._frame.innerText(this._selector, {
|
|
236
|
-
strict: true,
|
|
237
|
-
...options
|
|
238
|
-
});
|
|
206
|
+
return await this._frame.innerText(this._selector, { strict: true, ...options });
|
|
239
207
|
}
|
|
240
208
|
async inputValue(options) {
|
|
241
|
-
return await this._frame.inputValue(this._selector, {
|
|
242
|
-
strict: true,
|
|
243
|
-
...options
|
|
244
|
-
});
|
|
209
|
+
return await this._frame.inputValue(this._selector, { strict: true, ...options });
|
|
245
210
|
}
|
|
246
211
|
async isChecked(options) {
|
|
247
|
-
return await this._frame.isChecked(this._selector, {
|
|
248
|
-
strict: true,
|
|
249
|
-
...options
|
|
250
|
-
});
|
|
212
|
+
return await this._frame.isChecked(this._selector, { strict: true, ...options });
|
|
251
213
|
}
|
|
252
214
|
async isDisabled(options) {
|
|
253
|
-
return await this._frame.isDisabled(this._selector, {
|
|
254
|
-
strict: true,
|
|
255
|
-
...options
|
|
256
|
-
});
|
|
215
|
+
return await this._frame.isDisabled(this._selector, { strict: true, ...options });
|
|
257
216
|
}
|
|
258
217
|
async isEditable(options) {
|
|
259
|
-
return await this._frame.isEditable(this._selector, {
|
|
260
|
-
strict: true,
|
|
261
|
-
...options
|
|
262
|
-
});
|
|
218
|
+
return await this._frame.isEditable(this._selector, { strict: true, ...options });
|
|
263
219
|
}
|
|
264
220
|
async isEnabled(options) {
|
|
265
|
-
return await this._frame.isEnabled(this._selector, {
|
|
266
|
-
strict: true,
|
|
267
|
-
...options
|
|
268
|
-
});
|
|
221
|
+
return await this._frame.isEnabled(this._selector, { strict: true, ...options });
|
|
269
222
|
}
|
|
270
223
|
async isHidden(options) {
|
|
271
|
-
return await this._frame.isHidden(this._selector, {
|
|
272
|
-
strict: true,
|
|
273
|
-
...options
|
|
274
|
-
});
|
|
224
|
+
return await this._frame.isHidden(this._selector, { strict: true, ...options });
|
|
275
225
|
}
|
|
276
226
|
async isVisible(options) {
|
|
277
|
-
return await this._frame.isVisible(this._selector, {
|
|
278
|
-
strict: true,
|
|
279
|
-
...options
|
|
280
|
-
});
|
|
227
|
+
return await this._frame.isVisible(this._selector, { strict: true, ...options });
|
|
281
228
|
}
|
|
282
229
|
async press(key, options = {}) {
|
|
283
|
-
return await this._frame.press(this._selector, key, {
|
|
284
|
-
strict: true,
|
|
285
|
-
...options
|
|
286
|
-
});
|
|
230
|
+
return await this._frame.press(this._selector, key, { strict: true, ...options });
|
|
287
231
|
}
|
|
288
232
|
async screenshot(options = {}) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
timeout
|
|
292
|
-
}), options.timeout);
|
|
233
|
+
const mask = options.mask;
|
|
234
|
+
return await this._withElement((h, timeout) => h.screenshot({ ...options, mask, timeout }), options.timeout);
|
|
293
235
|
}
|
|
294
236
|
async ariaSnapshot(options) {
|
|
295
|
-
const result = await this._frame._channel.ariaSnapshot({
|
|
296
|
-
...options,
|
|
297
|
-
selector: this._selector
|
|
298
|
-
});
|
|
237
|
+
const result = await this._frame._channel.ariaSnapshot({ ...options, mode: options?._mode, selector: this._selector });
|
|
299
238
|
return result.snapshot;
|
|
300
239
|
}
|
|
301
240
|
async scrollIntoViewIfNeeded(options = {}) {
|
|
302
|
-
return await this._withElement((h, timeout) => h.scrollIntoViewIfNeeded({
|
|
303
|
-
...options,
|
|
304
|
-
timeout
|
|
305
|
-
}), options.timeout);
|
|
241
|
+
return await this._withElement((h, timeout) => h.scrollIntoViewIfNeeded({ ...options, timeout }), options.timeout);
|
|
306
242
|
}
|
|
307
243
|
async selectOption(values, options = {}) {
|
|
308
|
-
return await this._frame.selectOption(this._selector, values, {
|
|
309
|
-
strict: true,
|
|
310
|
-
...options
|
|
311
|
-
});
|
|
244
|
+
return await this._frame.selectOption(this._selector, values, { strict: true, ...options });
|
|
312
245
|
}
|
|
313
246
|
async selectText(options = {}) {
|
|
314
|
-
return await this._withElement((h, timeout) => h.selectText({
|
|
315
|
-
...options,
|
|
316
|
-
timeout
|
|
317
|
-
}), options.timeout);
|
|
247
|
+
return await this._withElement((h, timeout) => h.selectText({ ...options, timeout }), options.timeout);
|
|
318
248
|
}
|
|
319
249
|
async setChecked(checked, options) {
|
|
320
|
-
if (checked)
|
|
250
|
+
if (checked)
|
|
251
|
+
await this.check(options);
|
|
252
|
+
else
|
|
253
|
+
await this.uncheck(options);
|
|
321
254
|
}
|
|
322
255
|
async setInputFiles(files, options = {}) {
|
|
323
|
-
return await this._frame.setInputFiles(this._selector, files, {
|
|
324
|
-
strict: true,
|
|
325
|
-
...options
|
|
326
|
-
});
|
|
256
|
+
return await this._frame.setInputFiles(this._selector, files, { strict: true, ...options });
|
|
327
257
|
}
|
|
328
258
|
async tap(options = {}) {
|
|
329
|
-
return await this._frame.tap(this._selector, {
|
|
330
|
-
strict: true,
|
|
331
|
-
...options
|
|
332
|
-
});
|
|
259
|
+
return await this._frame.tap(this._selector, { strict: true, ...options });
|
|
333
260
|
}
|
|
334
261
|
async textContent(options) {
|
|
335
|
-
return await this._frame.textContent(this._selector, {
|
|
336
|
-
strict: true,
|
|
337
|
-
...options
|
|
338
|
-
});
|
|
262
|
+
return await this._frame.textContent(this._selector, { strict: true, ...options });
|
|
339
263
|
}
|
|
340
264
|
async type(text, options = {}) {
|
|
341
|
-
return await this._frame.type(this._selector, text, {
|
|
342
|
-
strict: true,
|
|
343
|
-
...options
|
|
344
|
-
});
|
|
265
|
+
return await this._frame.type(this._selector, text, { strict: true, ...options });
|
|
345
266
|
}
|
|
346
267
|
async pressSequentially(text, options = {}) {
|
|
347
268
|
return await this.type(text, options);
|
|
348
269
|
}
|
|
349
270
|
async uncheck(options = {}) {
|
|
350
|
-
return await this._frame.uncheck(this._selector, {
|
|
351
|
-
strict: true,
|
|
352
|
-
...options
|
|
353
|
-
});
|
|
271
|
+
return await this._frame.uncheck(this._selector, { strict: true, ...options });
|
|
354
272
|
}
|
|
355
273
|
async all() {
|
|
356
274
|
return new Array(await this.count()).fill(0).map((e, i) => this.nth(i));
|
|
357
275
|
}
|
|
358
276
|
async allInnerTexts() {
|
|
359
|
-
return await this._frame.$$eval(this._selector, ee => ee.map(e => e.innerText));
|
|
277
|
+
return await this._frame.$$eval(this._selector, (ee) => ee.map((e) => e.innerText));
|
|
360
278
|
}
|
|
361
279
|
async allTextContents() {
|
|
362
|
-
return await this._frame.$$eval(this._selector, ee => ee.map(e => e.textContent ||
|
|
280
|
+
return await this._frame.$$eval(this._selector, (ee) => ee.map((e) => e.textContent || ""));
|
|
363
281
|
}
|
|
364
282
|
async waitFor(options) {
|
|
365
|
-
await this._frame._channel.waitForSelector({
|
|
366
|
-
selector: this._selector,
|
|
367
|
-
strict: true,
|
|
368
|
-
omitReturnValue: true,
|
|
369
|
-
...options
|
|
370
|
-
});
|
|
283
|
+
await this._frame._channel.waitForSelector({ selector: this._selector, strict: true, omitReturnValue: true, ...options });
|
|
371
284
|
}
|
|
372
285
|
async _expect(expression, options) {
|
|
373
|
-
const params = {
|
|
374
|
-
|
|
375
|
-
expression,
|
|
376
|
-
...options,
|
|
377
|
-
isNot: !!options.isNot
|
|
378
|
-
};
|
|
379
|
-
params.expectedValue = (0, _jsHandle.serializeArgument)(options.expectedValue);
|
|
286
|
+
const params = { selector: this._selector, expression, ...options, isNot: !!options.isNot };
|
|
287
|
+
params.expectedValue = (0, import_jsHandle.serializeArgument)(options.expectedValue);
|
|
380
288
|
const result = await this._frame._channel.expect(params);
|
|
381
|
-
if (result.received !==
|
|
289
|
+
if (result.received !== void 0)
|
|
290
|
+
result.received = (0, import_jsHandle.parseResult)(result.received);
|
|
382
291
|
return result;
|
|
383
292
|
}
|
|
384
|
-
|
|
293
|
+
_inspect() {
|
|
385
294
|
return this.toString();
|
|
386
295
|
}
|
|
387
296
|
toString() {
|
|
388
|
-
return (0,
|
|
297
|
+
return (0, import_locatorGenerators.asLocator)("javascript", this._selector);
|
|
389
298
|
}
|
|
390
299
|
}
|
|
391
|
-
exports.Locator = Locator;
|
|
392
300
|
class FrameLocator {
|
|
393
301
|
constructor(frame, selector) {
|
|
394
|
-
this._frame = void 0;
|
|
395
|
-
this._frameSelector = void 0;
|
|
396
302
|
this._frame = frame;
|
|
397
303
|
this._frameSelector = selector;
|
|
398
304
|
}
|
|
399
305
|
locator(selectorOrLocator, options) {
|
|
400
|
-
if ((0,
|
|
401
|
-
|
|
402
|
-
|
|
306
|
+
if ((0, import_rtti.isString)(selectorOrLocator))
|
|
307
|
+
return new Locator(this._frame, this._frameSelector + " >> internal:control=enter-frame >> " + selectorOrLocator, options);
|
|
308
|
+
if (selectorOrLocator._frame !== this._frame)
|
|
309
|
+
throw new Error(`Locators must belong to the same frame.`);
|
|
310
|
+
return new Locator(this._frame, this._frameSelector + " >> internal:control=enter-frame >> " + selectorOrLocator._selector, options);
|
|
403
311
|
}
|
|
404
312
|
getByTestId(testId) {
|
|
405
|
-
return this.locator((0,
|
|
313
|
+
return this.locator((0, import_locatorUtils.getByTestIdSelector)(testIdAttributeName(), testId));
|
|
406
314
|
}
|
|
407
315
|
getByAltText(text, options) {
|
|
408
|
-
return this.locator((0,
|
|
316
|
+
return this.locator((0, import_locatorUtils.getByAltTextSelector)(text, options));
|
|
409
317
|
}
|
|
410
318
|
getByLabel(text, options) {
|
|
411
|
-
return this.locator((0,
|
|
319
|
+
return this.locator((0, import_locatorUtils.getByLabelSelector)(text, options));
|
|
412
320
|
}
|
|
413
321
|
getByPlaceholder(text, options) {
|
|
414
|
-
return this.locator((0,
|
|
322
|
+
return this.locator((0, import_locatorUtils.getByPlaceholderSelector)(text, options));
|
|
415
323
|
}
|
|
416
324
|
getByText(text, options) {
|
|
417
|
-
return this.locator((0,
|
|
325
|
+
return this.locator((0, import_locatorUtils.getByTextSelector)(text, options));
|
|
418
326
|
}
|
|
419
327
|
getByTitle(text, options) {
|
|
420
|
-
return this.locator((0,
|
|
328
|
+
return this.locator((0, import_locatorUtils.getByTitleSelector)(text, options));
|
|
421
329
|
}
|
|
422
330
|
getByRole(role, options = {}) {
|
|
423
|
-
return this.locator((0,
|
|
331
|
+
return this.locator((0, import_locatorUtils.getByRoleSelector)(role, options));
|
|
424
332
|
}
|
|
425
333
|
owner() {
|
|
426
334
|
return new Locator(this._frame, this._frameSelector);
|
|
427
335
|
}
|
|
428
336
|
frameLocator(selector) {
|
|
429
|
-
return new FrameLocator(this._frame, this._frameSelector +
|
|
337
|
+
return new FrameLocator(this._frame, this._frameSelector + " >> internal:control=enter-frame >> " + selector);
|
|
430
338
|
}
|
|
431
339
|
first() {
|
|
432
|
-
return new FrameLocator(this._frame, this._frameSelector +
|
|
340
|
+
return new FrameLocator(this._frame, this._frameSelector + " >> nth=0");
|
|
433
341
|
}
|
|
434
342
|
last() {
|
|
435
343
|
return new FrameLocator(this._frame, this._frameSelector + ` >> nth=-1`);
|
|
@@ -438,11 +346,17 @@ class FrameLocator {
|
|
|
438
346
|
return new FrameLocator(this._frame, this._frameSelector + ` >> nth=${index}`);
|
|
439
347
|
}
|
|
440
348
|
}
|
|
441
|
-
|
|
442
|
-
let _testIdAttributeName = 'data-testid';
|
|
349
|
+
let _testIdAttributeName = "data-testid";
|
|
443
350
|
function testIdAttributeName() {
|
|
444
351
|
return _testIdAttributeName;
|
|
445
352
|
}
|
|
446
353
|
function setTestIdAttribute(attributeName) {
|
|
447
354
|
_testIdAttributeName = attributeName;
|
|
448
|
-
}
|
|
355
|
+
}
|
|
356
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
357
|
+
0 && (module.exports = {
|
|
358
|
+
FrameLocator,
|
|
359
|
+
Locator,
|
|
360
|
+
setTestIdAttribute,
|
|
361
|
+
testIdAttributeName
|
|
362
|
+
});
|