webdriverio 7.20.7 → 7.20.8-alpha.504
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/cjs/index.d.ts +3 -0
- package/build/cjs/index.d.ts.map +1 -0
- package/build/cjs/index.js +13 -0
- package/build/cjs/package.json +3 -0
- package/build/commands/browser/$$.d.ts +10 -1
- package/build/commands/browser/$$.d.ts.map +1 -1
- package/build/commands/browser/$$.js +16 -9
- package/build/commands/browser/$.js +8 -11
- package/build/commands/browser/action.d.ts +132 -0
- package/build/commands/browser/action.d.ts.map +1 -0
- package/build/commands/browser/action.js +13 -0
- package/build/commands/browser/actions.d.ts +29 -0
- package/build/commands/browser/actions.d.ts.map +1 -0
- package/build/commands/browser/actions.js +30 -0
- package/build/commands/browser/addCommand.d.ts +1 -1
- package/build/commands/browser/addCommand.js +1 -1
- package/build/commands/browser/call.d.ts +7 -5
- package/build/commands/browser/call.d.ts.map +1 -1
- package/build/commands/browser/call.js +8 -9
- package/build/commands/browser/custom$$.js +7 -10
- package/build/commands/browser/custom$.d.ts +1 -1
- package/build/commands/browser/custom$.js +6 -9
- package/build/commands/browser/debug.js +8 -14
- package/build/commands/browser/deleteCookies.d.ts +3 -3
- package/build/commands/browser/deleteCookies.js +4 -7
- package/build/commands/browser/execute.d.ts +2 -2
- package/build/commands/browser/execute.js +5 -8
- package/build/commands/browser/executeAsync.js +3 -6
- package/build/commands/browser/getCookies.d.ts +2 -2
- package/build/commands/browser/getCookies.js +3 -6
- package/build/commands/browser/getPuppeteer.d.ts +1 -1
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
- package/build/commands/browser/getPuppeteer.js +14 -21
- package/build/commands/browser/getWindowSize.js +3 -6
- package/build/commands/browser/keys.d.ts +20 -10
- package/build/commands/browser/keys.d.ts.map +1 -1
- package/build/commands/browser/keys.js +29 -24
- package/build/commands/browser/mock.d.ts +5 -4
- package/build/commands/browser/mock.d.ts.map +1 -1
- package/build/commands/browser/mock.js +16 -22
- package/build/commands/browser/mockClearAll.js +5 -11
- package/build/commands/browser/mockRestoreAll.js +5 -11
- package/build/commands/browser/newWindow.js +5 -11
- package/build/commands/browser/pause.js +1 -4
- package/build/commands/browser/react$$.d.ts.map +1 -1
- package/build/commands/browser/react$$.js +16 -17
- package/build/commands/browser/react$.d.ts.map +1 -1
- package/build/commands/browser/react$.js +13 -14
- package/build/commands/browser/reloadSession.js +5 -12
- package/build/commands/browser/savePDF.d.ts +14 -14
- package/build/commands/browser/savePDF.js +21 -27
- package/build/commands/browser/saveRecordingScreen.js +6 -12
- package/build/commands/browser/saveScreenshot.js +6 -12
- package/build/commands/browser/scroll.d.ts +25 -0
- package/build/commands/browser/scroll.d.ts.map +1 -0
- package/build/commands/browser/scroll.js +41 -0
- package/build/commands/browser/setCookies.d.ts +1 -1
- package/build/commands/browser/setCookies.d.ts.map +1 -1
- package/build/commands/browser/setCookies.js +5 -7
- package/build/commands/browser/setTimeout.js +1 -4
- package/build/commands/browser/setWindowSize.js +3 -6
- package/build/commands/browser/switchWindow.js +1 -4
- package/build/commands/browser/throttle.js +3 -6
- package/build/commands/browser/touchAction.d.ts +1 -1
- package/build/commands/browser/touchAction.d.ts.map +1 -1
- package/build/commands/browser/touchAction.js +3 -6
- package/build/commands/browser/uploadFile.d.ts +1 -1
- package/build/commands/browser/uploadFile.d.ts.map +1 -1
- package/build/commands/browser/uploadFile.js +10 -15
- package/build/commands/browser/url.js +3 -6
- package/build/commands/browser/waitUntil.d.ts +1 -2
- package/build/commands/browser/waitUntil.d.ts.map +1 -1
- package/build/commands/browser/waitUntil.js +4 -11
- package/build/commands/browser.d.ts +37 -69
- package/build/commands/browser.d.ts.map +1 -1
- package/build/commands/browser.js +37 -44
- package/build/commands/constant.d.ts +1 -1
- package/build/commands/constant.d.ts.map +1 -1
- package/build/commands/constant.js +6 -12
- package/build/commands/element/$$.d.ts +1 -1
- package/build/commands/element/$$.d.ts.map +1 -1
- package/build/commands/element/$$.js +2 -7
- package/build/commands/element/$.d.ts +1 -1
- package/build/commands/element/$.d.ts.map +1 -1
- package/build/commands/element/$.js +2 -7
- package/build/commands/element/addValue.d.ts +10 -14
- package/build/commands/element/addValue.d.ts.map +1 -1
- package/build/commands/element/addValue.js +23 -27
- package/build/commands/element/clearValue.d.ts +1 -1
- package/build/commands/element/clearValue.js +2 -5
- package/build/commands/element/click.d.ts +1 -1
- package/build/commands/element/click.d.ts.map +1 -1
- package/build/commands/element/click.js +19 -34
- package/build/commands/element/custom$$.js +9 -11
- package/build/commands/element/custom$.js +8 -10
- package/build/commands/element/doubleClick.d.ts.map +1 -1
- package/build/commands/element/doubleClick.js +11 -17
- package/build/commands/element/dragAndDrop.d.ts.map +1 -1
- package/build/commands/element/dragAndDrop.js +13 -19
- package/build/commands/element/getAttribute.js +1 -4
- package/build/commands/element/getCSSProperty.d.ts +1 -1
- package/build/commands/element/getCSSProperty.d.ts.map +1 -1
- package/build/commands/element/getCSSProperty.js +7 -13
- package/build/commands/element/getComputedLabel.js +1 -4
- package/build/commands/element/getComputedRole.js +1 -4
- package/build/commands/element/getHTML.js +7 -13
- package/build/commands/element/getLocation.js +3 -5
- package/build/commands/element/getProperty.d.ts +5 -5
- package/build/commands/element/getProperty.d.ts.map +1 -1
- package/build/commands/element/getProperty.js +5 -11
- package/build/commands/element/getSize.js +3 -5
- package/build/commands/element/getTagName.js +1 -4
- package/build/commands/element/getText.js +1 -4
- package/build/commands/element/getValue.js +1 -4
- package/build/commands/element/isClickable.d.ts.map +1 -1
- package/build/commands/element/isClickable.js +10 -13
- package/build/commands/element/isDisplayed.js +9 -16
- package/build/commands/element/isDisplayedInViewport.js +7 -13
- package/build/commands/element/isEnabled.js +1 -4
- package/build/commands/element/isEqual.d.ts.map +1 -1
- package/build/commands/element/isEqual.js +9 -9
- package/build/commands/element/isExisting.js +1 -4
- package/build/commands/element/isFocused.js +7 -13
- package/build/commands/element/isSelected.js +1 -4
- package/build/commands/element/moveTo.d.ts.map +1 -1
- package/build/commands/element/moveTo.js +8 -13
- package/build/commands/element/nextElement.js +2 -5
- package/build/commands/element/parentElement.js +2 -5
- package/build/commands/element/previousElement.js +2 -5
- package/build/commands/element/react$$.d.ts.map +1 -1
- package/build/commands/element/react$$.js +16 -16
- package/build/commands/element/react$.d.ts.map +1 -1
- package/build/commands/element/react$.js +15 -14
- package/build/commands/element/saveScreenshot.js +6 -12
- package/build/commands/element/scrollIntoView.d.ts +4 -2
- package/build/commands/element/scrollIntoView.d.ts.map +1 -1
- package/build/commands/element/scrollIntoView.js +33 -12
- package/build/commands/element/selectByAttribute.js +3 -6
- package/build/commands/element/selectByIndex.js +3 -6
- package/build/commands/element/selectByVisibleText.js +3 -6
- package/build/commands/element/setValue.d.ts +13 -14
- package/build/commands/element/setValue.d.ts.map +1 -1
- package/build/commands/element/setValue.js +14 -17
- package/build/commands/element/shadow$$.d.ts +1 -1
- package/build/commands/element/shadow$$.d.ts.map +1 -1
- package/build/commands/element/shadow$$.js +3 -6
- package/build/commands/element/shadow$.js +3 -6
- package/build/commands/element/touchAction.js +3 -6
- package/build/commands/element/waitForClickable.js +1 -4
- package/build/commands/element/waitForDisplayed.js +1 -4
- package/build/commands/element/waitForEnabled.js +1 -4
- package/build/commands/element/waitForExist.js +1 -4
- package/build/commands/element/waitUntil.d.ts +2 -3
- package/build/commands/element/waitUntil.d.ts.map +1 -1
- package/build/commands/element/waitUntil.js +3 -9
- package/build/commands/element.d.ts +49 -99
- package/build/commands/element.d.ts.map +1 -1
- package/build/commands/element.js +49 -63
- package/build/constants.d.ts +67 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +105 -12
- package/build/index.d.ts +65 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +48 -86
- package/build/middlewares.d.ts +1 -1
- package/build/middlewares.js +11 -19
- package/build/multiremote.js +18 -24
- package/build/protocol-stub.d.ts.map +1 -1
- package/build/protocol-stub.js +4 -6
- package/build/scripts/getHTML.js +1 -4
- package/build/scripts/getProperty.d.ts +5 -5
- package/build/scripts/getProperty.d.ts.map +1 -1
- package/build/scripts/getProperty.js +1 -4
- package/build/scripts/isElementClickable.js +1 -4
- package/build/scripts/isElementDisplayed.js +2 -5
- package/build/scripts/isElementInViewport.js +1 -4
- package/build/scripts/isFocused.js +1 -4
- package/build/scripts/newWindow.js +1 -4
- package/build/scripts/resq.js +3 -9
- package/build/scripts/shadowFnFactory.js +2 -6
- package/build/types.d.ts +5 -9
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -2
- package/build/utils/SevereServiceError.js +1 -4
- package/build/utils/Timer.d.ts.map +1 -1
- package/build/utils/Timer.js +13 -29
- package/build/utils/actions/base.d.ts +32 -0
- package/build/utils/actions/base.d.ts.map +1 -0
- package/build/utils/actions/base.js +66 -0
- package/build/utils/actions/index.d.ts +6 -0
- package/build/utils/actions/index.d.ts.map +1 -0
- package/build/utils/actions/index.js +5 -0
- package/build/utils/actions/key.d.ts +15 -0
- package/build/utils/actions/key.d.ts.map +1 -0
- package/build/utils/actions/key.js +22 -0
- package/build/utils/actions/pointer.d.ts +62 -0
- package/build/utils/actions/pointer.d.ts.map +1 -0
- package/build/utils/actions/pointer.js +76 -0
- package/build/utils/actions/wheel.d.ts +36 -0
- package/build/utils/actions/wheel.d.ts.map +1 -0
- package/build/utils/actions/wheel.js +20 -0
- package/build/utils/detectBackend.d.ts +1 -1
- package/build/utils/detectBackend.d.ts.map +1 -1
- package/build/utils/detectBackend.js +3 -7
- package/build/utils/findStrategy.d.ts.map +1 -1
- package/build/utils/findStrategy.js +50 -19
- package/build/utils/getElementObject.d.ts +1 -1
- package/build/utils/getElementObject.d.ts.map +1 -1
- package/build/utils/getElementObject.js +51 -32
- package/build/utils/implicitWait.js +3 -9
- package/build/utils/index.d.ts +8 -7
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +125 -148
- package/build/utils/interception/devtools.d.ts +1 -1
- package/build/utils/interception/devtools.d.ts.map +1 -1
- package/build/utils/interception/devtools.js +17 -36
- package/build/utils/interception/index.d.ts +2 -2
- package/build/utils/interception/index.d.ts.map +1 -1
- package/build/utils/interception/index.js +10 -13
- package/build/utils/interception/types.d.ts +1 -1
- package/build/utils/interception/types.d.ts.map +1 -1
- package/build/utils/interception/types.js +1 -2
- package/build/utils/interception/webdriver.d.ts +1 -1
- package/build/utils/interception/webdriver.d.ts.map +1 -1
- package/build/utils/interception/webdriver.js +6 -11
- package/build/utils/refetchElement.js +3 -9
- package/package.json +27 -17
- package/async.d.ts +0 -24
- package/sync.d.ts +0 -24
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const constants_1 = require("../../constants");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const isElementClickable_1 = __importDefault(require("../../scripts/isElementClickable"));
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
3
|
+
import isElementClickableScript from '../../scripts/isElementClickable.js';
|
|
9
4
|
/**
|
|
10
5
|
*
|
|
11
6
|
* Return true if the selected DOM-element:
|
|
@@ -44,14 +39,16 @@ const isElementClickable_1 = __importDefault(require("../../scripts/isElementCli
|
|
|
44
39
|
* @type state
|
|
45
40
|
*
|
|
46
41
|
*/
|
|
47
|
-
async function isClickable() {
|
|
42
|
+
export default async function isClickable() {
|
|
48
43
|
if (!await this.isDisplayed()) {
|
|
49
44
|
return false;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
}
|
|
49
|
+
const browser = getBrowserObject(this);
|
|
50
|
+
return browser.execute(isElementClickableScript, {
|
|
51
|
+
[ELEMENT_KEY]: this.elementId,
|
|
54
52
|
ELEMENT: this.elementId // jsonwp compatible
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
|
-
exports.default = isClickable;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const constants_1 = require("../../constants");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const isElementDisplayed_1 = __importDefault(require("../../scripts/isElementDisplayed"));
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject, hasElementId } from '../../utils/index.js';
|
|
3
|
+
import isElementDisplayedScript from '../../scripts/isElementDisplayed.js';
|
|
9
4
|
const noW3CEndpoint = ['microsoftedge', 'msedge', 'safari', 'chrome', 'safari technology preview'];
|
|
10
5
|
/**
|
|
11
6
|
*
|
|
@@ -55,10 +50,9 @@ const noW3CEndpoint = ['microsoftedge', 'msedge', 'safari', 'chrome', 'safari te
|
|
|
55
50
|
* @type state
|
|
56
51
|
*
|
|
57
52
|
*/
|
|
58
|
-
async function isDisplayed() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!await (0, utils_1.hasElementId)(this)) {
|
|
53
|
+
export default async function isDisplayed() {
|
|
54
|
+
const browser = getBrowserObject(this);
|
|
55
|
+
if (!await hasElementId(this)) {
|
|
62
56
|
return false;
|
|
63
57
|
}
|
|
64
58
|
/*
|
|
@@ -74,12 +68,11 @@ async function isDisplayed() {
|
|
|
74
68
|
const useAtom = (await browser.isDevTools ||
|
|
75
69
|
(await browser.isW3C &&
|
|
76
70
|
!browser.isMobile &&
|
|
77
|
-
noW3CEndpoint.includes(
|
|
71
|
+
noW3CEndpoint.includes(browser.capabilities.browserName?.toLowerCase())));
|
|
78
72
|
return useAtom
|
|
79
|
-
? await browser.execute(
|
|
80
|
-
[
|
|
73
|
+
? await browser.execute(isElementDisplayedScript, {
|
|
74
|
+
[ELEMENT_KEY]: this.elementId,
|
|
81
75
|
ELEMENT: this.elementId // jsonwp compatible
|
|
82
76
|
}) :
|
|
83
77
|
await this.isElementDisplayed(this.elementId);
|
|
84
78
|
}
|
|
85
|
-
exports.default = isDisplayed;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const constants_1 = require("../../constants");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const isElementInViewport_1 = __importDefault(require("../../scripts/isElementInViewport"));
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
3
|
+
import isElementInViewportScript from '../../scripts/isElementInViewport.js';
|
|
9
4
|
/**
|
|
10
5
|
*
|
|
11
6
|
* Return true if the selected DOM-element found by given selector is partially visible and within the viewport.
|
|
@@ -42,14 +37,13 @@ const isElementInViewport_1 = __importDefault(require("../../scripts/isElementIn
|
|
|
42
37
|
* @type state
|
|
43
38
|
*
|
|
44
39
|
*/
|
|
45
|
-
async function isDisplayedInViewport() {
|
|
40
|
+
export default async function isDisplayedInViewport() {
|
|
46
41
|
if (!await this.isDisplayed()) {
|
|
47
42
|
return false;
|
|
48
43
|
}
|
|
49
|
-
const browser =
|
|
50
|
-
return browser.execute(
|
|
51
|
-
[
|
|
44
|
+
const browser = getBrowserObject(this);
|
|
45
|
+
return browser.execute(isElementInViewportScript, {
|
|
46
|
+
[ELEMENT_KEY]: this.elementId,
|
|
52
47
|
ELEMENT: this.elementId // jsonwp compatible
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
|
-
exports.default = isDisplayedInViewport;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Return true or false if the selected DOM-element is enabled.
|
|
@@ -32,7 +30,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
30
|
* @type state
|
|
33
31
|
*
|
|
34
32
|
*/
|
|
35
|
-
function isEnabled() {
|
|
33
|
+
export default function isEnabled() {
|
|
36
34
|
return this.isElementEnabled(this.elementId);
|
|
37
35
|
}
|
|
38
|
-
exports.default = isEnabled;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isEqual.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EAAE,EAAE,WAAW,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isEqual.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EAAE,EAAE,WAAW,CAAC,OAAO,oBA4B1B"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const constants_1 = require("../../constants");
|
|
4
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
5
3
|
const getWebElement = (el) => ({
|
|
6
|
-
[
|
|
4
|
+
[ELEMENT_KEY]: el.elementId,
|
|
7
5
|
ELEMENT: el.elementId // jsonwp compatible
|
|
8
6
|
});
|
|
9
7
|
/**
|
|
@@ -28,12 +26,15 @@ const getWebElement = (el) => ({
|
|
|
28
26
|
* @return {Boolean} true if elements are equal
|
|
29
27
|
*
|
|
30
28
|
*/
|
|
31
|
-
async function isEqual(el) {
|
|
32
|
-
const browser =
|
|
29
|
+
export default async function isEqual(el) {
|
|
30
|
+
const browser = getBrowserObject(this);
|
|
33
31
|
// mobile native
|
|
34
32
|
if (browser.isMobile) {
|
|
35
33
|
const context = await browser.getContext();
|
|
36
|
-
|
|
34
|
+
const contextId = typeof context === 'string'
|
|
35
|
+
? context
|
|
36
|
+
: context?.id;
|
|
37
|
+
if (contextId && contextId.toLowerCase().includes('native')) {
|
|
37
38
|
return this.elementId === el.elementId;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -49,4 +50,3 @@ async function isEqual(el) {
|
|
|
49
50
|
}
|
|
50
51
|
return result;
|
|
51
52
|
}
|
|
52
|
-
exports.default = isEqual;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Returns true if element exists in the DOM.
|
|
@@ -47,7 +45,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
47
45
|
* @type state
|
|
48
46
|
*
|
|
49
47
|
*/
|
|
50
|
-
async function isExisting() {
|
|
48
|
+
export default async function isExisting() {
|
|
51
49
|
/**
|
|
52
50
|
* if an element was composed via `const elem = $({ 'element-6066-11e4-a52e-4f735466cecf': <elementId> })`
|
|
53
51
|
* we don't have any selector information. Therefore we can only check existance
|
|
@@ -62,4 +60,3 @@ async function isExisting() {
|
|
|
62
60
|
const command = this.isReactElement ? this.parent.react$$.bind(this.parent) : this.parent.$$.bind(this.parent);
|
|
63
61
|
return command(this.selector).then((res) => res.length > 0);
|
|
64
62
|
}
|
|
65
|
-
exports.default = isExisting;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const constants_1 = require("../../constants");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const isFocused_1 = __importDefault(require("../../scripts/isFocused"));
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
3
|
+
import isFocusedScript from '../../scripts/isFocused.js';
|
|
9
4
|
/**
|
|
10
5
|
*
|
|
11
6
|
* Return true or false if the selected DOM-element currently has focus. If the selector matches
|
|
@@ -32,11 +27,10 @@ const isFocused_1 = __importDefault(require("../../scripts/isFocused"));
|
|
|
32
27
|
* @type state
|
|
33
28
|
*
|
|
34
29
|
*/
|
|
35
|
-
async function isFocused() {
|
|
36
|
-
const browser = await
|
|
37
|
-
return browser.execute(
|
|
38
|
-
[
|
|
30
|
+
export default async function isFocused() {
|
|
31
|
+
const browser = await getBrowserObject(this);
|
|
32
|
+
return browser.execute(isFocusedScript, {
|
|
33
|
+
[ELEMENT_KEY]: this.elementId,
|
|
39
34
|
ELEMENT: this.elementId // jsonwp compatible
|
|
40
35
|
});
|
|
41
36
|
}
|
|
42
|
-
exports.default = isFocused;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Will return true or false whether or not an `<option>` or `<input>` element of type
|
|
@@ -29,7 +27,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
27
|
* @type state
|
|
30
28
|
*
|
|
31
29
|
*/
|
|
32
|
-
function isSelected() {
|
|
30
|
+
export default function isSelected() {
|
|
33
31
|
return this.isElementSelected(this.elementId);
|
|
34
32
|
}
|
|
35
|
-
exports.default = isSelected;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveTo.d.ts","sourceRoot":"","sources":["../../../src/commands/element/moveTo.ts"],"names":[],"mappings":"AAEA,aAAK,aAAa,GAAG;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAA8B,MAAM,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAE,aAAkB,
|
|
1
|
+
{"version":3,"file":"moveTo.d.ts","sourceRoot":"","sources":["../../../src/commands/element/moveTo.ts"],"names":[],"mappings":"AAEA,aAAK,aAAa,GAAG;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAA8B,MAAM,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAE,aAAkB,iBAqB3C"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { getElementRect, getScrollPosition, getBrowserObject } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Move the mouse by an offset of the specified element. If no element is specified,
|
|
@@ -15,25 +13,22 @@ const utils_1 = require("../../utils");
|
|
|
15
13
|
* @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidmoveto
|
|
16
14
|
* @type protocol
|
|
17
15
|
*/
|
|
18
|
-
async function moveTo({ xOffset, yOffset } = {}) {
|
|
16
|
+
export default async function moveTo({ xOffset, yOffset } = {}) {
|
|
19
17
|
if (!this.isW3C) {
|
|
20
18
|
return this.moveToElement(this.elementId, xOffset, yOffset);
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
21
|
* get rect of element
|
|
24
22
|
*/
|
|
25
|
-
const { x, y, width, height } = await
|
|
26
|
-
const { scrollX, scrollY } = await
|
|
23
|
+
const { x, y, width, height } = await getElementRect(this);
|
|
24
|
+
const { scrollX, scrollY } = await getScrollPosition(this);
|
|
27
25
|
const newXOffset = Math.floor(x - scrollX + (typeof xOffset === 'number' ? xOffset : (width / 2)));
|
|
28
26
|
const newYOffset = Math.floor(y - scrollY + (typeof yOffset === 'number' ? yOffset : (height / 2)));
|
|
29
27
|
/**
|
|
30
28
|
* W3C way of handle the mouse move actions
|
|
31
29
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
actions: [{ type: 'pointerMove', duration: 0, x: newXOffset, y: newYOffset }]
|
|
37
|
-
}]).then(() => this.releaseActions());
|
|
30
|
+
const browser = getBrowserObject(this);
|
|
31
|
+
return browser.action('pointer', { parameters: { pointerType: 'mouse' } })
|
|
32
|
+
.move({ x: newXOffset, y: newYOffset })
|
|
33
|
+
.perform();
|
|
38
34
|
}
|
|
39
|
-
exports.default = moveTo;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
*
|
|
4
3
|
* Returns the next sibling element of the selected DOM-element.
|
|
@@ -22,10 +21,8 @@
|
|
|
22
21
|
* @return {Element}
|
|
23
22
|
* @type utility
|
|
24
23
|
*/
|
|
25
|
-
|
|
26
|
-
function nextElement() {
|
|
27
|
-
return this.$(/* istanbul ignore next */ function () {
|
|
24
|
+
export default function nextElement() {
|
|
25
|
+
return this.$(/* istanbul ignore next */ function nextElement() {
|
|
28
26
|
return this.nextElementSibling;
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
exports.default = nextElement;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Returns the parent element of the selected DOM-element.
|
|
@@ -23,9 +21,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
21
|
* @return {Element}
|
|
24
22
|
* @type utility
|
|
25
23
|
*/
|
|
26
|
-
function parentElement() {
|
|
27
|
-
return this.$(/* istanbul ignore next */ function () {
|
|
24
|
+
export default function parentElement() {
|
|
25
|
+
return this.$(/* istanbul ignore next */ function parentElement() {
|
|
28
26
|
return this.parentElement;
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
exports.default = parentElement;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Returns the previous sibling element of the selected DOM-element.
|
|
@@ -23,9 +21,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
21
|
* @return {Element}
|
|
24
22
|
* @type utility
|
|
25
23
|
*/
|
|
26
|
-
function previousElement() {
|
|
27
|
-
return this.$(/* istanbul ignore next */ function () {
|
|
24
|
+
export default function previousElement() {
|
|
25
|
+
return this.$(/* istanbul ignore next */ function previousElement() {
|
|
28
26
|
return this.previousElementSibling;
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
exports.default = previousElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react$$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/react$$.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react$$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/react$$.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,KAAU,EAAE,KAAU,EAAE,GAAE,oBAAyB,+CAgBxD"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
9
|
-
const resq_1 = require("../../scripts/resq");
|
|
10
|
-
const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { enhanceElementsArray, getBrowserObject } from '../../utils/index.js';
|
|
4
|
+
import { getElements } from '../../utils/getElementObject.js';
|
|
5
|
+
import { waitToLoadReact, react$$ as react$$Script } from '../../scripts/resq.js';
|
|
6
|
+
let resqScript;
|
|
11
7
|
/**
|
|
12
8
|
*
|
|
13
9
|
* The `react$$` command is a useful command to query multiple React Components
|
|
@@ -41,11 +37,15 @@ const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
|
41
37
|
* @return {ElementArray}
|
|
42
38
|
*
|
|
43
39
|
*/
|
|
44
|
-
async function react$$(selector, { props = {}, state = {} } = {}) {
|
|
40
|
+
export default async function react$$(selector, { props = {}, state = {} } = {}) {
|
|
41
|
+
if (!resqScript) {
|
|
42
|
+
const require = createRequire(import.meta.url);
|
|
43
|
+
resqScript = (await fs.readFile(require.resolve('resq'))).toString();
|
|
44
|
+
}
|
|
45
|
+
const browser = await getBrowserObject(this);
|
|
45
46
|
await this.executeScript(resqScript.toString(), []);
|
|
46
|
-
await
|
|
47
|
-
const res = await
|
|
48
|
-
const elements = await
|
|
49
|
-
return
|
|
47
|
+
await browser.execute(waitToLoadReact);
|
|
48
|
+
const res = await browser.execute(react$$Script, selector, props, state, this);
|
|
49
|
+
const elements = await getElements.call(this, selector, res, true);
|
|
50
|
+
return enhanceElementsArray(elements, this, selector, 'react$$', [props, state]);
|
|
50
51
|
}
|
|
51
|
-
exports.default = react$$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/react$.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/react$.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAA8B,MAAM,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,KAAU,EAAE,KAAU,EAAE,GAAE,oBAAyB,gCAexD"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
8
|
-
const resq_1 = require("../../scripts/resq");
|
|
9
|
-
const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
4
|
+
import { getElement } from '../../utils/getElementObject.js';
|
|
5
|
+
import { waitToLoadReact, react$ as react$Script } from '../../scripts/resq.js';
|
|
6
|
+
let resqScript;
|
|
10
7
|
/**
|
|
11
8
|
*
|
|
12
9
|
* The `react$` command is a useful command to query React Components by their
|
|
@@ -50,10 +47,14 @@ const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
|
50
47
|
* @return {Element}
|
|
51
48
|
*
|
|
52
49
|
*/
|
|
53
|
-
async function react$(selector, { props = {}, state = {} } = {}) {
|
|
50
|
+
export default async function react$(selector, { props = {}, state = {} } = {}) {
|
|
51
|
+
if (!resqScript) {
|
|
52
|
+
const require = createRequire(import.meta.url);
|
|
53
|
+
resqScript = (await fs.readFile(require.resolve('resq'))).toString();
|
|
54
|
+
}
|
|
55
|
+
const browser = await getBrowserObject(this);
|
|
54
56
|
await this.executeScript(resqScript.toString(), []);
|
|
55
|
-
await
|
|
56
|
-
const res = await
|
|
57
|
-
return
|
|
57
|
+
await browser.execute(waitToLoadReact);
|
|
58
|
+
const res = await browser.execute(react$Script, selector, props, state, this);
|
|
59
|
+
return getElement.call(this, selector, res, true);
|
|
58
60
|
}
|
|
59
|
-
exports.default = react$;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { getAbsoluteFilepath, assertDirectoryExists } from '../../utils/index.js';
|
|
8
3
|
/**
|
|
9
4
|
*
|
|
10
5
|
* Save a screenshot of an element to a PNG file on your OS.
|
|
@@ -23,18 +18,17 @@ const utils_1 = require("../../utils");
|
|
|
23
18
|
* @type utility
|
|
24
19
|
*
|
|
25
20
|
*/
|
|
26
|
-
async function saveScreenshot(filepath) {
|
|
21
|
+
export default async function saveScreenshot(filepath) {
|
|
27
22
|
/**
|
|
28
23
|
* type check
|
|
29
24
|
*/
|
|
30
25
|
if (typeof filepath !== 'string' || !filepath.endsWith('.png')) {
|
|
31
26
|
throw new Error('saveScreenshot expects a filepath of type string and ".png" file ending');
|
|
32
27
|
}
|
|
33
|
-
const absoluteFilepath =
|
|
34
|
-
|
|
28
|
+
const absoluteFilepath = getAbsoluteFilepath(filepath);
|
|
29
|
+
assertDirectoryExists(absoluteFilepath);
|
|
35
30
|
const screenBuffer = await this.takeElementScreenshot(this.elementId);
|
|
36
31
|
const screenshot = Buffer.from(screenBuffer, 'base64');
|
|
37
|
-
|
|
32
|
+
fs.writeFileSync(absoluteFilepath, screenshot);
|
|
38
33
|
return screenshot;
|
|
39
34
|
}
|
|
40
|
-
exports.default = saveScreenshot;
|
|
@@ -8,14 +8,16 @@
|
|
|
8
8
|
const elem = await $('#myElement');
|
|
9
9
|
// scroll to specific element
|
|
10
10
|
await elem.scrollIntoView();
|
|
11
|
+
// center element within the viewport
|
|
12
|
+
await elem.scrollIntoView({ block: 'center', inline: 'center' });
|
|
11
13
|
});
|
|
12
14
|
* </example>
|
|
13
15
|
*
|
|
14
16
|
* @alias element.scrollIntoView
|
|
15
|
-
* @param {object|boolean=} scrollIntoViewOptions options for `Element.scrollIntoView()` (default: `
|
|
17
|
+
* @param {object|boolean=} scrollIntoViewOptions options for `Element.scrollIntoView()` (default: `{ block: 'start', inline: 'nearest' }`)
|
|
16
18
|
* @uses protocol/execute
|
|
17
19
|
* @type utility
|
|
18
20
|
*
|
|
19
21
|
*/
|
|
20
|
-
export default function scrollIntoView(this: WebdriverIO.Element,
|
|
22
|
+
export default function scrollIntoView(this: WebdriverIO.Element, options?: ScrollIntoViewOptions | boolean): Promise<void>;
|
|
21
23
|
//# sourceMappingURL=scrollIntoView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollIntoView.d.ts","sourceRoot":"","sources":["../../../src/commands/element/scrollIntoView.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"scrollIntoView.d.ts","sourceRoot":"","sources":["../../../src/commands/element/scrollIntoView.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAA8B,cAAc,CACxC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,GAAE,qBAAqB,GAAG,OAA+C,iBA8BnF"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Scroll element into viewport ([MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)).
|
|
@@ -11,21 +9,44 @@ const constants_1 = require("../../constants");
|
|
|
11
9
|
const elem = await $('#myElement');
|
|
12
10
|
// scroll to specific element
|
|
13
11
|
await elem.scrollIntoView();
|
|
12
|
+
// center element within the viewport
|
|
13
|
+
await elem.scrollIntoView({ block: 'center', inline: 'center' });
|
|
14
14
|
});
|
|
15
15
|
* </example>
|
|
16
16
|
*
|
|
17
17
|
* @alias element.scrollIntoView
|
|
18
|
-
* @param {object|boolean=} scrollIntoViewOptions options for `Element.scrollIntoView()` (default: `
|
|
18
|
+
* @param {object|boolean=} scrollIntoViewOptions options for `Element.scrollIntoView()` (default: `{ block: 'start', inline: 'nearest' }`)
|
|
19
19
|
* @uses protocol/execute
|
|
20
20
|
* @type utility
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
function scrollIntoView(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
export default async function scrollIntoView(options = { block: 'start', inline: 'nearest' }) {
|
|
24
|
+
const browser = getBrowserObject(this);
|
|
25
|
+
let deltaX = 0;
|
|
26
|
+
let deltaY = 0;
|
|
27
|
+
/**
|
|
28
|
+
* by default the WebDriver action scrolls the element just into the
|
|
29
|
+
* viewport. In order to stay complaint with `Element.scrollIntoView()`
|
|
30
|
+
* we need to adjust the values a bit.
|
|
31
|
+
*/
|
|
32
|
+
if (typeof options === 'boolean' || typeof options.block === 'string' || typeof options.inline === 'string') {
|
|
33
|
+
const htmlElem = await browser.$('html');
|
|
34
|
+
const viewport = await htmlElem.getSize();
|
|
35
|
+
const elemSize = await this.getSize();
|
|
36
|
+
if (options === true || options.block === 'start') {
|
|
37
|
+
deltaY += viewport.height - elemSize.height;
|
|
38
|
+
}
|
|
39
|
+
else if (options.block === 'center') {
|
|
40
|
+
deltaY += Math.round((viewport.height - elemSize.height) / 2);
|
|
41
|
+
}
|
|
42
|
+
if (options.inline === 'start') {
|
|
43
|
+
deltaX += viewport.height - elemSize.height;
|
|
44
|
+
}
|
|
45
|
+
else if (options.block === 'center') {
|
|
46
|
+
deltaX += Math.round((viewport.height - elemSize.height) / 2);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return browser.action('wheel')
|
|
50
|
+
.scroll({ origin: this, duration: 200, deltaY, deltaX })
|
|
51
|
+
.perform();
|
|
30
52
|
}
|
|
31
|
-
exports.default = scrollIntoView;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { getElementFromResponse } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Select option with a specific value.
|
|
@@ -36,7 +34,7 @@ const utils_1 = require("../../utils");
|
|
|
36
34
|
* @type action
|
|
37
35
|
*
|
|
38
36
|
*/
|
|
39
|
-
async function selectByAttribute(attribute, value) {
|
|
37
|
+
export default async function selectByAttribute(attribute, value) {
|
|
40
38
|
/**
|
|
41
39
|
* convert value into string
|
|
42
40
|
*/
|
|
@@ -54,6 +52,5 @@ async function selectByAttribute(attribute, value) {
|
|
|
54
52
|
/**
|
|
55
53
|
* select option
|
|
56
54
|
*/
|
|
57
|
-
return this.elementClick(
|
|
55
|
+
return this.elementClick(getElementFromResponse(optionElement));
|
|
58
56
|
}
|
|
59
|
-
exports.default = selectByAttribute;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { getElementFromResponse } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Select option with a specific index.
|
|
@@ -30,7 +28,7 @@ const utils_1 = require("../../utils");
|
|
|
30
28
|
* @type action
|
|
31
29
|
*
|
|
32
30
|
*/
|
|
33
|
-
async function selectByIndex(index) {
|
|
31
|
+
export default async function selectByIndex(index) {
|
|
34
32
|
/**
|
|
35
33
|
* negative index check
|
|
36
34
|
*/
|
|
@@ -50,6 +48,5 @@ async function selectByIndex(index) {
|
|
|
50
48
|
/**
|
|
51
49
|
* select option
|
|
52
50
|
*/
|
|
53
|
-
return this.elementClick(
|
|
51
|
+
return this.elementClick(getElementFromResponse(optionElements[index]));
|
|
54
52
|
}
|
|
55
|
-
exports.default = selectByIndex;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { getElementFromResponse } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Select option with displayed text matching the argument.
|
|
@@ -30,7 +28,7 @@ const utils_1 = require("../../utils");
|
|
|
30
28
|
* @type action
|
|
31
29
|
*
|
|
32
30
|
*/
|
|
33
|
-
async function selectByVisibleText(text) {
|
|
31
|
+
export default async function selectByVisibleText(text) {
|
|
34
32
|
/**
|
|
35
33
|
* convert value into string
|
|
36
34
|
*/
|
|
@@ -61,6 +59,5 @@ async function selectByVisibleText(text) {
|
|
|
61
59
|
/**
|
|
62
60
|
* select option
|
|
63
61
|
*/
|
|
64
|
-
return this.elementClick(
|
|
62
|
+
return this.elementClick(getElementFromResponse(optionElement));
|
|
65
63
|
}
|
|
66
|
-
exports.default = selectByVisibleText;
|