webdriverio 8.0.0-alpha.240 → 8.0.0-alpha.327
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/$$.d.ts +10 -1
- package/build/commands/browser/$$.d.ts.map +1 -1
- package/build/commands/browser/$$.js +11 -1
- package/build/commands/browser/custom$.d.ts +1 -1
- package/build/commands/browser/custom$.js +1 -1
- package/build/commands/browser/mock.d.ts +4 -3
- package/build/commands/browser/mock.d.ts.map +1 -1
- package/build/commands/browser/mock.js +4 -3
- package/build/commands/element/isClickable.d.ts.map +1 -1
- package/build/commands/element/isClickable.js +3 -0
- package/build/constants.d.ts +1 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +1 -0
- package/build/scripts/isElementDisplayed.js +1 -1
- package/build/utils/findStrategy.d.ts.map +1 -1
- package/build/utils/findStrategy.js +40 -1
- package/build/utils/getElementObject.d.ts +1 -1
- package/build/utils/getElementObject.d.ts.map +1 -1
- package/build/utils/getElementObject.js +9 -1
- package/build/utils/index.d.ts +1 -1
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +7 -1
- package/package.json +14 -13
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ElementReference } from '@wdio/protocols';
|
|
1
2
|
import type { Selector, ElementArray } from '../../types';
|
|
2
3
|
/**
|
|
3
4
|
* The `$$` command is a short way to call the [`findElements`](/docs/api/webdriver#findelements) command in order
|
|
@@ -38,6 +39,14 @@ import type { Selector, ElementArray } from '../../types';
|
|
|
38
39
|
})[0];
|
|
39
40
|
console.log(await text.$$('li')[2].$('a').getText()); // outputs: "API"
|
|
40
41
|
});
|
|
42
|
+
|
|
43
|
+
it('can create element array out of single elements', async () => {
|
|
44
|
+
const red = await $('.red');
|
|
45
|
+
const green = await $('.green');
|
|
46
|
+
const elems = $$([red, green]);
|
|
47
|
+
console.log(await elems.map((e) => e.getAttribute('class')));
|
|
48
|
+
// returns "[ 'box red ui-droppable', 'box green' ]"
|
|
49
|
+
});
|
|
41
50
|
* </example>
|
|
42
51
|
*
|
|
43
52
|
* @alias $$
|
|
@@ -46,5 +55,5 @@ import type { Selector, ElementArray } from '../../types';
|
|
|
46
55
|
* @type utility
|
|
47
56
|
*
|
|
48
57
|
*/
|
|
49
|
-
export default function $$(this: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector): Promise<ElementArray>;
|
|
58
|
+
export default function $$(this: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector | ElementReference[] | WebdriverIO.Element[]): Promise<ElementArray>;
|
|
50
59
|
//# sourceMappingURL=$$.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/$$.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"$$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/$$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAIvD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAA8B,EAAE,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,yBAOlE"}
|
|
@@ -39,6 +39,14 @@ import { getElements } from '../../utils/getElementObject.js';
|
|
|
39
39
|
})[0];
|
|
40
40
|
console.log(await text.$$('li')[2].$('a').getText()); // outputs: "API"
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
it('can create element array out of single elements', async () => {
|
|
44
|
+
const red = await $('.red');
|
|
45
|
+
const green = await $('.green');
|
|
46
|
+
const elems = $$([red, green]);
|
|
47
|
+
console.log(await elems.map((e) => e.getAttribute('class')));
|
|
48
|
+
// returns "[ 'box red ui-droppable', 'box green' ]"
|
|
49
|
+
});
|
|
42
50
|
* </example>
|
|
43
51
|
*
|
|
44
52
|
* @alias $$
|
|
@@ -48,7 +56,9 @@ import { getElements } from '../../utils/getElementObject.js';
|
|
|
48
56
|
*
|
|
49
57
|
*/
|
|
50
58
|
export default async function $$(selector) {
|
|
51
|
-
const res =
|
|
59
|
+
const res = Array.isArray(selector)
|
|
60
|
+
? selector
|
|
61
|
+
: await findElements.call(this, selector);
|
|
52
62
|
const elements = await getElements.call(this, selector, res);
|
|
53
63
|
return enhanceElementsArray(elements, this, selector);
|
|
54
64
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:example.js
|
|
7
7
|
it('should fetch the project title', async () => {
|
|
8
8
|
await browser.url('https://webdriver.io')
|
|
9
|
-
|
|
9
|
+
browser.addLocatorStrategy('myStrat', (selector) => {
|
|
10
10
|
return document.querySelectorAll(selector)
|
|
11
11
|
})
|
|
12
12
|
|
|
@@ -8,7 +8,7 @@ import { ELEMENT_KEY } from '../../constants.js';
|
|
|
8
8
|
:example.js
|
|
9
9
|
it('should fetch the project title', async () => {
|
|
10
10
|
await browser.url('https://webdriver.io')
|
|
11
|
-
|
|
11
|
+
browser.addLocatorStrategy('myStrat', (selector) => {
|
|
12
12
|
return document.querySelectorAll(selector)
|
|
13
13
|
})
|
|
14
14
|
|
|
@@ -18,9 +18,10 @@ export declare const SESSION_MOCKS: Record<string, Set<Interception>>;
|
|
|
18
18
|
*
|
|
19
19
|
* :::info
|
|
20
20
|
*
|
|
21
|
-
* Note that using the `mock` command requires support for Chrome DevTools protocol
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Note that using the `mock` command requires support for Chrome DevTools protocol.
|
|
22
|
+
* That support is given if you run tests locally in Chromium based browser or if
|
|
23
|
+
* you use a Selenium Grid v4 or higher. This command can __not__ be used when running
|
|
24
|
+
* automated tests in the cloud. Find out more in the [Automation Protocols](/docs/automationProtocols) section.
|
|
24
25
|
*
|
|
25
26
|
* :::
|
|
26
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mCAAmC,CAAA;AAIjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAM,CAAA;AAElE
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mCAAmC,CAAA;AAIjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAM,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,wBAA8B,IAAI,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,aAAa,CAAC,EAAE,iBAAiB,iBA6DpC"}
|
|
@@ -18,9 +18,10 @@ export const SESSION_MOCKS = {};
|
|
|
18
18
|
*
|
|
19
19
|
* :::info
|
|
20
20
|
*
|
|
21
|
-
* Note that using the `mock` command requires support for Chrome DevTools protocol
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Note that using the `mock` command requires support for Chrome DevTools protocol.
|
|
22
|
+
* That support is given if you run tests locally in Chromium based browser or if
|
|
23
|
+
* you use a Selenium Grid v4 or higher. This command can __not__ be used when running
|
|
24
|
+
* automated tests in the cloud. Find out more in the [Automation Protocols](/docs/automationProtocols) section.
|
|
24
25
|
*
|
|
25
26
|
* :::
|
|
26
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isClickable.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isClickable.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAA8B,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"isClickable.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isClickable.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAA8B,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAcnE"}
|
|
@@ -43,6 +43,9 @@ export default async function isClickable() {
|
|
|
43
43
|
if (!await this.isDisplayed()) {
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
|
+
if (this.isMobile && await this.getContext() === 'NATIVE_APP') {
|
|
47
|
+
throw new Error('Method not supported in mobile native environment. It is unlikely that you need to use this command.');
|
|
48
|
+
}
|
|
46
49
|
const browser = getBrowserObject(this);
|
|
47
50
|
return browser.execute(isElementClickableScript, {
|
|
48
51
|
[ELEMENT_KEY]: this.elementId,
|
package/build/constants.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const DRIVER_DEFAULT_ENDPOINT: {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const FF_REMOTE_DEBUG_ARG = "-remote-debugging-port";
|
|
12
12
|
export declare const DEEP_SELECTOR = ">>>";
|
|
13
|
+
export declare const ARIA_SELECTOR = "aria/";
|
|
13
14
|
export declare const ERROR_REASON: string[];
|
|
14
15
|
/**
|
|
15
16
|
* Special Characters
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAqC,MAAM,aAAa,CAAA;AA+B7E,eAAO,MAAM,WAAW,wCAAwC,CAAA;AAEhE,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAiRtF,CAAA;AAED,eAAO,MAAM,uBAAuB,UAA0E,CAAA;AAE9G,eAAO,MAAM,uBAAuB;;;;;CAKnC,CAAA;AAED,eAAO,MAAM,mBAAmB,2BAA2B,CAAA;AAC3D,eAAO,MAAM,aAAa,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAqC,MAAM,aAAa,CAAA;AA+B7E,eAAO,MAAM,WAAW,wCAAwC,CAAA;AAEhE,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAiRtF,CAAA;AAED,eAAO,MAAM,uBAAuB,UAA0E,CAAA;AAE9G,eAAO,MAAM,uBAAuB;;;;;CAKnC,CAAA;AAED,eAAO,MAAM,mBAAmB,2BAA2B,CAAA;AAC3D,eAAO,MAAM,aAAa,QAAQ,CAAA;AAClC,eAAO,MAAM,aAAa,UAAU,CAAA;AAEpC,eAAO,MAAM,YAAY,UAKxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;IACZ;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DG,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -292,6 +292,7 @@ export const DRIVER_DEFAULT_ENDPOINT = {
|
|
|
292
292
|
};
|
|
293
293
|
export const FF_REMOTE_DEBUG_ARG = '-remote-debugging-port';
|
|
294
294
|
export const DEEP_SELECTOR = '>>>';
|
|
295
|
+
export const ARIA_SELECTOR = 'aria/';
|
|
295
296
|
export const ERROR_REASON = [
|
|
296
297
|
'Failed', 'Aborted', 'TimedOut', 'AccessDenied', 'ConnectionClosed',
|
|
297
298
|
'ConnectionReset', 'ConnectionRefused', 'ConnectionAborted',
|
|
@@ -68,7 +68,7 @@ export default function isElementDisplayed(element) {
|
|
|
68
68
|
// if document-fragment, skip it and use element.host instead. This happens
|
|
69
69
|
// when the element is inside a shadow root.
|
|
70
70
|
// window.getComputedStyle errors on document-fragment.
|
|
71
|
-
if (element instanceof
|
|
71
|
+
if (element instanceof ShadowRoot) {
|
|
72
72
|
element = element.host;
|
|
73
73
|
}
|
|
74
74
|
let computedStyle = window.getComputedStyle(element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findStrategy.d.ts","sourceRoot":"","sources":["../../src/utils/findStrategy.ts"],"names":[],"mappings":"AA4BA,aAAK,gBAAgB,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"findStrategy.d.ts","sourceRoot":"","sources":["../../src/utils/findStrategy.ts"],"names":[],"mappings":"AA4BA,aAAK,gBAAgB,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AA2F/D,eAAO,MAAM,YAAY,aAAuB,gBAAgB,UAAU,OAAO,aAAa,OAAO;;;CAuKpG,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import isPlainObject from 'lodash.isplainobject';
|
|
3
3
|
import { roleElements } from 'aria-query';
|
|
4
|
-
import { DEEP_SELECTOR } from '../constants.js';
|
|
4
|
+
import { DEEP_SELECTOR, ARIA_SELECTOR } from '../constants.js';
|
|
5
5
|
const DEFAULT_STRATEGY = 'css selector';
|
|
6
6
|
const DIRECT_SELECTOR_REGEXP = /^(id|css selector|xpath|link text|partial link text|name|tag name|class name|-android uiautomator|-android datamatcher|-android viewmatcher|-android viewtag|-ios uiautomation|-ios predicate string|-ios class chain|accessibility id):(.+)/;
|
|
7
7
|
const XPATH_SELECTORS_START = [
|
|
@@ -65,6 +65,10 @@ const defineStrategy = function (selector) {
|
|
|
65
65
|
if (stringSelector.startsWith(DEEP_SELECTOR)) {
|
|
66
66
|
return 'shadow';
|
|
67
67
|
}
|
|
68
|
+
// use aria selector
|
|
69
|
+
if (stringSelector.startsWith(ARIA_SELECTOR)) {
|
|
70
|
+
return 'aria';
|
|
71
|
+
}
|
|
68
72
|
// Recursive element search using the UiAutomator library (Android only)
|
|
69
73
|
if (stringSelector.startsWith('android=')) {
|
|
70
74
|
return '-android uiautomator';
|
|
@@ -145,6 +149,41 @@ export const findStrategy = function (selector, isW3C, isMobile) {
|
|
|
145
149
|
using = 'shadow';
|
|
146
150
|
value = stringSelector.slice(DEEP_SELECTOR.length);
|
|
147
151
|
break;
|
|
152
|
+
case 'aria': {
|
|
153
|
+
const label = stringSelector.slice(ARIA_SELECTOR.length);
|
|
154
|
+
const conditions = [
|
|
155
|
+
// aria label is recevied by other element with aria-labelledBy
|
|
156
|
+
// https://www.w3.org/TR/accname-1.1/#step2B
|
|
157
|
+
`.//*[@aria-labelledby=(//*[normalize-space() = "${label}"]/@id)]`,
|
|
158
|
+
// aria label is recevied by other element with aria-labelledBy
|
|
159
|
+
// https://www.w3.org/TR/accname-1.1/#step2B
|
|
160
|
+
`.//*[@aria-describedby=(//*[normalize-space() = "${label}"]/@id)]`,
|
|
161
|
+
// element has direct aria label
|
|
162
|
+
// https://www.w3.org/TR/accname-1.1/#step2C
|
|
163
|
+
`.//*[@aria-label = "${label}"]`,
|
|
164
|
+
// inputs with a label
|
|
165
|
+
// https://www.w3.org/TR/accname-1.1/#step2D
|
|
166
|
+
`.//input[@id = (//label[normalize-space() = "${label}"]/@for)]`,
|
|
167
|
+
// aria label is received by an input placeholder
|
|
168
|
+
// https://www.w3.org/TR/accname-1.1/#step2D
|
|
169
|
+
`.//input[@placeholder="${label}"]`,
|
|
170
|
+
// aria label is received by an input placeholder
|
|
171
|
+
// https://www.w3.org/TR/accname-1.1/#step2D
|
|
172
|
+
`.//input[@aria-placeholder="${label}"]`,
|
|
173
|
+
// aria label is received by its title attribute
|
|
174
|
+
// https://www.w3.org/TR/accname-1.1/#step2D
|
|
175
|
+
`.//*[@title="${label}"]`,
|
|
176
|
+
// images with an alt tag
|
|
177
|
+
// https://www.w3.org/TR/accname-1.1/#step2D
|
|
178
|
+
`.//img[@alt="${label}"]`,
|
|
179
|
+
// aria label is received from element content
|
|
180
|
+
// https://www.w3.org/TR/accname-1.1/#step2G
|
|
181
|
+
`.//*[normalize-space() = "${label}"]`
|
|
182
|
+
];
|
|
183
|
+
using = 'xpath';
|
|
184
|
+
value = `(${conditions.join(' | ')})[1]`;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
148
187
|
case '-android uiautomator': {
|
|
149
188
|
using = '-android uiautomator';
|
|
150
189
|
value = stringSelector.slice(8);
|
|
@@ -13,5 +13,5 @@ export declare const getElement: (this: WebdriverIO.Browser | WebdriverIO.Elemen
|
|
|
13
13
|
* @param {Object} res findElements response
|
|
14
14
|
* @return {Array} array of WDIO elements
|
|
15
15
|
*/
|
|
16
|
-
export declare const getElements: (this: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector, elemResponse: ElementReference[], isReactElement?: boolean) => ElementArray;
|
|
16
|
+
export declare const getElements: (this: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector | ElementReference[] | WebdriverIO.Element[], elemResponse: ElementReference[], isReactElement?: boolean) => ElementArray;
|
|
17
17
|
//# sourceMappingURL=getElementObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getElementObject.d.ts","sourceRoot":"","sources":["../../src/utils/getElementObject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAMvD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,SACb,YAAY,OAAO,GAAG,mBAAmB,aACpC,QAAQ,QACb,gBAAgB,GAAG,KAAK,+BAE/B,mBAuDF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,SACd,YAAY,OAAO,GAAG,mBAAmB,YACrC,QAAQ,
|
|
1
|
+
{"version":3,"file":"getElementObject.d.ts","sourceRoot":"","sources":["../../src/utils/getElementObject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAMvD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,SACb,YAAY,OAAO,GAAG,mBAAmB,aACpC,QAAQ,QACb,gBAAgB,GAAG,KAAK,+BAE/B,mBAuDF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,SACd,YAAY,OAAO,GAAG,mBAAmB,YACrC,QAAQ,GAAG,gBAAgB,EAAE,GAAG,mBAAmB,EAAE,gBACjD,gBAAgB,EAAE,+BAEjC,YAiEF,CAAA"}
|
|
@@ -82,6 +82,12 @@ export const getElements = function getElements(selector, elemResponse, isReactE
|
|
|
82
82
|
...getWDIOPrototype('element')
|
|
83
83
|
};
|
|
84
84
|
const elements = elemResponse.map((res, i) => {
|
|
85
|
+
/**
|
|
86
|
+
* if we already deal with an element, just return it
|
|
87
|
+
*/
|
|
88
|
+
if (res.selector) {
|
|
89
|
+
return res;
|
|
90
|
+
}
|
|
85
91
|
propertiesObject.scope = { value: 'element' };
|
|
86
92
|
const element = webdriverMonad(this.options, (client) => {
|
|
87
93
|
const elementId = getElementFromResponse(res);
|
|
@@ -99,7 +105,9 @@ export const getElements = function getElements(selector, elemResponse, isReactE
|
|
|
99
105
|
else {
|
|
100
106
|
client.error = res;
|
|
101
107
|
}
|
|
102
|
-
client.selector = selector
|
|
108
|
+
client.selector = Array.isArray(selector)
|
|
109
|
+
? selector[i].selector
|
|
110
|
+
: selector;
|
|
103
111
|
client.parent = this;
|
|
104
112
|
client.index = i;
|
|
105
113
|
client.emit = this.emit.bind(this);
|
package/build/utils/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare function addLocatorStrategyHandler(scope: WebdriverIO.Browser | W
|
|
|
75
75
|
* @param {Array} props additional properties required to fetch elements again
|
|
76
76
|
* @returns {object[]} elements
|
|
77
77
|
*/
|
|
78
|
-
export declare const enhanceElementsArray: (elements: ElementArray, parent: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector, foundWith?: string, props?: any[]) => ElementArray;
|
|
78
|
+
export declare const enhanceElementsArray: (elements: ElementArray, parent: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector | ElementReference[] | WebdriverIO.Element[], foundWith?: string, props?: any[]) => ElementArray;
|
|
79
79
|
/**
|
|
80
80
|
* is protocol stub
|
|
81
81
|
* @param {string} automationProtocol
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAMxD,OAAO,KAAK,EAAE,YAAY,EAAmB,QAAQ,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAmBjH;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,SAAS,GAAG,SAAS,uCAexD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAA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,14 @@ export function addLocatorStrategyHandler(scope) {
|
|
|
402
402
|
* @returns {object[]} elements
|
|
403
403
|
*/
|
|
404
404
|
export const enhanceElementsArray = (elements, parent, selector, foundWith = '$$', props = []) => {
|
|
405
|
+
/**
|
|
406
|
+
* if we have an element collection, e.g. `const elems = $$([elemA, elemB])`
|
|
407
|
+
* we cna't assign a common selector to the element array
|
|
408
|
+
*/
|
|
409
|
+
if (!Array.isArray(selector)) {
|
|
410
|
+
elements.selector = selector;
|
|
411
|
+
}
|
|
405
412
|
elements.parent = parent;
|
|
406
|
-
elements.selector = selector;
|
|
407
413
|
elements.foundWith = foundWith;
|
|
408
414
|
elements.props = props;
|
|
409
415
|
return elements;
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriverio",
|
|
3
3
|
"description": "Next-gen browser and mobile automation test framework for Node.js",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.327+9e6d91918",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git://github.com/webdriverio/webdriverio.git"
|
|
10
|
+
"url": "git://github.com/webdriverio/webdriverio.git",
|
|
11
|
+
"directory": "packages/webdriverio"
|
|
11
12
|
},
|
|
12
13
|
"bugs": {
|
|
13
14
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
@@ -68,18 +69,18 @@
|
|
|
68
69
|
"dependencies": {
|
|
69
70
|
"@types/aria-query": "^5.0.0",
|
|
70
71
|
"@types/node": "^18.0.0",
|
|
71
|
-
"@wdio/config": "8.0.0-alpha.
|
|
72
|
-
"@wdio/logger": "8.0.0-alpha.
|
|
73
|
-
"@wdio/protocols": "8.0.0-alpha.
|
|
74
|
-
"@wdio/repl": "8.0.0-alpha.
|
|
75
|
-
"@wdio/types": "8.0.0-alpha.
|
|
76
|
-
"@wdio/utils": "8.0.0-alpha.
|
|
72
|
+
"@wdio/config": "8.0.0-alpha.327+9e6d91918",
|
|
73
|
+
"@wdio/logger": "8.0.0-alpha.327+9e6d91918",
|
|
74
|
+
"@wdio/protocols": "8.0.0-alpha.327+9e6d91918",
|
|
75
|
+
"@wdio/repl": "8.0.0-alpha.327+9e6d91918",
|
|
76
|
+
"@wdio/types": "8.0.0-alpha.327+9e6d91918",
|
|
77
|
+
"@wdio/utils": "8.0.0-alpha.327+9e6d91918",
|
|
77
78
|
"archiver": "^5.0.0",
|
|
78
79
|
"aria-query": "^5.0.0",
|
|
79
80
|
"css-shorthand-properties": "^1.1.1",
|
|
80
81
|
"css-value": "^0.0.1",
|
|
81
|
-
"devtools": "8.0.0-alpha.
|
|
82
|
-
"devtools-protocol": "^0.0.
|
|
82
|
+
"devtools": "8.0.0-alpha.327+9e6d91918",
|
|
83
|
+
"devtools-protocol": "^0.0.1040073",
|
|
83
84
|
"fs-extra": "^10.0.0",
|
|
84
85
|
"grapheme-splitter": "^1.0.2",
|
|
85
86
|
"lodash.clonedeep": "^4.5.0",
|
|
@@ -87,12 +88,12 @@
|
|
|
87
88
|
"lodash.isplainobject": "^4.0.6",
|
|
88
89
|
"lodash.zip": "^4.2.0",
|
|
89
90
|
"minimatch": "^5.0.0",
|
|
90
|
-
"puppeteer-core": "
|
|
91
|
+
"puppeteer-core": "17.1.1",
|
|
91
92
|
"query-selector-shadow-dom": "^1.0.0",
|
|
92
93
|
"resq": "^1.9.1",
|
|
93
94
|
"rgb2hex": "0.2.5",
|
|
94
95
|
"serialize-error": "^8.0.0",
|
|
95
|
-
"webdriver": "8.0.0-alpha.
|
|
96
|
+
"webdriver": "8.0.0-alpha.327+9e6d91918"
|
|
96
97
|
},
|
|
97
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "9e6d919187b099126ba2dae802791c659fc9c794"
|
|
98
99
|
}
|