webdriverio 9.2.6 → 9.2.11
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchFrame.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchFrame.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,KAAK,EAAe,MAAM,WAAW,CAAA;AAOhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAE7D,KAAK,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAG3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,uBAAuB,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"switchFrame.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchFrame.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,KAAK,EAAe,MAAM,WAAW,CAAA;AAOhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAE7D,KAAK,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAG3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,uBAAuB,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,0BA4OnI"}
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
// open url
|
|
9
9
|
await browser.url('https://google.com')
|
|
10
10
|
|
|
11
|
+
// get window handle
|
|
12
|
+
const handle = await browser.getWindowHandle()
|
|
13
|
+
|
|
11
14
|
// create new window
|
|
12
15
|
await browser.newWindow('https://webdriver.io')
|
|
13
16
|
|
|
@@ -16,10 +19,13 @@
|
|
|
16
19
|
|
|
17
20
|
// switch back via title match
|
|
18
21
|
await browser.switchWindow('Next-gen browser and mobile automation test framework for Node.js')
|
|
22
|
+
|
|
23
|
+
// switch back via window handle
|
|
24
|
+
await browser.switchWindow(handle)
|
|
19
25
|
});
|
|
20
26
|
* </example>
|
|
21
27
|
*
|
|
22
|
-
* @param {String|RegExp} matcher String or regular expression that matches the title
|
|
28
|
+
* @param {String|RegExp} matcher String or regular expression that matches either the page title or URL, the window name, or the window handle
|
|
23
29
|
*
|
|
24
30
|
* @uses protocol/getWindowHandles, protocol/switchToWindow, protocol/getUrl, protocol/getTitle
|
|
25
31
|
* @alias browser.switchTab
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchWindow.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"switchWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchWindow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,MAAM,GAAG,MAAM,mBAkE3B"}
|
package/build/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,kBAS7D;AAED;;;;GAIG;AACH,qBAAa,cAAc;;gBAIX,OAAO,EAAE,WAAW,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,kBAS7D;AAED;;;;GAIG;AACH,qBAAa,cAAc;;gBAIX,OAAO,EAAE,WAAW,CAAC,OAAO;IAwCxC;;OAEG;IACG,UAAU;IAUhB,iBAAiB,CAAE,OAAO,EAAE,MAAM;IAI5B,iBAAiB;CAM1B"}
|
package/build/index.js
CHANGED
|
@@ -2996,7 +2996,7 @@ var ContextManager = class {
|
|
|
2996
2996
|
if (event.command === "switchToWindow") {
|
|
2997
2997
|
this.setCurrentContext(event.body.handle);
|
|
2998
2998
|
}
|
|
2999
|
-
if (event.command === "switchToParentFrame") {
|
|
2999
|
+
if (event.command === "switchToParentFrame" || event.command === "refresh") {
|
|
3000
3000
|
this.#currentContext = void 0;
|
|
3001
3001
|
}
|
|
3002
3002
|
});
|
|
@@ -4139,17 +4139,25 @@ async function setWindowSize(width, height) {
|
|
|
4139
4139
|
// src/commands/browser/switchWindow.ts
|
|
4140
4140
|
async function switchWindow(matcher) {
|
|
4141
4141
|
if (typeof matcher !== "string" && !(matcher instanceof RegExp)) {
|
|
4142
|
-
throw new Error('Unsupported parameter for switchWindow, required is "string" or
|
|
4142
|
+
throw new Error('Unsupported parameter for switchWindow, required is "string" or a RegExp');
|
|
4143
4143
|
}
|
|
4144
4144
|
const currentWindow = await this.getWindowHandle();
|
|
4145
|
+
if (typeof matcher === "string" && currentWindow === matcher) {
|
|
4146
|
+
return currentWindow;
|
|
4147
|
+
}
|
|
4148
|
+
const contextManager2 = getContextManager(this);
|
|
4145
4149
|
const tabs = await this.getWindowHandles();
|
|
4150
|
+
if (typeof matcher === "string" && tabs.includes(matcher)) {
|
|
4151
|
+
await this.switchToWindow(matcher);
|
|
4152
|
+
contextManager2.setCurrentContext(matcher);
|
|
4153
|
+
return matcher;
|
|
4154
|
+
}
|
|
4146
4155
|
const matchesTarget = (target) => {
|
|
4147
4156
|
if (typeof matcher === "string") {
|
|
4148
4157
|
return target.includes(matcher);
|
|
4149
4158
|
}
|
|
4150
4159
|
return !!target.match(matcher);
|
|
4151
4160
|
};
|
|
4152
|
-
const contextManager2 = getContextManager(this);
|
|
4153
4161
|
for (const tab of tabs) {
|
|
4154
4162
|
await this.switchToWindow(tab);
|
|
4155
4163
|
contextManager2.setCurrentContext(tab);
|
|
@@ -4170,7 +4178,7 @@ async function switchWindow(matcher) {
|
|
|
4170
4178
|
}
|
|
4171
4179
|
}
|
|
4172
4180
|
await this.switchToWindow(currentWindow);
|
|
4173
|
-
throw new Error(`No window found with title, url or
|
|
4181
|
+
throw new Error(`No window found with title, url, name or window handle matching "${matcher}"`);
|
|
4174
4182
|
}
|
|
4175
4183
|
|
|
4176
4184
|
// src/commands/browser/switchFrame.ts
|
|
@@ -4178,6 +4186,9 @@ import logger13 from "@wdio/logger";
|
|
|
4178
4186
|
import { ELEMENT_KEY as ELEMENT_KEY8 } from "webdriver";
|
|
4179
4187
|
var log13 = logger13("webdriverio:switchFrame");
|
|
4180
4188
|
async function switchFrame(context) {
|
|
4189
|
+
function isPossiblyUnresolvedElement(input) {
|
|
4190
|
+
return typeof input === "object" && typeof input.getElement === "function";
|
|
4191
|
+
}
|
|
4181
4192
|
if (!this.isBidi) {
|
|
4182
4193
|
if (typeof context === "function") {
|
|
4183
4194
|
throw new Error("Cannot use a function to fetch a context in WebDriver Classic");
|
|
@@ -4185,6 +4196,13 @@ async function switchFrame(context) {
|
|
|
4185
4196
|
if (typeof context === "string") {
|
|
4186
4197
|
throw new Error("Cannot use a string to fetch a context in WebDriver Classic");
|
|
4187
4198
|
}
|
|
4199
|
+
if (isPossiblyUnresolvedElement(context)) {
|
|
4200
|
+
const element = await context.getElement();
|
|
4201
|
+
await element.waitForExist({
|
|
4202
|
+
timeoutMsg: `Can't switch to frame with selector ${element.selector} because it doesn't exist`
|
|
4203
|
+
});
|
|
4204
|
+
return switchToFrame(this, element);
|
|
4205
|
+
}
|
|
4188
4206
|
return switchToFrame(this, context);
|
|
4189
4207
|
}
|
|
4190
4208
|
if (context === null) {
|
|
@@ -4289,8 +4307,11 @@ async function switchFrame(context) {
|
|
|
4289
4307
|
}
|
|
4290
4308
|
return newContextId;
|
|
4291
4309
|
}
|
|
4292
|
-
if (
|
|
4310
|
+
if (isPossiblyUnresolvedElement(context)) {
|
|
4293
4311
|
const element = await context.getElement();
|
|
4312
|
+
await element.waitForExist({
|
|
4313
|
+
timeoutMsg: `Can't switch to frame with selector ${element.selector} because it doesn't exist`
|
|
4314
|
+
});
|
|
4294
4315
|
return switchToFrameUsingElement(this, element);
|
|
4295
4316
|
}
|
|
4296
4317
|
if (typeof context === "function") {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriverio",
|
|
3
3
|
"description": "Next-gen browser and mobile automation test framework for Node.js",
|
|
4
|
-
"version": "9.2.
|
|
4
|
+
"version": "9.2.11",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@types/node": "^20.11.30",
|
|
78
78
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
79
|
-
"@wdio/config": "9.2.
|
|
79
|
+
"@wdio/config": "9.2.8",
|
|
80
80
|
"@wdio/logger": "9.1.3",
|
|
81
81
|
"@wdio/protocols": "9.2.2",
|
|
82
82
|
"@wdio/repl": "9.0.8",
|
|
83
83
|
"@wdio/types": "9.2.2",
|
|
84
|
-
"@wdio/utils": "9.2.
|
|
84
|
+
"@wdio/utils": "9.2.8",
|
|
85
85
|
"archiver": "^7.0.1",
|
|
86
86
|
"aria-query": "^5.3.0",
|
|
87
87
|
"cheerio": "^1.0.0-rc.12",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"rgb2hex": "0.2.5",
|
|
101
101
|
"serialize-error": "^11.0.3",
|
|
102
102
|
"urlpattern-polyfill": "^10.0.0",
|
|
103
|
-
"webdriver": "9.2.
|
|
103
|
+
"webdriver": "9.2.8"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"puppeteer-core": "^22.3.0"
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"optional": true
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "0525efdad783af9d6f96ade9d8a3ada8454ad5c6"
|
|
114
114
|
}
|