webdriverio 9.14.0 → 9.16.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/build/commands/browser/action.d.ts +1 -1
- package/build/commands/browser/custom$.d.ts.map +1 -1
- package/build/commands/browser/debug.d.ts +1 -1
- package/build/commands/browser/debug.d.ts.map +1 -1
- package/build/commands/browser/execute.d.ts +2 -1
- package/build/commands/browser/execute.d.ts.map +1 -1
- package/build/commands/browser/executeAsync.d.ts +16 -1
- package/build/commands/browser/executeAsync.d.ts.map +1 -1
- package/build/commands/browser/getWindowSize.d.ts.map +1 -1
- package/build/commands/browser/keys.d.ts +2 -2
- package/build/commands/browser/keys.d.ts.map +1 -1
- package/build/commands/browser/mockClearAll.d.ts.map +1 -1
- package/build/commands/browser/mockRestoreAll.d.ts.map +1 -1
- package/build/commands/browser/pause.d.ts +1 -1
- package/build/commands/browser/pause.d.ts.map +1 -1
- package/build/commands/browser/react$$.d.ts.map +1 -1
- package/build/commands/browser/react$.d.ts.map +1 -1
- package/build/commands/browser/reloadSession.d.ts.map +1 -1
- package/build/commands/browser/restore.d.ts.map +1 -1
- package/build/commands/browser/savePDF.d.ts.map +1 -1
- package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -1
- package/build/commands/browser/saveScreenshot.d.ts.map +1 -1
- package/build/commands/browser/scroll.d.ts +1 -1
- package/build/commands/browser/scroll.d.ts.map +1 -1
- package/build/commands/browser/setCookies.d.ts.map +1 -1
- package/build/commands/browser/setViewport.d.ts.map +1 -1
- package/build/commands/browser/setWindowSize.d.ts.map +1 -1
- package/build/commands/browser/switchFrame.d.ts.map +1 -1
- package/build/commands/browser/switchWindow.d.ts.map +1 -1
- package/build/commands/browser/throttle.d.ts.map +1 -1
- package/build/commands/browser/throttleCPU.d.ts.map +1 -1
- package/build/commands/browser/throttleNetwork.d.ts +1 -1
- package/build/commands/browser/throttleNetwork.d.ts.map +1 -1
- package/build/commands/browser/touchAction.d.ts.map +1 -1
- package/build/commands/element/addValue.d.ts +3 -1
- package/build/commands/element/addValue.d.ts.map +1 -1
- package/build/commands/element/execute.d.ts +2 -1
- package/build/commands/element/execute.d.ts.map +1 -1
- package/build/commands/element/executeAsync.d.ts +24 -1
- package/build/commands/element/executeAsync.d.ts.map +1 -1
- package/build/commands/element/getHTML.d.ts.map +1 -1
- package/build/commands/element/isStable.d.ts +20 -2
- package/build/commands/element/isStable.d.ts.map +1 -1
- package/build/commands/element/setValue.d.ts +3 -1
- package/build/commands/element/setValue.d.ts.map +1 -1
- package/build/commands/element/shadow$$.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +131 -125
- package/build/node.js +104 -105
- package/build/scripts/polyfill.d.ts +10 -0
- package/build/scripts/polyfill.d.ts.map +1 -0
- package/build/scripts/polyfill.js +12 -0
- package/build/session/polyfill.d.ts +0 -9
- package/build/session/polyfill.d.ts.map +1 -1
- package/build/types.d.ts +14 -5
- package/build/types.d.ts.map +1 -1
- package/build/utils/index.d.ts +1 -1
- package/package.json +8 -8
package/build/index.js
CHANGED
|
@@ -3345,77 +3345,15 @@ function byContextId(context, contextId) {
|
|
|
3345
3345
|
return context.context === contextId;
|
|
3346
3346
|
}
|
|
3347
3347
|
|
|
3348
|
-
// src/
|
|
3349
|
-
import logger4 from "@wdio/logger";
|
|
3350
|
-
function getPolyfillManager(browser2) {
|
|
3351
|
-
return SessionManager.getSessionManager(browser2, PolyfillManager);
|
|
3352
|
-
}
|
|
3353
|
-
var log4 = logger4("webdriverio:PolyfillManager");
|
|
3348
|
+
// src/scripts/polyfill.ts
|
|
3354
3349
|
var polyfillFn = function webdriverioPolyfill() {
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
return __defProp2(target, "name", { value, configurable: true });
|
|
3350
|
+
var __defProp2 = Object.defineProperty;
|
|
3351
|
+
var __name = function(target, _value) {
|
|
3352
|
+
return __defProp2(target, "name", { value: _value, configurable: true });
|
|
3358
3353
|
};
|
|
3359
|
-
|
|
3354
|
+
var __globalThis = typeof globalThis === "object" && globalThis || typeof window === "object" && window;
|
|
3360
3355
|
__globalThis.__name = __name;
|
|
3361
3356
|
};
|
|
3362
|
-
var _initialize, _browser4, _scriptsRegisteredInContexts, _PolyfillManager_instances, registerScripts_fn;
|
|
3363
|
-
var _PolyfillManager = class _PolyfillManager extends SessionManager {
|
|
3364
|
-
constructor(browser2) {
|
|
3365
|
-
super(browser2, _PolyfillManager.name);
|
|
3366
|
-
__privateAdd(this, _PolyfillManager_instances);
|
|
3367
|
-
__privateAdd(this, _initialize);
|
|
3368
|
-
__privateAdd(this, _browser4);
|
|
3369
|
-
__privateAdd(this, _scriptsRegisteredInContexts, /* @__PURE__ */ new Set());
|
|
3370
|
-
__privateSet(this, _browser4, browser2);
|
|
3371
|
-
if (!this.isEnabled()) {
|
|
3372
|
-
__privateSet(this, _initialize, Promise.resolve(true));
|
|
3373
|
-
return;
|
|
3374
|
-
}
|
|
3375
|
-
__privateGet(this, _browser4).on("browsingContext.contextCreated", __privateMethod(this, _PolyfillManager_instances, registerScripts_fn).bind(this));
|
|
3376
|
-
__privateSet(this, _initialize, Promise.all([
|
|
3377
|
-
__privateGet(this, _browser4).browsingContextGetTree({}).then(({ contexts }) => {
|
|
3378
|
-
return Promise.all(contexts.map((context) => __privateMethod(this, _PolyfillManager_instances, registerScripts_fn).call(this, context)));
|
|
3379
|
-
}),
|
|
3380
|
-
__privateGet(this, _browser4).sessionSubscribe({
|
|
3381
|
-
events: ["browsingContext.contextCreated"]
|
|
3382
|
-
})
|
|
3383
|
-
]).then(() => true, () => false));
|
|
3384
|
-
}
|
|
3385
|
-
removeListeners() {
|
|
3386
|
-
super.removeListeners();
|
|
3387
|
-
__privateGet(this, _browser4).off("browsingContext.contextCreated", __privateMethod(this, _PolyfillManager_instances, registerScripts_fn).bind(this));
|
|
3388
|
-
}
|
|
3389
|
-
async initialize() {
|
|
3390
|
-
return __privateGet(this, _initialize);
|
|
3391
|
-
}
|
|
3392
|
-
};
|
|
3393
|
-
_initialize = new WeakMap();
|
|
3394
|
-
_browser4 = new WeakMap();
|
|
3395
|
-
_scriptsRegisteredInContexts = new WeakMap();
|
|
3396
|
-
_PolyfillManager_instances = new WeakSet();
|
|
3397
|
-
registerScripts_fn = function(context) {
|
|
3398
|
-
if (__privateGet(this, _scriptsRegisteredInContexts).has(context.context)) {
|
|
3399
|
-
return;
|
|
3400
|
-
}
|
|
3401
|
-
const functionDeclaration = createFunctionDeclarationFromString(polyfillFn);
|
|
3402
|
-
log4.info("Adding polyfill script to context with id ".concat(context.context));
|
|
3403
|
-
__privateGet(this, _scriptsRegisteredInContexts).add(context.context);
|
|
3404
|
-
return Promise.all([
|
|
3405
|
-
!context.parent ? __privateGet(this, _browser4).scriptAddPreloadScript({
|
|
3406
|
-
functionDeclaration,
|
|
3407
|
-
contexts: [context.context]
|
|
3408
|
-
}).catch(() => {
|
|
3409
|
-
}) : Promise.resolve(),
|
|
3410
|
-
__privateGet(this, _browser4).scriptCallFunction({
|
|
3411
|
-
functionDeclaration,
|
|
3412
|
-
target: context,
|
|
3413
|
-
awaitPromise: false
|
|
3414
|
-
}).catch(() => {
|
|
3415
|
-
})
|
|
3416
|
-
]);
|
|
3417
|
-
};
|
|
3418
|
-
var PolyfillManager = _PolyfillManager;
|
|
3419
3357
|
|
|
3420
3358
|
// src/commands/browser/execute.ts
|
|
3421
3359
|
async function execute(script, ...args) {
|
|
@@ -3475,8 +3413,8 @@ async function executeAsync(script, ...args) {
|
|
|
3475
3413
|
}
|
|
3476
3414
|
|
|
3477
3415
|
// src/commands/browser/getCookies.ts
|
|
3478
|
-
import
|
|
3479
|
-
var
|
|
3416
|
+
import logger4 from "@wdio/logger";
|
|
3417
|
+
var log4 = logger4("webdriverio");
|
|
3480
3418
|
async function getCookies(filter) {
|
|
3481
3419
|
const usesMultipleFilter = Array.isArray(filter) && filter.length > 1;
|
|
3482
3420
|
if (!this.isBidi || usesMultipleFilter) {
|
|
@@ -3495,7 +3433,7 @@ async function getCookiesClassic(names) {
|
|
|
3495
3433
|
}
|
|
3496
3434
|
const usesMultipleFilter = Array.isArray(names) && names.length > 1;
|
|
3497
3435
|
if (usesMultipleFilter) {
|
|
3498
|
-
|
|
3436
|
+
log4.warn(
|
|
3499
3437
|
"Passing a string array as filter for `getCookies` is deprecated and its support will be removed in an upcoming version of WebdriverIO!"
|
|
3500
3438
|
);
|
|
3501
3439
|
const allCookies2 = await this.getAllCookies();
|
|
@@ -3517,7 +3455,7 @@ function getCookieFilter(names) {
|
|
|
3517
3455
|
}
|
|
3518
3456
|
return (Array.isArray(names) ? names : [names]).map((filter) => {
|
|
3519
3457
|
if (typeof filter === "string") {
|
|
3520
|
-
|
|
3458
|
+
log4.warn("Passing string values into `getCookie` is deprecated and its support will be removed in an upcoming version of WebdriverIO!");
|
|
3521
3459
|
return { name: filter };
|
|
3522
3460
|
}
|
|
3523
3461
|
return filter;
|
|
@@ -3525,9 +3463,9 @@ function getCookieFilter(names) {
|
|
|
3525
3463
|
}
|
|
3526
3464
|
|
|
3527
3465
|
// src/commands/browser/getPuppeteer.ts
|
|
3528
|
-
import
|
|
3466
|
+
import logger5 from "@wdio/logger";
|
|
3529
3467
|
import { userImport } from "@wdio/utils";
|
|
3530
|
-
var
|
|
3468
|
+
var log5 = logger5("webdriverio");
|
|
3531
3469
|
var DEBUG_PIPE_FLAG = "remote-debugging-pipe";
|
|
3532
3470
|
async function getPuppeteer() {
|
|
3533
3471
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -3541,7 +3479,7 @@ async function getPuppeteer() {
|
|
|
3541
3479
|
);
|
|
3542
3480
|
}
|
|
3543
3481
|
if ((_a = this.puppeteer) == null ? void 0 : _a.connected) {
|
|
3544
|
-
|
|
3482
|
+
log5.debug("Reusing existing puppeteer session");
|
|
3545
3483
|
return this.puppeteer;
|
|
3546
3484
|
}
|
|
3547
3485
|
const { headers } = this.options;
|
|
@@ -3651,7 +3589,7 @@ async function keys(value) {
|
|
|
3651
3589
|
import { getBrowserObject as getBrowserObject6 } from "@wdio/utils";
|
|
3652
3590
|
|
|
3653
3591
|
// src/utils/interception/index.ts
|
|
3654
|
-
import
|
|
3592
|
+
import logger6 from "@wdio/logger";
|
|
3655
3593
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3656
3594
|
|
|
3657
3595
|
// src/utils/Timer.ts
|
|
@@ -3824,16 +3762,16 @@ function getPatternParam(pattern, key) {
|
|
|
3824
3762
|
}
|
|
3825
3763
|
|
|
3826
3764
|
// src/utils/interception/index.ts
|
|
3827
|
-
var
|
|
3765
|
+
var log6 = logger6("WebDriverInterception");
|
|
3828
3766
|
var hasSubscribedToEvents = false;
|
|
3829
|
-
var _pattern, _mockId, _filterOptions,
|
|
3767
|
+
var _pattern, _mockId, _filterOptions, _browser4, _eventHandler, _restored, _requestOverwrites, _respondOverwrites, _calls, _responseBodies, _WebDriverInterception_instances, emit_fn, addEventHandler_fn, handleBeforeRequestSent_fn, handleResponseStarted_fn, handleNetworkProvideResponseError_fn, isRequestMatching_fn, matchesFilterOptions_fn, _setOverwrite, ensureNotRestored_fn;
|
|
3830
3768
|
var _WebDriverInterception = class _WebDriverInterception {
|
|
3831
3769
|
constructor(pattern, mockId, filterOptions, browser2) {
|
|
3832
3770
|
__privateAdd(this, _WebDriverInterception_instances);
|
|
3833
3771
|
__privateAdd(this, _pattern);
|
|
3834
3772
|
__privateAdd(this, _mockId);
|
|
3835
3773
|
__privateAdd(this, _filterOptions);
|
|
3836
|
-
__privateAdd(this,
|
|
3774
|
+
__privateAdd(this, _browser4);
|
|
3837
3775
|
__privateAdd(this, _eventHandler, /* @__PURE__ */ new Map());
|
|
3838
3776
|
__privateAdd(this, _restored, false);
|
|
3839
3777
|
__privateAdd(this, _requestOverwrites, []);
|
|
@@ -3849,7 +3787,7 @@ var _WebDriverInterception = class _WebDriverInterception {
|
|
|
3849
3787
|
__privateSet(this, _pattern, pattern);
|
|
3850
3788
|
__privateSet(this, _mockId, mockId);
|
|
3851
3789
|
__privateSet(this, _filterOptions, filterOptions);
|
|
3852
|
-
__privateSet(this,
|
|
3790
|
+
__privateSet(this, _browser4, browser2);
|
|
3853
3791
|
browser2.on("network.beforeRequestSent", __privateMethod(this, _WebDriverInterception_instances, handleBeforeRequestSent_fn).bind(this));
|
|
3854
3792
|
browser2.on("network.responseStarted", __privateMethod(this, _WebDriverInterception_instances, handleResponseStarted_fn).bind(this));
|
|
3855
3793
|
}
|
|
@@ -3862,7 +3800,7 @@ var _WebDriverInterception = class _WebDriverInterception {
|
|
|
3862
3800
|
"network.responseStarted"
|
|
3863
3801
|
]
|
|
3864
3802
|
});
|
|
3865
|
-
|
|
3803
|
+
log6.info("subscribed to network events");
|
|
3866
3804
|
hasSubscribedToEvents = true;
|
|
3867
3805
|
}
|
|
3868
3806
|
const interception = await browser2.networkAddIntercept({
|
|
@@ -3889,7 +3827,7 @@ var _WebDriverInterception = class _WebDriverInterception {
|
|
|
3889
3827
|
return null;
|
|
3890
3828
|
}
|
|
3891
3829
|
if (/[^A-Za-z0-9+/=\s]/.test(body.value)) {
|
|
3892
|
-
|
|
3830
|
+
log6.warn("Invalid base64 data for request ".concat(requestId));
|
|
3893
3831
|
return null;
|
|
3894
3832
|
}
|
|
3895
3833
|
return Buffer.from(body.value, "base64");
|
|
@@ -3942,11 +3880,11 @@ var _WebDriverInterception = class _WebDriverInterception {
|
|
|
3942
3880
|
this.reset();
|
|
3943
3881
|
__privateSet(this, _respondOverwrites, []);
|
|
3944
3882
|
__privateSet(this, _restored, true);
|
|
3945
|
-
const handle = await __privateGet(this,
|
|
3946
|
-
|
|
3883
|
+
const handle = await __privateGet(this, _browser4).getWindowHandle();
|
|
3884
|
+
log6.trace("Restoring mock for ".concat(handle));
|
|
3947
3885
|
SESSION_MOCKS[handle].delete(this);
|
|
3948
3886
|
if (__privateGet(this, _mockId)) {
|
|
3949
|
-
await __privateGet(this,
|
|
3887
|
+
await __privateGet(this, _browser4).networkRemoveIntercept({ intercept: __privateGet(this, _mockId) });
|
|
3950
3888
|
}
|
|
3951
3889
|
return this;
|
|
3952
3890
|
}
|
|
@@ -4026,19 +3964,19 @@ var _WebDriverInterception = class _WebDriverInterception {
|
|
|
4026
3964
|
return this;
|
|
4027
3965
|
}
|
|
4028
3966
|
waitForResponse({
|
|
4029
|
-
timeout = __privateGet(this,
|
|
4030
|
-
interval = __privateGet(this,
|
|
3967
|
+
timeout = __privateGet(this, _browser4).options.waitforTimeout,
|
|
3968
|
+
interval = __privateGet(this, _browser4).options.waitforInterval,
|
|
4031
3969
|
timeoutMsg
|
|
4032
3970
|
} = {}) {
|
|
4033
3971
|
if (typeof timeout !== "number") {
|
|
4034
|
-
timeout = __privateGet(this,
|
|
3972
|
+
timeout = __privateGet(this, _browser4).options.waitforTimeout;
|
|
4035
3973
|
}
|
|
4036
3974
|
if (typeof interval !== "number") {
|
|
4037
|
-
interval = __privateGet(this,
|
|
3975
|
+
interval = __privateGet(this, _browser4).options.waitforInterval;
|
|
4038
3976
|
}
|
|
4039
3977
|
const fn = async () => this.calls && (await this.calls).length > 0;
|
|
4040
3978
|
const timer = new Timer_default(interval, timeout, fn, true);
|
|
4041
|
-
return __privateGet(this,
|
|
3979
|
+
return __privateGet(this, _browser4).call(() => timer.catch((e) => {
|
|
4042
3980
|
if (e.message === "timeout") {
|
|
4043
3981
|
if (typeof timeoutMsg === "string") {
|
|
4044
3982
|
throw new Error(timeoutMsg);
|
|
@@ -4052,7 +3990,7 @@ var _WebDriverInterception = class _WebDriverInterception {
|
|
|
4052
3990
|
_pattern = new WeakMap();
|
|
4053
3991
|
_mockId = new WeakMap();
|
|
4054
3992
|
_filterOptions = new WeakMap();
|
|
4055
|
-
|
|
3993
|
+
_browser4 = new WeakMap();
|
|
4056
3994
|
_eventHandler = new WeakMap();
|
|
4057
3995
|
_restored = new WeakMap();
|
|
4058
3996
|
_requestOverwrites = new WeakMap();
|
|
@@ -4081,7 +4019,7 @@ handleBeforeRequestSent_fn = function(request) {
|
|
|
4081
4019
|
return;
|
|
4082
4020
|
}
|
|
4083
4021
|
if (!__privateMethod(this, _WebDriverInterception_instances, matchesFilterOptions_fn).call(this, request)) {
|
|
4084
|
-
return __privateGet(this,
|
|
4022
|
+
return __privateGet(this, _browser4).networkContinueRequest({
|
|
4085
4023
|
request: request.request.request
|
|
4086
4024
|
});
|
|
4087
4025
|
}
|
|
@@ -4091,16 +4029,16 @@ handleBeforeRequestSent_fn = function(request) {
|
|
|
4091
4029
|
const { overwrite, abort } = __privateGet(this, _requestOverwrites)[0].once ? __privateGet(this, _requestOverwrites).shift() || {} : __privateGet(this, _requestOverwrites)[0];
|
|
4092
4030
|
if (abort) {
|
|
4093
4031
|
__privateMethod(this, _WebDriverInterception_instances, emit_fn).call(this, "fail", request.request.request);
|
|
4094
|
-
return __privateGet(this,
|
|
4032
|
+
return __privateGet(this, _browser4).networkFailRequest({ request: request.request.request });
|
|
4095
4033
|
}
|
|
4096
4034
|
__privateMethod(this, _WebDriverInterception_instances, emit_fn).call(this, "overwrite", request);
|
|
4097
|
-
return __privateGet(this,
|
|
4035
|
+
return __privateGet(this, _browser4).networkContinueRequest({
|
|
4098
4036
|
request: request.request.request,
|
|
4099
4037
|
...overwrite ? parseOverwrite(overwrite, request) : {}
|
|
4100
4038
|
});
|
|
4101
4039
|
}
|
|
4102
4040
|
__privateMethod(this, _WebDriverInterception_instances, emit_fn).call(this, "continue", request.request.request);
|
|
4103
|
-
return __privateGet(this,
|
|
4041
|
+
return __privateGet(this, _browser4).networkContinueRequest({
|
|
4104
4042
|
request: request.request.request
|
|
4105
4043
|
});
|
|
4106
4044
|
};
|
|
@@ -4110,14 +4048,14 @@ handleResponseStarted_fn = function(request) {
|
|
|
4110
4048
|
}
|
|
4111
4049
|
if (!__privateMethod(this, _WebDriverInterception_instances, matchesFilterOptions_fn).call(this, request)) {
|
|
4112
4050
|
__privateMethod(this, _WebDriverInterception_instances, emit_fn).call(this, "continue", request.request.request);
|
|
4113
|
-
return __privateGet(this,
|
|
4051
|
+
return __privateGet(this, _browser4).networkProvideResponse({
|
|
4114
4052
|
request: request.request.request
|
|
4115
4053
|
}).catch(__privateMethod(this, _WebDriverInterception_instances, handleNetworkProvideResponseError_fn));
|
|
4116
4054
|
}
|
|
4117
4055
|
__privateGet(this, _calls).push(request);
|
|
4118
4056
|
if (__privateGet(this, _respondOverwrites).length === 0 || !__privateGet(this, _respondOverwrites)[0].overwrite) {
|
|
4119
4057
|
__privateMethod(this, _WebDriverInterception_instances, emit_fn).call(this, "continue", request.request.request);
|
|
4120
|
-
return __privateGet(this,
|
|
4058
|
+
return __privateGet(this, _browser4).networkProvideResponse({
|
|
4121
4059
|
request: request.request.request
|
|
4122
4060
|
}).catch(__privateMethod(this, _WebDriverInterception_instances, handleNetworkProvideResponseError_fn));
|
|
4123
4061
|
}
|
|
@@ -4128,13 +4066,13 @@ handleResponseStarted_fn = function(request) {
|
|
|
4128
4066
|
if (responseData.body) {
|
|
4129
4067
|
__privateGet(this, _responseBodies).set(request.request.request, responseData.body);
|
|
4130
4068
|
}
|
|
4131
|
-
return __privateGet(this,
|
|
4069
|
+
return __privateGet(this, _browser4).networkProvideResponse({
|
|
4132
4070
|
request: request.request.request,
|
|
4133
4071
|
...responseData
|
|
4134
4072
|
}).catch(__privateMethod(this, _WebDriverInterception_instances, handleNetworkProvideResponseError_fn));
|
|
4135
4073
|
}
|
|
4136
4074
|
__privateMethod(this, _WebDriverInterception_instances, emit_fn).call(this, "continue", request.request.request);
|
|
4137
|
-
return __privateGet(this,
|
|
4075
|
+
return __privateGet(this, _browser4).networkProvideResponse({
|
|
4138
4076
|
request: request.request.request
|
|
4139
4077
|
}).catch(__privateMethod(this, _WebDriverInterception_instances, handleNetworkProvideResponseError_fn));
|
|
4140
4078
|
};
|
|
@@ -4224,11 +4162,11 @@ async function mock(url2, filterOptions) {
|
|
|
4224
4162
|
}
|
|
4225
4163
|
|
|
4226
4164
|
// src/commands/browser/mockClearAll.ts
|
|
4227
|
-
import
|
|
4228
|
-
var
|
|
4165
|
+
import logger7 from "@wdio/logger";
|
|
4166
|
+
var log7 = logger7("webdriverio:mockClearAll");
|
|
4229
4167
|
async function mockClearAll() {
|
|
4230
4168
|
for (const [handle, mocks] of Object.entries(SESSION_MOCKS)) {
|
|
4231
|
-
|
|
4169
|
+
log7.trace("Clearing mocks for ".concat(handle));
|
|
4232
4170
|
for (const mock2 of mocks) {
|
|
4233
4171
|
mock2.clear();
|
|
4234
4172
|
}
|
|
@@ -4236,11 +4174,11 @@ async function mockClearAll() {
|
|
|
4236
4174
|
}
|
|
4237
4175
|
|
|
4238
4176
|
// src/commands/browser/mockRestoreAll.ts
|
|
4239
|
-
import
|
|
4240
|
-
var
|
|
4177
|
+
import logger8 from "@wdio/logger";
|
|
4178
|
+
var log8 = logger8("webdriverio:mockRestoreAll");
|
|
4241
4179
|
async function mockRestoreAll() {
|
|
4242
4180
|
for (const [handle, mocks] of Object.entries(SESSION_MOCKS)) {
|
|
4243
|
-
|
|
4181
|
+
log8.trace("Clearing mocks for ".concat(handle));
|
|
4244
4182
|
for (const mock2 of mocks) {
|
|
4245
4183
|
await mock2.restore();
|
|
4246
4184
|
}
|
|
@@ -4256,8 +4194,8 @@ function newWindow(url2, windowName, windowFeatures) {
|
|
|
4256
4194
|
}
|
|
4257
4195
|
|
|
4258
4196
|
// src/commands/browser/newWindow.ts
|
|
4259
|
-
import
|
|
4260
|
-
var
|
|
4197
|
+
import logger9 from "@wdio/logger";
|
|
4198
|
+
var log9 = logger9("webdriverio:newWindow");
|
|
4261
4199
|
var WAIT_FOR_NEW_HANDLE_TIMEOUT = 3e3;
|
|
4262
4200
|
async function newWindow2(url2, { type = "window", windowName = "", windowFeatures = "" } = {}) {
|
|
4263
4201
|
if (typeof url2 !== "string") {
|
|
@@ -4267,7 +4205,7 @@ async function newWindow2(url2, { type = "window", windowName = "", windowFeatur
|
|
|
4267
4205
|
throw new Error("Invalid type '".concat(type, "' provided to newWindow command. Use either 'tab' or 'window'"));
|
|
4268
4206
|
}
|
|
4269
4207
|
if (windowName || windowFeatures) {
|
|
4270
|
-
|
|
4208
|
+
log9.warn('The "windowName" and "windowFeatures" options are deprecated and only supported in WebDriver Classic sessions.');
|
|
4271
4209
|
}
|
|
4272
4210
|
if (this.isMobile) {
|
|
4273
4211
|
throw new Error("newWindow command is not supported on mobile platforms");
|
|
@@ -4374,6 +4312,70 @@ async function react$3(selector, { props = {}, state = {} } = {}) {
|
|
|
4374
4312
|
// src/commands/browser/reloadSession.ts
|
|
4375
4313
|
import logger12 from "@wdio/logger";
|
|
4376
4314
|
|
|
4315
|
+
// src/session/polyfill.ts
|
|
4316
|
+
import logger10 from "@wdio/logger";
|
|
4317
|
+
function getPolyfillManager(browser2) {
|
|
4318
|
+
return SessionManager.getSessionManager(browser2, PolyfillManager);
|
|
4319
|
+
}
|
|
4320
|
+
var log10 = logger10("webdriverio:PolyfillManager");
|
|
4321
|
+
var _initialize, _browser5, _scriptsRegisteredInContexts, _PolyfillManager_instances, registerScripts_fn;
|
|
4322
|
+
var _PolyfillManager = class _PolyfillManager extends SessionManager {
|
|
4323
|
+
constructor(browser2) {
|
|
4324
|
+
super(browser2, _PolyfillManager.name);
|
|
4325
|
+
__privateAdd(this, _PolyfillManager_instances);
|
|
4326
|
+
__privateAdd(this, _initialize);
|
|
4327
|
+
__privateAdd(this, _browser5);
|
|
4328
|
+
__privateAdd(this, _scriptsRegisteredInContexts, /* @__PURE__ */ new Set());
|
|
4329
|
+
__privateSet(this, _browser5, browser2);
|
|
4330
|
+
if (!this.isEnabled()) {
|
|
4331
|
+
__privateSet(this, _initialize, Promise.resolve(true));
|
|
4332
|
+
return;
|
|
4333
|
+
}
|
|
4334
|
+
__privateGet(this, _browser5).on("browsingContext.contextCreated", __privateMethod(this, _PolyfillManager_instances, registerScripts_fn).bind(this));
|
|
4335
|
+
__privateSet(this, _initialize, Promise.all([
|
|
4336
|
+
__privateGet(this, _browser5).browsingContextGetTree({}).then(({ contexts }) => {
|
|
4337
|
+
return Promise.all(contexts.map((context) => __privateMethod(this, _PolyfillManager_instances, registerScripts_fn).call(this, context)));
|
|
4338
|
+
}),
|
|
4339
|
+
__privateGet(this, _browser5).sessionSubscribe({
|
|
4340
|
+
events: ["browsingContext.contextCreated"]
|
|
4341
|
+
})
|
|
4342
|
+
]).then(() => true, () => false));
|
|
4343
|
+
}
|
|
4344
|
+
removeListeners() {
|
|
4345
|
+
super.removeListeners();
|
|
4346
|
+
__privateGet(this, _browser5).off("browsingContext.contextCreated", __privateMethod(this, _PolyfillManager_instances, registerScripts_fn).bind(this));
|
|
4347
|
+
}
|
|
4348
|
+
async initialize() {
|
|
4349
|
+
return __privateGet(this, _initialize);
|
|
4350
|
+
}
|
|
4351
|
+
};
|
|
4352
|
+
_initialize = new WeakMap();
|
|
4353
|
+
_browser5 = new WeakMap();
|
|
4354
|
+
_scriptsRegisteredInContexts = new WeakMap();
|
|
4355
|
+
_PolyfillManager_instances = new WeakSet();
|
|
4356
|
+
registerScripts_fn = function(context) {
|
|
4357
|
+
if (__privateGet(this, _scriptsRegisteredInContexts).has(context.context)) {
|
|
4358
|
+
return;
|
|
4359
|
+
}
|
|
4360
|
+
const functionDeclaration = createFunctionDeclarationFromString(polyfillFn);
|
|
4361
|
+
log10.info("Adding polyfill script to context with id ".concat(context.context));
|
|
4362
|
+
__privateGet(this, _scriptsRegisteredInContexts).add(context.context);
|
|
4363
|
+
return Promise.all([
|
|
4364
|
+
!context.parent ? __privateGet(this, _browser5).scriptAddPreloadScript({
|
|
4365
|
+
functionDeclaration,
|
|
4366
|
+
contexts: [context.context]
|
|
4367
|
+
}).catch(() => {
|
|
4368
|
+
}) : Promise.resolve(),
|
|
4369
|
+
__privateGet(this, _browser5).scriptCallFunction({
|
|
4370
|
+
functionDeclaration,
|
|
4371
|
+
target: context,
|
|
4372
|
+
awaitPromise: false
|
|
4373
|
+
}).catch(() => {
|
|
4374
|
+
})
|
|
4375
|
+
]);
|
|
4376
|
+
};
|
|
4377
|
+
var PolyfillManager = _PolyfillManager;
|
|
4378
|
+
|
|
4377
4379
|
// src/session/shadowRoot.ts
|
|
4378
4380
|
import logger11 from "@wdio/logger";
|
|
4379
4381
|
|
|
@@ -5083,7 +5085,8 @@ import logger13 from "@wdio/logger";
|
|
|
5083
5085
|
var log13 = logger13("webdriverio");
|
|
5084
5086
|
function scroll(x = 0, y = 0) {
|
|
5085
5087
|
if (!x && !y) {
|
|
5086
|
-
|
|
5088
|
+
log13.warn('"scroll" command was called with no parameters, skipping execution');
|
|
5089
|
+
return Promise.resolve();
|
|
5087
5090
|
}
|
|
5088
5091
|
if (this.isMobile) {
|
|
5089
5092
|
return this.execute((x2, y2) => window.scrollBy(x2, y2), x, y);
|
|
@@ -5508,7 +5511,7 @@ async function throttleNetwork(params) {
|
|
|
5508
5511
|
if (this.isSauce) {
|
|
5509
5512
|
const browser2 = getBrowserObject9(this);
|
|
5510
5513
|
await browser2.sauceThrottleNetwork(params);
|
|
5511
|
-
return
|
|
5514
|
+
return;
|
|
5512
5515
|
}
|
|
5513
5516
|
const failedConnectionMessage = "No Puppeteer connection could be established which is required to use this command";
|
|
5514
5517
|
await this.getPuppeteer();
|
|
@@ -5524,7 +5527,7 @@ async function throttleNetwork(params) {
|
|
|
5524
5527
|
"Network.emulateNetworkConditions",
|
|
5525
5528
|
typeof params === "string" ? NETWORK_PRESETS[params] : params
|
|
5526
5529
|
);
|
|
5527
|
-
return
|
|
5530
|
+
return;
|
|
5528
5531
|
}
|
|
5529
5532
|
|
|
5530
5533
|
// src/commands/browser/touchAction.ts
|
|
@@ -6272,13 +6275,17 @@ var $$2 = $$;
|
|
|
6272
6275
|
var $2 = $;
|
|
6273
6276
|
|
|
6274
6277
|
// src/commands/element/addValue.ts
|
|
6278
|
+
import { CommandRuntimeOptions } from "webdriver";
|
|
6275
6279
|
var VALID_TYPES = ["string", "number"];
|
|
6276
|
-
function addValue(value) {
|
|
6280
|
+
function addValue(value, options) {
|
|
6277
6281
|
if (!VALID_TYPES.includes(typeof value)) {
|
|
6278
6282
|
throw new Error(
|
|
6279
6283
|
'The setValue/addValue command only take string or number values. If you like to use special characters, use the "keys" command.'
|
|
6280
6284
|
);
|
|
6281
6285
|
}
|
|
6286
|
+
if (options) {
|
|
6287
|
+
return this.elementSendKeys(this.elementId, value.toString(), new CommandRuntimeOptions(options));
|
|
6288
|
+
}
|
|
6282
6289
|
return this.elementSendKeys(this.elementId, value.toString());
|
|
6283
6290
|
}
|
|
6284
6291
|
|
|
@@ -6447,16 +6454,18 @@ async function dragAndDrop(target, options = {}) {
|
|
|
6447
6454
|
// src/commands/element/execute.ts
|
|
6448
6455
|
import { getBrowserObject as getBrowserObject17 } from "@wdio/utils";
|
|
6449
6456
|
async function execute2(script, ...args) {
|
|
6450
|
-
const
|
|
6451
|
-
|
|
6452
|
-
|
|
6457
|
+
const scope = this;
|
|
6458
|
+
const browser2 = getBrowserObject17(scope);
|
|
6459
|
+
await scope.waitForExist();
|
|
6460
|
+
return browser2.execute(script, scope, ...args);
|
|
6453
6461
|
}
|
|
6454
6462
|
|
|
6455
6463
|
// src/commands/element/executeAsync.ts
|
|
6456
6464
|
import { getBrowserObject as getBrowserObject18 } from "@wdio/utils";
|
|
6457
6465
|
async function executeAsync2(script, ...args) {
|
|
6458
|
-
const
|
|
6459
|
-
|
|
6466
|
+
const scope = this;
|
|
6467
|
+
const browser2 = getBrowserObject18(scope);
|
|
6468
|
+
return browser2.executeAsync(script, scope, ...args);
|
|
6460
6469
|
}
|
|
6461
6470
|
|
|
6462
6471
|
// src/commands/element/getAttribute.ts
|
|
@@ -6637,9 +6646,8 @@ async function getHTML2(options = {}) {
|
|
|
6637
6646
|
{ [ELEMENT_KEY12]: elemId },
|
|
6638
6647
|
shadowId ? { [ELEMENT_KEY12]: shadowId } : void 0
|
|
6639
6648
|
]);
|
|
6640
|
-
const { html, shadowElementHTML } = await
|
|
6649
|
+
const { html, shadowElementHTML } = await this.execute(
|
|
6641
6650
|
getHTMLShadow,
|
|
6642
|
-
{ [ELEMENT_KEY12]: this.elementId },
|
|
6643
6651
|
includeSelectorTag,
|
|
6644
6652
|
elementsWithShadowRootAndIdVerified
|
|
6645
6653
|
);
|
|
@@ -7508,9 +7516,9 @@ async function selectByVisibleText(text) {
|
|
|
7508
7516
|
}
|
|
7509
7517
|
|
|
7510
7518
|
// src/commands/element/setValue.ts
|
|
7511
|
-
async function setValue(value) {
|
|
7519
|
+
async function setValue(value, options) {
|
|
7512
7520
|
await this.clearValue();
|
|
7513
|
-
return this.addValue(value);
|
|
7521
|
+
return this.addValue(value, options);
|
|
7514
7522
|
}
|
|
7515
7523
|
|
|
7516
7524
|
// src/commands/element/shadow$$.ts
|
|
@@ -9060,10 +9068,8 @@ var remote = async function(params, remoteModifier) {
|
|
|
9060
9068
|
const prototype = getPrototype("browser");
|
|
9061
9069
|
const instance = await Driver.newSession(options, modifier, prototype, wrapCommand3);
|
|
9062
9070
|
if (params.framework && !isStub(params.automationProtocol)) {
|
|
9063
|
-
|
|
9064
|
-
instance.
|
|
9065
|
-
const origOverwriteCommand = instance.overwriteCommand.bind(instance);
|
|
9066
|
-
instance.overwriteCommand = (name, fn, attachToElement) => origOverwriteCommand(name, fn, attachToElement);
|
|
9071
|
+
instance.addCommand = instance.addCommand.bind(instance);
|
|
9072
|
+
instance.overwriteCommand = instance.overwriteCommand.bind(instance);
|
|
9067
9073
|
}
|
|
9068
9074
|
instance.addLocatorStrategy = addLocatorStrategyHandler(instance);
|
|
9069
9075
|
await registerSessionManager(instance);
|
|
@@ -9121,7 +9127,7 @@ var multiremote = async function(params, { automationProtocol } = {}) {
|
|
|
9121
9127
|
const origAddCommand = driver.addCommand.bind(driver);
|
|
9122
9128
|
driver.addCommand = (name, fn, attachToElement) => {
|
|
9123
9129
|
driver.instances.forEach(
|
|
9124
|
-
(
|
|
9130
|
+
(instanceName) => driver.getInstance(instanceName).addCommand(name, fn, attachToElement)
|
|
9125
9131
|
);
|
|
9126
9132
|
return origAddCommand(
|
|
9127
9133
|
name,
|