patchright-core 1.51.3 → 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/browsers.json +15 -13
- package/lib/androidServerImpl.js +42 -48
- package/lib/browserServerImpl.js +54 -67
- package/lib/cli/driver.js +71 -69
- package/lib/cli/program.js +312 -328
- package/lib/cli/programWithTestStub.js +51 -45
- package/lib/client/accessibility.js +31 -32
- package/lib/client/android.js +141 -228
- package/lib/client/api.js +135 -283
- package/lib/client/artifact.js +39 -36
- package/lib/client/browser.js +57 -61
- package/lib/client/browserContext.js +297 -326
- package/lib/client/browserType.js +92 -106
- package/lib/client/cdpSession.js +29 -31
- package/lib/client/channelOwner.js +82 -95
- package/lib/client/clientHelper.js +46 -38
- package/lib/client/clientInstrumentation.js +40 -37
- package/lib/client/clientStackTrace.js +41 -37
- package/lib/client/clock.js +36 -36
- package/lib/client/connection.js +190 -212
- package/lib/client/consoleMessage.js +31 -28
- 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 +73 -75
- package/lib/client/elementHandle.js +111 -147
- package/lib/client/errors.js +53 -53
- package/lib/client/eventEmitter.js +124 -121
- package/lib/client/events.js +72 -68
- package/lib/client/fetch.js +135 -158
- package/lib/client/fileChooser.js +25 -24
- package/lib/client/fileUtils.js +31 -28
- package/lib/client/frame.js +187 -306
- package/lib/client/harRouter.js +42 -52
- package/lib/client/input.js +40 -69
- package/lib/client/jsHandle.js +54 -69
- package/lib/client/jsonPipe.js +27 -23
- package/lib/client/localUtils.js +29 -28
- package/lib/client/locator.js +161 -245
- package/lib/client/network.js +277 -295
- package/lib/client/page.js +270 -318
- package/lib/client/platform.js +46 -43
- package/lib/client/playwright.js +51 -66
- package/lib/client/selectors.js +48 -46
- package/lib/client/stream.js +29 -25
- package/lib/client/timeoutSettings.js +49 -39
- package/lib/client/tracing.js +48 -84
- package/lib/client/types.js +26 -22
- package/lib/client/video.js +35 -27
- package/lib/client/waiter.js +69 -88
- package/lib/client/webError.js +25 -23
- package/lib/client/webSocket.js +61 -56
- package/lib/client/worker.js +48 -58
- package/lib/client/writableStream.js +27 -23
- 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 -53
- package/lib/inprocess.js +2 -19
- package/lib/outofprocess.js +53 -46
- package/lib/protocol/debug.js +209 -25
- package/lib/protocol/serializers.js +153 -134
- package/lib/protocol/validator.js +2714 -2714
- package/lib/protocol/validatorPrimitives.js +114 -73
- package/lib/remote/playwrightConnection.js +140 -157
- package/lib/remote/playwrightServer.js +99 -84
- package/lib/server/accessibility.js +44 -37
- package/lib/server/android/android.js +216 -209
- package/lib/server/android/backendAdb.js +89 -82
- package/lib/server/artifact.js +78 -55
- package/lib/server/bidi/bidiBrowser.js +221 -155
- package/lib/server/bidi/bidiChromium.js +106 -79
- package/lib/server/bidi/bidiConnection.js +66 -83
- package/lib/server/bidi/bidiExecutionContext.js +128 -113
- package/lib/server/bidi/bidiFirefox.js +76 -69
- package/lib/server/bidi/bidiInput.js +86 -97
- package/lib/server/bidi/bidiNetworkManager.js +137 -154
- package/lib/server/bidi/bidiOverCdp.js +57 -58
- package/lib/server/bidi/bidiPage.js +247 -219
- 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 +236 -220
- 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 +141 -119
- package/lib/server/browser.js +76 -84
- package/lib/server/browserContext.js +321 -346
- package/lib/server/browserType.js +169 -182
- package/lib/server/callLog.js +47 -44
- package/lib/server/chromium/chromium.js +212 -190
- package/lib/server/chromium/chromiumSwitches.js +86 -64
- package/lib/server/chromium/crAccessibility.js +157 -131
- package/lib/server/chromium/crBrowser.js +253 -273
- package/lib/server/chromium/crConnection.js +91 -116
- package/lib/server/chromium/crCoverage.js +113 -127
- package/lib/server/chromium/crDevTools.js +59 -51
- package/lib/server/chromium/crDragDrop.js +62 -79
- package/lib/server/chromium/crExecutionContext.js +88 -83
- package/lib/server/chromium/crInput.js +97 -95
- package/lib/server/chromium/crNetworkManager.js +284 -404
- package/lib/server/chromium/crPage.js +522 -608
- package/lib/server/chromium/crPdf.js +54 -86
- package/lib/server/chromium/crProtocolHelper.js +92 -80
- package/lib/server/chromium/crServiceWorker.js +82 -67
- 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 +62 -50
- package/lib/server/codegen/csharp.js +185 -160
- package/lib/server/codegen/java.js +155 -128
- package/lib/server/codegen/javascript.js +163 -148
- package/lib/server/codegen/jsonl.js +32 -28
- package/lib/server/codegen/language.js +75 -52
- package/lib/server/codegen/languages.js +65 -27
- package/lib/server/codegen/python.js +140 -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 +97 -124
- package/lib/server/debugger.js +82 -78
- package/lib/server/deviceDescriptors.js +37 -24
- package/lib/server/deviceDescriptorsSource.json +50 -50
- 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 +176 -205
- 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 -66
- package/lib/server/dispatchers/dialogDispatcher.js +30 -27
- package/lib/server/dispatchers/dispatcher.js +169 -220
- package/lib/server/dispatchers/electronDispatcher.js +54 -57
- package/lib/server/dispatchers/elementHandlerDispatcher.js +77 -119
- package/lib/server/dispatchers/frameDispatcher.js +99 -163
- package/lib/server/dispatchers/jsHandleDispatcher.js +49 -66
- package/lib/server/dispatchers/jsonPipeDispatcher.js +35 -36
- package/lib/server/dispatchers/localUtilsDispatcher.js +95 -80
- package/lib/server/dispatchers/networkDispatchers.js +90 -107
- package/lib/server/dispatchers/pageDispatcher.js +128 -169
- package/lib/server/dispatchers/playwrightDispatcher.js +69 -76
- package/lib/server/dispatchers/selectorsDispatcher.js +28 -24
- package/lib/server/dispatchers/streamDispatcher.js +42 -45
- package/lib/server/dispatchers/tracingDispatcher.js +36 -41
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +96 -131
- package/lib/server/dispatchers/writableStreamDispatcher.js +54 -38
- package/lib/server/dom.js +413 -443
- package/lib/server/download.js +45 -35
- package/lib/server/electron/electron.js +156 -176
- package/lib/server/electron/loader.js +8 -36
- package/lib/server/errors.js +47 -46
- package/lib/server/fetch.js +289 -323
- package/lib/server/fileChooser.js +25 -24
- package/lib/server/fileUploadUtils.js +65 -59
- package/lib/server/firefox/ffAccessibility.js +153 -131
- package/lib/server/firefox/ffBrowser.js +213 -277
- package/lib/server/firefox/ffConnection.js +63 -84
- package/lib/server/firefox/ffExecutionContext.js +91 -73
- package/lib/server/firefox/ffInput.js +67 -69
- package/lib/server/firefox/ffNetworkManager.js +131 -110
- package/lib/server/firefox/ffPage.js +236 -273
- package/lib/server/firefox/firefox.js +76 -67
- 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 +730 -894
- package/lib/server/har/harRecorder.js +85 -77
- package/lib/server/har/harTracer.js +287 -222
- package/lib/server/harBackend.js +80 -80
- package/lib/server/helper.js +56 -59
- package/lib/server/index.js +59 -99
- package/lib/server/input.js +134 -163
- package/lib/server/instrumentation.js +49 -44
- package/lib/server/javascript.js +143 -134
- package/lib/server/launchApp.js +92 -73
- package/lib/server/localUtils.js +130 -122
- package/lib/server/macEditingCommands.js +141 -137
- package/lib/server/network.js +262 -296
- package/lib/server/page.js +329 -426
- 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 +70 -86
- package/lib/server/recorder/contextRecorder.js +134 -138
- package/lib/server/recorder/recorderApp.js +127 -136
- package/lib/server/recorder/recorderCollection.js +56 -44
- package/lib/server/recorder/recorderFrontend.js +15 -4
- package/lib/server/recorder/recorderRunner.js +79 -103
- package/lib/server/recorder/recorderUtils.js +56 -45
- package/lib/server/recorder/throttledFile.js +42 -30
- package/lib/server/recorder.js +177 -186
- package/lib/server/registry/browserFetcher.js +106 -101
- package/lib/server/registry/dependencies.js +245 -196
- package/lib/server/registry/index.js +904 -792
- package/lib/server/registry/nativeDeps.js +1073 -464
- 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 -70
- package/lib/server/storageScript.js +94 -100
- package/lib/server/timeoutSettings.js +58 -43
- package/lib/server/trace/recorder/snapshotter.js +70 -89
- package/lib/server/trace/recorder/snapshotterInjected.js +238 -217
- package/lib/server/trace/recorder/tracing.js +321 -333
- package/lib/server/trace/test/inMemorySnapshotter.js +46 -52
- package/lib/server/trace/viewer/traceViewer.js +168 -146
- package/lib/server/transport.js +124 -133
- package/lib/server/types.js +26 -22
- package/lib/server/usKeyboardLayout.js +135 -545
- package/lib/server/utils/ascii.js +39 -26
- package/lib/server/utils/comparators.js +105 -103
- package/lib/server/utils/crypto.js +157 -112
- package/lib/server/utils/debug.js +37 -28
- package/lib/server/utils/debugLogger.js +69 -48
- package/lib/server/utils/env.js +52 -37
- package/lib/server/utils/eventsHelper.js +29 -28
- package/lib/server/utils/expectUtils.js +31 -26
- package/lib/server/utils/fileUtils.js +123 -136
- package/lib/server/utils/happyEyeballs.js +138 -123
- package/lib/server/utils/hostPlatform.js +84 -120
- package/lib/server/utils/httpServer.js +106 -121
- package/lib/server/utils/image_tools/colorUtils.js +42 -51
- package/lib/server/utils/image_tools/compare.js +44 -43
- package/lib/server/utils/image_tools/imageChannel.js +38 -30
- package/lib/server/utils/image_tools/stats.js +40 -40
- package/lib/server/utils/linuxUtils.js +50 -37
- package/lib/server/utils/network.js +143 -86
- package/lib/server/utils/nodePlatform.js +87 -79
- package/lib/server/utils/pipeTransport.js +44 -42
- package/lib/server/utils/processLauncher.js +111 -121
- package/lib/server/utils/profiler.js +52 -39
- package/lib/server/utils/socksProxy.js +280 -339
- package/lib/server/utils/spawnAsync.js +37 -41
- package/lib/server/utils/task.js +31 -38
- package/lib/server/utils/userAgent.js +73 -66
- package/lib/server/utils/wsServer.js +73 -69
- package/lib/server/utils/zipFile.js +36 -37
- package/lib/server/utils/zones.js +37 -34
- 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 +159 -176
- package/lib/server/webkit/wkConnection.js +59 -83
- package/lib/server/webkit/wkExecutionContext.js +84 -70
- package/lib/server/webkit/wkInput.js +82 -80
- package/lib/server/webkit/wkInterceptableRequest.js +102 -95
- package/lib/server/webkit/wkPage.js +525 -619
- package/lib/server/webkit/wkProvisionalPage.js +45 -56
- package/lib/server/webkit/wkWorkers.js +77 -77
- package/lib/utils/isomorphic/ariaSnapshot.js +144 -152
- package/lib/utils/isomorphic/assert.js +28 -22
- package/lib/utils/isomorphic/builtins.js +90 -0
- package/lib/utils/isomorphic/colors.js +66 -59
- package/lib/utils/isomorphic/cssParser.js +121 -125
- package/lib/utils/isomorphic/cssTokenizer.js +436 -364
- package/lib/utils/isomorphic/headers.js +38 -37
- package/lib/utils/isomorphic/locatorGenerators.js +340 -357
- package/lib/utils/isomorphic/locatorParser.js +96 -105
- package/lib/utils/isomorphic/locatorUtils.js +63 -44
- package/lib/utils/isomorphic/manualPromise.js +47 -39
- package/lib/utils/isomorphic/mimeType.js +448 -25
- package/lib/utils/isomorphic/multimap.js +35 -27
- package/lib/utils/isomorphic/rtti.js +35 -33
- package/lib/utils/isomorphic/selectorParser.js +183 -193
- package/lib/utils/isomorphic/semaphore.js +27 -24
- package/lib/utils/isomorphic/stackTrace.js +87 -98
- package/lib/utils/isomorphic/stringUtils.js +113 -106
- package/lib/utils/isomorphic/time.js +41 -22
- package/lib/utils/isomorphic/timeoutRunner.js +55 -54
- package/lib/utils/isomorphic/traceUtils.js +38 -41
- package/lib/utils/isomorphic/types.js +15 -4
- package/lib/utils/isomorphic/urlMatch.js +112 -67
- package/lib/utils/isomorphic/utilityScriptSerializers.js +248 -0
- package/lib/utils.js +97 -443
- package/lib/utilsBundle.js +101 -52
- package/lib/vite/htmlReport/index.html +21 -15
- package/lib/vite/recorder/assets/{codeMirrorModule-B9YMkrwa.js → codeMirrorModule-DVQi6prl.js} +1 -1
- package/lib/vite/recorder/assets/index-97EUAAbk.js +184 -0
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/{codeMirrorModule-1DiydmYA.js → codeMirrorModule-dvXVzLxY.js} +1 -1
- package/lib/vite/traceViewer/assets/defaultSettingsView-BjymbO6M.js +265 -0
- package/lib/vite/traceViewer/{defaultSettingsView.5fN5lw10.css → defaultSettingsView.QdHITyLI.css} +1 -1
- package/lib/vite/traceViewer/index.ChIUCJnj.js +2 -0
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/lib/vite/traceViewer/uiMode.jUCiCtdp.js +5 -0
- package/lib/zipBundle.js +32 -23
- package/package.json +1 -1
- package/types/protocol.d.ts +436 -17
- package/types/types.d.ts +35 -16
- package/lib/server/isomorphic/utilityScriptSerializers.js +0 -229
- package/lib/vite/recorder/assets/index-ELPgmkwA.js +0 -184
- package/lib/vite/traceViewer/assets/defaultSettingsView-l0TyP_G8.js +0 -259
- package/lib/vite/traceViewer/index.BqUZLSro.js +0 -2
- package/lib/vite/traceViewer/uiMode.C1d2m5sF.js +0 -5
|
@@ -1,117 +1,121 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chromium_exports = {};
|
|
30
|
+
__export(chromium_exports, {
|
|
31
|
+
Chromium: () => Chromium
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* Modifications copyright (c) Microsoft Corporation.
|
|
34
|
-
*
|
|
35
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
-
* you may not use this file except in compliance with the License.
|
|
37
|
-
* You may obtain a copy of the License at
|
|
38
|
-
*
|
|
39
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
-
*
|
|
41
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
-
* See the License for the specific language governing permissions and
|
|
45
|
-
* limitations under the License.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const ARTIFACTS_FOLDER = _path.default.join(_os.default.tmpdir(), 'playwright-artifacts-');
|
|
49
|
-
class Chromium extends _browserType.BrowserType {
|
|
33
|
+
module.exports = __toCommonJS(chromium_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_os = __toESM(require("os"));
|
|
36
|
+
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_chromiumSwitches = require("./chromiumSwitches");
|
|
38
|
+
var import_crBrowser = require("./crBrowser");
|
|
39
|
+
var import_crConnection = require("./crConnection");
|
|
40
|
+
var import_timeoutSettings = require("../timeoutSettings");
|
|
41
|
+
var import_utils = require("../../utils");
|
|
42
|
+
var import_ascii = require("../utils/ascii");
|
|
43
|
+
var import_debugLogger = require("../utils/debugLogger");
|
|
44
|
+
var import_manualPromise = require("../../utils/isomorphic/manualPromise");
|
|
45
|
+
var import_network = require("../utils/network");
|
|
46
|
+
var import_userAgent = require("../utils/userAgent");
|
|
47
|
+
var import_browserContext = require("../browserContext");
|
|
48
|
+
var import_browserType = require("../browserType");
|
|
49
|
+
var import_browserType2 = require("../browserType");
|
|
50
|
+
var import_helper = require("../helper");
|
|
51
|
+
var import_registry = require("../registry");
|
|
52
|
+
var import_transport = require("../transport");
|
|
53
|
+
var import_crDevTools = require("./crDevTools");
|
|
54
|
+
var import_browser = require("../browser");
|
|
55
|
+
var import_fileUtils = require("../utils/fileUtils");
|
|
56
|
+
var import_processLauncher = require("../utils/processLauncher");
|
|
57
|
+
var import_progress = require("../progress");
|
|
58
|
+
const ARTIFACTS_FOLDER = import_path.default.join(import_os.default.tmpdir(), "playwright-artifacts-");
|
|
59
|
+
class Chromium extends import_browserType.BrowserType {
|
|
50
60
|
constructor(parent) {
|
|
51
|
-
super(parent,
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
super(parent, "chromium");
|
|
62
|
+
if ((0, import_utils.debugMode)())
|
|
63
|
+
this._devtools = this._createDevTools();
|
|
54
64
|
}
|
|
55
|
-
async connectOverCDP(metadata, endpointURL, options
|
|
56
|
-
const controller = new
|
|
57
|
-
controller.setLogName(
|
|
58
|
-
return controller.run(async progress => {
|
|
65
|
+
async connectOverCDP(metadata, endpointURL, options) {
|
|
66
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
67
|
+
controller.setLogName("browser");
|
|
68
|
+
return controller.run(async (progress) => {
|
|
59
69
|
return await this._connectOverCDPInternal(progress, endpointURL, options);
|
|
60
|
-
},
|
|
61
|
-
timeout
|
|
62
|
-
}));
|
|
70
|
+
}, import_timeoutSettings.TimeoutSettings.timeout(options));
|
|
63
71
|
}
|
|
64
72
|
async _connectOverCDPInternal(progress, endpointURL, options, onClose) {
|
|
65
73
|
let headersMap;
|
|
66
|
-
if (options.headers)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
if (options.headers)
|
|
75
|
+
headersMap = (0, import_utils.headersArrayToObject)(options.headers, false);
|
|
76
|
+
if (!headersMap)
|
|
77
|
+
headersMap = { "User-Agent": (0, import_userAgent.getUserAgent)() };
|
|
78
|
+
else if (headersMap && !Object.keys(headersMap).some((key) => key.toLowerCase() === "user-agent"))
|
|
79
|
+
headersMap["User-Agent"] = (0, import_userAgent.getUserAgent)();
|
|
80
|
+
const artifactsDir = await import_fs.default.promises.mkdtemp(ARTIFACTS_FOLDER);
|
|
71
81
|
const wsEndpoint = await urlToWSEndpoint(progress, endpointURL, headersMap);
|
|
72
82
|
progress.throwIfAborted();
|
|
73
|
-
const chromeTransport = await
|
|
74
|
-
const cleanedUp = new
|
|
83
|
+
const chromeTransport = await import_transport.WebSocketTransport.connect(progress, wsEndpoint, { headers: headersMap });
|
|
84
|
+
const cleanedUp = new import_manualPromise.ManualPromise();
|
|
75
85
|
const doCleanup = async () => {
|
|
76
|
-
await (0,
|
|
77
|
-
await
|
|
86
|
+
await (0, import_fileUtils.removeFolders)([artifactsDir]);
|
|
87
|
+
await onClose?.();
|
|
78
88
|
cleanedUp.resolve();
|
|
79
89
|
};
|
|
80
90
|
const doClose = async () => {
|
|
81
91
|
await chromeTransport.closeAndWait();
|
|
82
92
|
await cleanedUp;
|
|
83
93
|
};
|
|
84
|
-
const browserProcess = {
|
|
85
|
-
|
|
86
|
-
kill: doClose
|
|
87
|
-
};
|
|
88
|
-
const persistent = {
|
|
89
|
-
noDefaultViewport: true
|
|
90
|
-
};
|
|
94
|
+
const browserProcess = { close: doClose, kill: doClose };
|
|
95
|
+
const persistent = { noDefaultViewport: true };
|
|
91
96
|
const browserOptions = {
|
|
92
97
|
slowMo: options.slowMo,
|
|
93
|
-
name:
|
|
98
|
+
name: "chromium",
|
|
94
99
|
isChromium: true,
|
|
95
100
|
persistent,
|
|
96
101
|
browserProcess,
|
|
97
|
-
protocolLogger:
|
|
98
|
-
browserLogsCollector: new
|
|
102
|
+
protocolLogger: import_helper.helper.debugProtocolLogger(),
|
|
103
|
+
browserLogsCollector: new import_debugLogger.RecentLogsCollector(),
|
|
99
104
|
artifactsDir,
|
|
100
105
|
downloadsPath: options.downloadsPath || artifactsDir,
|
|
101
106
|
tracesDir: options.tracesDir || artifactsDir,
|
|
102
107
|
originalLaunchOptions: {}
|
|
103
108
|
};
|
|
104
|
-
(0,
|
|
109
|
+
(0, import_browserContext.validateBrowserContextOptions)(persistent, browserOptions);
|
|
105
110
|
progress.throwIfAborted();
|
|
106
|
-
const browser = await
|
|
111
|
+
const browser = await import_crBrowser.CRBrowser.connect(this.attribution.playwright, chromeTransport, browserOptions);
|
|
107
112
|
browser._isCollocatedWithServer = false;
|
|
108
|
-
browser.on(
|
|
113
|
+
browser.on(import_browser.Browser.Events.Disconnected, doCleanup);
|
|
109
114
|
return browser;
|
|
110
115
|
}
|
|
111
116
|
_createDevTools() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return directory ? new _crDevTools.CRDevTools(_path.default.join(directory, 'devtools-preferences.json')) : undefined;
|
|
117
|
+
const directory = import_registry.registry.findExecutable("chromium").directory;
|
|
118
|
+
return directory ? new import_crDevTools.CRDevTools(import_path.default.join(directory, "devtools-preferences.json")) : void 0;
|
|
115
119
|
}
|
|
116
120
|
async connectToTransport(transport, options) {
|
|
117
121
|
let devtools = this._devtools;
|
|
@@ -119,70 +123,65 @@ class Chromium extends _browserType.BrowserType {
|
|
|
119
123
|
devtools = this._createDevTools();
|
|
120
124
|
await options.__testHookForDevTools(devtools);
|
|
121
125
|
}
|
|
122
|
-
return
|
|
126
|
+
return import_crBrowser.CRBrowser.connect(this.attribution.playwright, transport, options, devtools);
|
|
123
127
|
}
|
|
124
128
|
doRewriteStartupLog(error) {
|
|
125
|
-
if (!error.logs)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (!error.logs.includes(
|
|
130
|
-
|
|
129
|
+
if (!error.logs)
|
|
130
|
+
return error;
|
|
131
|
+
if (error.logs.includes("Missing X server"))
|
|
132
|
+
error.logs = "\n" + (0, import_ascii.wrapInASCIIBox)(import_browserType.kNoXServerRunningError, 1);
|
|
133
|
+
if (!error.logs.includes("crbug.com/357670") && !error.logs.includes("No usable sandbox!") && !error.logs.includes("crbug.com/638180"))
|
|
134
|
+
return error;
|
|
135
|
+
error.logs = [
|
|
136
|
+
`Chromium sandboxing failed!`,
|
|
137
|
+
`================================`,
|
|
138
|
+
`To avoid the sandboxing issue, do either of the following:`,
|
|
139
|
+
` - (preferred): Configure your environment to support sandboxing`,
|
|
140
|
+
` - (alternative): Launch Chromium without sandbox using 'chromiumSandbox: false' option`,
|
|
141
|
+
`================================`,
|
|
142
|
+
``
|
|
143
|
+
].join("\n");
|
|
131
144
|
return error;
|
|
132
145
|
}
|
|
133
146
|
amendEnvironment(env, userDataDir, executable, browserArguments) {
|
|
134
147
|
return env;
|
|
135
148
|
}
|
|
136
149
|
attemptToGracefullyCloseBrowser(transport) {
|
|
137
|
-
const message = {
|
|
138
|
-
method: 'Browser.close',
|
|
139
|
-
id: _crConnection.kBrowserCloseMessageId,
|
|
140
|
-
params: {}
|
|
141
|
-
};
|
|
150
|
+
const message = { method: "Browser.close", id: import_crConnection.kBrowserCloseMessageId, params: {} };
|
|
142
151
|
transport.send(message);
|
|
143
152
|
}
|
|
144
153
|
async _launchWithSeleniumHub(progress, hubUrl, options) {
|
|
145
154
|
await this._createArtifactDirs(options);
|
|
146
|
-
if (!hubUrl.endsWith(
|
|
155
|
+
if (!hubUrl.endsWith("/"))
|
|
156
|
+
hubUrl = hubUrl + "/";
|
|
147
157
|
const args = this._innerDefaultArgs(options);
|
|
148
|
-
args.push(
|
|
149
|
-
const isEdge = options.channel && options.channel.startsWith(
|
|
158
|
+
args.push("--remote-debugging-port=0");
|
|
159
|
+
const isEdge = options.channel && options.channel.startsWith("msedge");
|
|
150
160
|
let desiredCapabilities = {
|
|
151
|
-
|
|
152
|
-
[isEdge ?
|
|
153
|
-
args
|
|
154
|
-
}
|
|
161
|
+
"browserName": isEdge ? "MicrosoftEdge" : "chrome",
|
|
162
|
+
[isEdge ? "ms:edgeOptions" : "goog:chromeOptions"]: { args }
|
|
155
163
|
};
|
|
156
164
|
if (process.env.SELENIUM_REMOTE_CAPABILITIES) {
|
|
157
|
-
const remoteCapabilities = parseSeleniumRemoteParams({
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}, progress);
|
|
161
|
-
if (remoteCapabilities) desiredCapabilities = {
|
|
162
|
-
...desiredCapabilities,
|
|
163
|
-
...remoteCapabilities
|
|
164
|
-
};
|
|
165
|
+
const remoteCapabilities = parseSeleniumRemoteParams({ name: "capabilities", value: process.env.SELENIUM_REMOTE_CAPABILITIES }, progress);
|
|
166
|
+
if (remoteCapabilities)
|
|
167
|
+
desiredCapabilities = { ...desiredCapabilities, ...remoteCapabilities };
|
|
165
168
|
}
|
|
166
169
|
let headers = {};
|
|
167
170
|
if (process.env.SELENIUM_REMOTE_HEADERS) {
|
|
168
|
-
const remoteHeaders = parseSeleniumRemoteParams({
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}, progress);
|
|
172
|
-
if (remoteHeaders) headers = remoteHeaders;
|
|
171
|
+
const remoteHeaders = parseSeleniumRemoteParams({ name: "headers", value: process.env.SELENIUM_REMOTE_HEADERS }, progress);
|
|
172
|
+
if (remoteHeaders)
|
|
173
|
+
headers = remoteHeaders;
|
|
173
174
|
}
|
|
174
175
|
progress.log(`<selenium> connecting to ${hubUrl}`);
|
|
175
|
-
const response = await (0,
|
|
176
|
-
url: hubUrl +
|
|
177
|
-
method:
|
|
176
|
+
const response = await (0, import_network.fetchData)({
|
|
177
|
+
url: hubUrl + "session",
|
|
178
|
+
method: "POST",
|
|
178
179
|
headers: {
|
|
179
|
-
|
|
180
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
180
181
|
...headers
|
|
181
182
|
},
|
|
182
183
|
data: JSON.stringify({
|
|
183
|
-
capabilities: {
|
|
184
|
-
alwaysMatch: desiredCapabilities
|
|
185
|
-
}
|
|
184
|
+
capabilities: { alwaysMatch: desiredCapabilities }
|
|
186
185
|
}),
|
|
187
186
|
timeout: progress.timeUntilDeadline()
|
|
188
187
|
}, seleniumErrorHandler);
|
|
@@ -191,42 +190,40 @@ class Chromium extends _browserType.BrowserType {
|
|
|
191
190
|
progress.log(`<selenium> connected to sessionId=${sessionId}`);
|
|
192
191
|
const disconnectFromSelenium = async () => {
|
|
193
192
|
progress.log(`<selenium> disconnecting from sessionId=${sessionId}`);
|
|
194
|
-
await (0,
|
|
195
|
-
url: hubUrl +
|
|
196
|
-
method:
|
|
193
|
+
await (0, import_network.fetchData)({
|
|
194
|
+
url: hubUrl + "session/" + sessionId,
|
|
195
|
+
method: "DELETE",
|
|
197
196
|
headers
|
|
198
|
-
}).catch(error => progress.log(`<error disconnecting from selenium>: ${error}`));
|
|
197
|
+
}).catch((error) => progress.log(`<error disconnecting from selenium>: ${error}`));
|
|
199
198
|
progress.log(`<selenium> disconnected from sessionId=${sessionId}`);
|
|
200
|
-
|
|
199
|
+
import_processLauncher.gracefullyCloseSet.delete(disconnectFromSelenium);
|
|
201
200
|
};
|
|
202
|
-
|
|
201
|
+
import_processLauncher.gracefullyCloseSet.add(disconnectFromSelenium);
|
|
203
202
|
try {
|
|
204
203
|
const capabilities = value.capabilities;
|
|
205
204
|
let endpointURL;
|
|
206
|
-
if (capabilities[
|
|
207
|
-
// Selenium 4 - use built-in CDP websocket proxy.
|
|
205
|
+
if (capabilities["se:cdp"]) {
|
|
208
206
|
progress.log(`<selenium> using selenium v4`);
|
|
209
|
-
const endpointURLString = addProtocol(capabilities[
|
|
207
|
+
const endpointURLString = addProtocol(capabilities["se:cdp"]);
|
|
210
208
|
endpointURL = new URL(endpointURLString);
|
|
211
|
-
if (endpointURL.hostname ===
|
|
209
|
+
if (endpointURL.hostname === "localhost" || endpointURL.hostname === "127.0.0.1")
|
|
210
|
+
endpointURL.hostname = new URL(hubUrl).hostname;
|
|
212
211
|
progress.log(`<selenium> retrieved endpoint ${endpointURL.toString()} for sessionId=${sessionId}`);
|
|
213
212
|
} else {
|
|
214
|
-
// Selenium 3 - resolve target node IP to use instead of localhost ws url.
|
|
215
213
|
progress.log(`<selenium> using selenium v3`);
|
|
216
|
-
const maybeChromeOptions = capabilities[
|
|
217
|
-
const chromeOptions = maybeChromeOptions && typeof maybeChromeOptions ===
|
|
218
|
-
const debuggerAddress = chromeOptions && typeof chromeOptions.debuggerAddress ===
|
|
219
|
-
const chromeOptionsURL = typeof maybeChromeOptions ===
|
|
220
|
-
|
|
221
|
-
const endpointURLString = addProtocol(debuggerAddress || chromeOptionsURL).replace('localhost', '127.0.0.1');
|
|
214
|
+
const maybeChromeOptions = capabilities["goog:chromeOptions"];
|
|
215
|
+
const chromeOptions = maybeChromeOptions && typeof maybeChromeOptions === "object" ? maybeChromeOptions : void 0;
|
|
216
|
+
const debuggerAddress = chromeOptions && typeof chromeOptions.debuggerAddress === "string" ? chromeOptions.debuggerAddress : void 0;
|
|
217
|
+
const chromeOptionsURL = typeof maybeChromeOptions === "string" ? maybeChromeOptions : void 0;
|
|
218
|
+
const endpointURLString = addProtocol(debuggerAddress || chromeOptionsURL).replace("localhost", "127.0.0.1");
|
|
222
219
|
progress.log(`<selenium> retrieved endpoint ${endpointURLString} for sessionId=${sessionId}`);
|
|
223
220
|
endpointURL = new URL(endpointURLString);
|
|
224
|
-
if (endpointURL.hostname ===
|
|
225
|
-
const sessionInfoUrl = new URL(hubUrl).origin +
|
|
221
|
+
if (endpointURL.hostname === "localhost" || endpointURL.hostname === "127.0.0.1") {
|
|
222
|
+
const sessionInfoUrl = new URL(hubUrl).origin + "/grid/api/testsession?session=" + sessionId;
|
|
226
223
|
try {
|
|
227
|
-
const sessionResponse = await (0,
|
|
224
|
+
const sessionResponse = await (0, import_network.fetchData)({
|
|
228
225
|
url: sessionInfoUrl,
|
|
229
|
-
method:
|
|
226
|
+
method: "GET",
|
|
230
227
|
timeout: progress.timeUntilDeadline(),
|
|
231
228
|
headers
|
|
232
229
|
}, seleniumErrorHandler);
|
|
@@ -240,7 +237,7 @@ class Chromium extends _browserType.BrowserType {
|
|
|
240
237
|
}
|
|
241
238
|
return await this._connectOverCDPInternal(progress, endpointURL.toString(), {
|
|
242
239
|
...options,
|
|
243
|
-
headers: (0,
|
|
240
|
+
headers: (0, import_utils.headersObjectToArray)(headers)
|
|
244
241
|
}, disconnectFromSelenium);
|
|
245
242
|
} catch (e) {
|
|
246
243
|
await disconnectFromSelenium();
|
|
@@ -250,76 +247,95 @@ class Chromium extends _browserType.BrowserType {
|
|
|
250
247
|
defaultArgs(options, isPersistent, userDataDir) {
|
|
251
248
|
const chromeArguments = this._innerDefaultArgs(options);
|
|
252
249
|
chromeArguments.push(`--user-data-dir=${userDataDir}`);
|
|
253
|
-
if (options.useWebSocket)
|
|
254
|
-
|
|
250
|
+
if (options.useWebSocket)
|
|
251
|
+
chromeArguments.push("--remote-debugging-port=0");
|
|
252
|
+
else
|
|
253
|
+
chromeArguments.push("--remote-debugging-pipe");
|
|
254
|
+
if (isPersistent)
|
|
255
|
+
chromeArguments.push("about:blank");
|
|
256
|
+
else
|
|
257
|
+
chromeArguments.push("--no-startup-window");
|
|
255
258
|
return chromeArguments;
|
|
256
259
|
}
|
|
257
260
|
_innerDefaultArgs(options) {
|
|
258
|
-
const {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
-
if (args.find(arg => !arg.startsWith(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
chromeArguments.push(
|
|
269
|
-
|
|
270
|
-
|
|
261
|
+
const { args = [] } = options;
|
|
262
|
+
const userDataDirArg = args.find((arg) => arg.startsWith("--user-data-dir"));
|
|
263
|
+
if (userDataDirArg)
|
|
264
|
+
throw this._createUserDataDirArgMisuseError("--user-data-dir");
|
|
265
|
+
if (args.find((arg) => arg.startsWith("--remote-debugging-pipe")))
|
|
266
|
+
throw new Error("Playwright manages remote debugging connection itself.");
|
|
267
|
+
if (args.find((arg) => !arg.startsWith("-")))
|
|
268
|
+
throw new Error("Arguments can not specify page to be opened");
|
|
269
|
+
const chromeArguments = [...import_chromiumSwitches.chromiumSwitches];
|
|
270
|
+
if (import_os.default.platform() === "darwin") {
|
|
271
|
+
chromeArguments.push("--enable-use-zoom-for-dsf=false");
|
|
272
|
+
if (options.headless && (!options.channel || options.channel === "chromium-headless-shell"))
|
|
273
|
+
chromeArguments.push("--use-angle");
|
|
271
274
|
}
|
|
272
|
-
if (options.devtools)
|
|
275
|
+
if (options.devtools)
|
|
276
|
+
chromeArguments.push("--auto-open-devtools-for-tabs");
|
|
273
277
|
if (options.headless) {
|
|
274
|
-
chromeArguments.push(
|
|
275
|
-
chromeArguments.push(
|
|
278
|
+
chromeArguments.push("--headless");
|
|
279
|
+
chromeArguments.push(
|
|
280
|
+
"--hide-scrollbars",
|
|
281
|
+
"--mute-audio",
|
|
282
|
+
"--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4"
|
|
283
|
+
);
|
|
276
284
|
}
|
|
277
|
-
if (options.chromiumSandbox !== true)
|
|
285
|
+
if (options.chromiumSandbox !== true)
|
|
286
|
+
chromeArguments.push("--no-sandbox");
|
|
278
287
|
const proxy = options.proxyOverride || options.proxy;
|
|
279
288
|
if (proxy) {
|
|
280
289
|
const proxyURL = new URL(proxy.server);
|
|
281
|
-
const isSocks = proxyURL.protocol ===
|
|
282
|
-
// https://www.chromium.org/developers/design-documents/network-settings
|
|
290
|
+
const isSocks = proxyURL.protocol === "socks5:";
|
|
283
291
|
if (isSocks && !this.attribution.playwright.options.socksProxyPort) {
|
|
284
|
-
// https://www.chromium.org/developers/design-documents/network-stack/socks-proxy
|
|
285
292
|
chromeArguments.push(`--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE ${proxyURL.hostname}"`);
|
|
286
293
|
}
|
|
287
294
|
chromeArguments.push(`--proxy-server=${proxy.server}`);
|
|
288
295
|
const proxyBypassRules = [];
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (proxy.bypass)
|
|
292
|
-
|
|
293
|
-
if (
|
|
296
|
+
if (this.attribution.playwright.options.socksProxyPort)
|
|
297
|
+
proxyBypassRules.push("<-loopback>");
|
|
298
|
+
if (proxy.bypass)
|
|
299
|
+
proxyBypassRules.push(...proxy.bypass.split(",").map((t) => t.trim()).map((t) => t.startsWith(".") ? "*" + t : t));
|
|
300
|
+
if (!process.env.PLAYWRIGHT_DISABLE_FORCED_CHROMIUM_PROXIED_LOOPBACK && !proxyBypassRules.includes("<-loopback>"))
|
|
301
|
+
proxyBypassRules.push("<-loopback>");
|
|
302
|
+
if (proxyBypassRules.length > 0)
|
|
303
|
+
chromeArguments.push(`--proxy-bypass-list=${proxyBypassRules.join(";")}`);
|
|
294
304
|
}
|
|
295
305
|
chromeArguments.push(...args);
|
|
296
306
|
return chromeArguments;
|
|
297
307
|
}
|
|
298
308
|
readyState(options) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return
|
|
309
|
+
if (options.useWebSocket || options.args?.some((a) => a.startsWith("--remote-debugging-port")))
|
|
310
|
+
return new ChromiumReadyState();
|
|
311
|
+
return void 0;
|
|
302
312
|
}
|
|
303
313
|
getExecutableName(options) {
|
|
304
|
-
if (options.channel)
|
|
305
|
-
|
|
314
|
+
if (options.channel)
|
|
315
|
+
return options.channel;
|
|
316
|
+
return options.headless ? "chromium-headless-shell" : "chromium";
|
|
306
317
|
}
|
|
307
318
|
}
|
|
308
|
-
|
|
309
|
-
class ChromiumReadyState extends _browserType.BrowserReadyState {
|
|
319
|
+
class ChromiumReadyState extends import_browserType2.BrowserReadyState {
|
|
310
320
|
onBrowserOutput(message) {
|
|
311
321
|
const match = message.match(/DevTools listening on (.*)/);
|
|
312
|
-
if (match)
|
|
322
|
+
if (match)
|
|
323
|
+
this._wsEndpoint.resolve(match[1]);
|
|
313
324
|
}
|
|
314
325
|
}
|
|
315
326
|
async function urlToWSEndpoint(progress, endpointURL, headers) {
|
|
316
|
-
if (endpointURL.startsWith(
|
|
327
|
+
if (endpointURL.startsWith("ws"))
|
|
328
|
+
return endpointURL;
|
|
317
329
|
progress.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);
|
|
318
|
-
const httpURL = endpointURL.endsWith(
|
|
319
|
-
const json = await (0,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
330
|
+
const httpURL = endpointURL.endsWith("/") ? `${endpointURL}json/version/` : `${endpointURL}/json/version/`;
|
|
331
|
+
const json = await (0, import_network.fetchData)(
|
|
332
|
+
{
|
|
333
|
+
url: httpURL,
|
|
334
|
+
headers
|
|
335
|
+
},
|
|
336
|
+
async (_, resp) => new Error(`Unexpected status ${resp.statusCode} when connecting to ${httpURL}.
|
|
337
|
+
This does not look like a DevTools server, try connecting via ws://.`)
|
|
338
|
+
);
|
|
323
339
|
return JSON.parse(json).webSocketDebuggerUrl;
|
|
324
340
|
}
|
|
325
341
|
async function seleniumErrorHandler(params, response) {
|
|
@@ -328,19 +344,21 @@ async function seleniumErrorHandler(params, response) {
|
|
|
328
344
|
try {
|
|
329
345
|
const json = JSON.parse(body);
|
|
330
346
|
message = json.value.localizedMessage || json.value.message;
|
|
331
|
-
} catch (e) {
|
|
347
|
+
} catch (e) {
|
|
348
|
+
}
|
|
332
349
|
return new Error(`Error connecting to Selenium at ${params.url}: ${message}`);
|
|
333
350
|
}
|
|
334
351
|
function addProtocol(url) {
|
|
335
|
-
if (![
|
|
352
|
+
if (!["ws://", "wss://", "http://", "https://"].some((protocol) => url.startsWith(protocol)))
|
|
353
|
+
return "http://" + url;
|
|
336
354
|
return url;
|
|
337
355
|
}
|
|
338
356
|
function streamToString(stream) {
|
|
339
357
|
return new Promise((resolve, reject) => {
|
|
340
358
|
const chunks = [];
|
|
341
|
-
stream.on(
|
|
342
|
-
stream.on(
|
|
343
|
-
stream.on(
|
|
359
|
+
stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
360
|
+
stream.on("error", reject);
|
|
361
|
+
stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
|
|
344
362
|
});
|
|
345
363
|
}
|
|
346
364
|
function parseSeleniumRemoteParams(env, progress) {
|
|
@@ -351,4 +369,8 @@ function parseSeleniumRemoteParams(env, progress) {
|
|
|
351
369
|
} catch (e) {
|
|
352
370
|
progress.log(`<selenium> ignoring additional ${env.name} "${env.value}": ${e}`);
|
|
353
371
|
}
|
|
354
|
-
}
|
|
372
|
+
}
|
|
373
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
374
|
+
0 && (module.exports = {
|
|
375
|
+
Chromium
|
|
376
|
+
});
|