webdriverio 7.17.0 → 7.17.3
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 +50 -0
- package/build/commands/browser/$$.d.ts.map +1 -0
- package/build/commands/browser/$$.js +57 -0
- package/build/commands/browser/$.d.ts +77 -0
- package/build/commands/browser/$.d.ts.map +1 -0
- package/build/commands/browser/$.js +91 -0
- package/build/commands/browser/addCommand.d.ts +37 -0
- package/build/commands/browser/addCommand.d.ts.map +1 -0
- package/build/commands/browser/addCommand.js +37 -0
- package/build/commands/browser/call.d.ts +42 -0
- package/build/commands/browser/call.d.ts.map +1 -0
- package/build/commands/browser/call.js +49 -0
- package/build/commands/browser/custom$$.d.ts +26 -0
- package/build/commands/browser/custom$$.d.ts.map +1 -0
- package/build/commands/browser/custom$$.js +47 -0
- package/build/commands/browser/custom$.d.ts +25 -0
- package/build/commands/browser/custom$.d.ts.map +1 -0
- package/build/commands/browser/custom$.js +47 -0
- package/build/commands/browser/debug.d.ts +32 -0
- package/build/commands/browser/debug.d.ts.map +1 -0
- package/build/commands/browser/debug.js +108 -0
- package/build/commands/browser/deleteCookies.d.ts +45 -0
- package/build/commands/browser/deleteCookies.d.ts.map +1 -0
- package/build/commands/browser/deleteCookies.js +56 -0
- package/build/commands/browser/execute.d.ts +37 -0
- package/build/commands/browser/execute.d.ts.map +1 -0
- package/build/commands/browser/execute.js +55 -0
- package/build/commands/browser/executeAsync.d.ts +45 -0
- package/build/commands/browser/executeAsync.d.ts.map +1 -0
- package/build/commands/browser/executeAsync.js +63 -0
- package/build/commands/browser/getCookies.d.ts +34 -0
- package/build/commands/browser/getCookies.d.ts.map +1 -0
- package/build/commands/browser/getCookies.js +46 -0
- package/build/commands/browser/getPuppeteer.d.ts +38 -0
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -0
- package/build/commands/browser/getPuppeteer.js +119 -0
- package/build/commands/browser/getWindowSize.d.ts +25 -0
- package/build/commands/browser/getWindowSize.d.ts.map +1 -0
- package/build/commands/browser/getWindowSize.js +30 -0
- package/build/commands/browser/keys.d.ts +28 -0
- package/build/commands/browser/keys.d.ts.map +1 -0
- package/build/commands/browser/keys.js +64 -0
- package/build/commands/browser/mock.d.ts +111 -0
- package/build/commands/browser/mock.d.ts.map +1 -0
- package/build/commands/browser/mock.js +164 -0
- package/build/commands/browser/mockClearAll.d.ts +28 -0
- package/build/commands/browser/mockClearAll.d.ts.map +1 -0
- package/build/commands/browser/mockClearAll.js +43 -0
- package/build/commands/browser/mockRestoreAll.d.ts +26 -0
- package/build/commands/browser/mockRestoreAll.d.ts.map +1 -0
- package/build/commands/browser/mockRestoreAll.js +41 -0
- package/build/commands/browser/newWindow.d.ts +41 -0
- package/build/commands/browser/newWindow.d.ts.map +1 -0
- package/build/commands/browser/newWindow.js +83 -0
- package/build/commands/browser/overwriteCommand.d.ts +32 -0
- package/build/commands/browser/overwriteCommand.d.ts.map +1 -0
- package/build/commands/browser/overwriteCommand.js +32 -0
- package/build/commands/browser/pause.d.ts +23 -0
- package/build/commands/browser/pause.d.ts.map +1 -0
- package/build/commands/browser/pause.js +27 -0
- package/build/commands/browser/react$$.d.ts +36 -0
- package/build/commands/browser/react$$.d.ts.map +1 -0
- package/build/commands/browser/react$$.js +51 -0
- package/build/commands/browser/react$.d.ts +46 -0
- package/build/commands/browser/react$.d.ts.map +1 -0
- package/build/commands/browser/react$.js +59 -0
- package/build/commands/browser/reloadSession.d.ts +23 -0
- package/build/commands/browser/reloadSession.d.ts.map +1 -0
- package/build/commands/browser/reloadSession.js +58 -0
- package/build/commands/browser/savePDF.d.ts +46 -0
- package/build/commands/browser/savePDF.d.ts.map +1 -0
- package/build/commands/browser/savePDF.js +51 -0
- package/build/commands/browser/saveRecordingScreen.d.ts +28 -0
- package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -0
- package/build/commands/browser/saveRecordingScreen.js +47 -0
- package/build/commands/browser/saveScreenshot.d.ts +22 -0
- package/build/commands/browser/saveScreenshot.d.ts.map +1 -0
- package/build/commands/browser/saveScreenshot.js +41 -0
- package/build/commands/browser/setCookies.d.ts +57 -0
- package/build/commands/browser/setCookies.d.ts.map +1 -0
- package/build/commands/browser/setCookies.js +66 -0
- package/build/commands/browser/setTimeout.d.ts +31 -0
- package/build/commands/browser/setTimeout.d.ts.map +1 -0
- package/build/commands/browser/setTimeout.js +61 -0
- package/build/commands/browser/setWindowSize.d.ts +20 -0
- package/build/commands/browser/setWindowSize.d.ts.map +1 -0
- package/build/commands/browser/setWindowSize.js +43 -0
- package/build/commands/browser/switchWindow.d.ts +30 -0
- package/build/commands/browser/switchWindow.d.ts.map +1 -0
- package/build/commands/browser/switchWindow.js +73 -0
- package/build/commands/browser/throttle.d.ts +3 -0
- package/build/commands/browser/throttle.d.ts.map +1 -0
- package/build/commands/browser/throttle.js +144 -0
- package/build/commands/browser/touchAction.d.ts +61 -0
- package/build/commands/browser/touchAction.d.ts.map +1 -0
- package/build/commands/browser/touchAction.js +65 -0
- package/build/commands/browser/uploadFile.d.ts +32 -0
- package/build/commands/browser/uploadFile.d.ts.map +1 -0
- package/build/commands/browser/uploadFile.js +63 -0
- package/build/commands/browser/url.d.ts +38 -0
- package/build/commands/browser/url.d.ts.map +1 -0
- package/build/commands/browser/url.js +49 -0
- package/build/commands/browser/waitUntil.d.ts +44 -0
- package/build/commands/browser/waitUntil.d.ts.map +1 -0
- package/build/commands/browser/waitUntil.js +73 -0
- package/build/commands/browser.d.ts +70 -0
- package/build/commands/browser.d.ts.map +1 -0
- package/build/commands/browser.js +44 -0
- package/build/commands/constant.d.ts +19 -0
- package/build/commands/constant.d.ts.map +1 -0
- package/build/commands/constant.js +91 -0
- package/build/commands/element/$$.d.ts +46 -0
- package/build/commands/element/$$.d.ts.map +1 -0
- package/build/commands/element/$$.js +50 -0
- package/build/commands/element/$.d.ts +72 -0
- package/build/commands/element/$.d.ts.map +1 -0
- package/build/commands/element/$.js +76 -0
- package/build/commands/element/addValue.d.ts +33 -0
- package/build/commands/element/addValue.d.ts.map +1 -0
- package/build/commands/element/addValue.js +48 -0
- package/build/commands/element/clearValue.d.ts +28 -0
- package/build/commands/element/clearValue.d.ts.map +1 -0
- package/build/commands/element/clearValue.js +32 -0
- package/build/commands/element/click.d.ts +73 -0
- package/build/commands/element/click.d.ts.map +1 -0
- package/build/commands/element/click.js +134 -0
- package/build/commands/element/custom$$.d.ts +28 -0
- package/build/commands/element/custom$$.d.ts.map +1 -0
- package/build/commands/element/custom$$.js +57 -0
- package/build/commands/element/custom$.d.ts +27 -0
- package/build/commands/element/custom$.d.ts.map +1 -0
- package/build/commands/element/custom$.js +57 -0
- package/build/commands/element/doubleClick.d.ts +25 -0
- package/build/commands/element/doubleClick.d.ts.map +1 -0
- package/build/commands/element/doubleClick.js +51 -0
- package/build/commands/element/dragAndDrop.d.ts +41 -0
- package/build/commands/element/dragAndDrop.d.ts.map +1 -0
- package/build/commands/element/dragAndDrop.js +98 -0
- package/build/commands/element/getAttribute.d.ts +28 -0
- package/build/commands/element/getAttribute.d.ts.map +1 -0
- package/build/commands/element/getAttribute.js +32 -0
- package/build/commands/element/getCSSProperty.d.ts +71 -0
- package/build/commands/element/getCSSProperty.d.ts.map +1 -0
- package/build/commands/element/getCSSProperty.js +108 -0
- package/build/commands/element/getComputedLabel.d.ts +20 -0
- package/build/commands/element/getComputedLabel.d.ts.map +1 -0
- package/build/commands/element/getComputedLabel.js +24 -0
- package/build/commands/element/getComputedRole.d.ts +20 -0
- package/build/commands/element/getComputedRole.d.ts.map +1 -0
- package/build/commands/element/getComputedRole.js +24 -0
- package/build/commands/element/getHTML.d.ts +32 -0
- package/build/commands/element/getHTML.d.ts.map +1 -0
- package/build/commands/element/getHTML.js +46 -0
- package/build/commands/element/getLocation.d.ts +6 -0
- package/build/commands/element/getLocation.d.ts.map +1 -0
- package/build/commands/element/getLocation.js +46 -0
- package/build/commands/element/getProperty.d.ts +53 -0
- package/build/commands/element/getProperty.d.ts.map +1 -0
- package/build/commands/element/getProperty.js +31 -0
- package/build/commands/element/getSize.d.ts +6 -0
- package/build/commands/element/getSize.d.ts.map +1 -0
- package/build/commands/element/getSize.js +47 -0
- package/build/commands/element/getTagName.d.ts +25 -0
- package/build/commands/element/getTagName.d.ts.map +1 -0
- package/build/commands/element/getTagName.js +29 -0
- package/build/commands/element/getText.d.ts +42 -0
- package/build/commands/element/getText.d.ts.map +1 -0
- package/build/commands/element/getText.js +46 -0
- package/build/commands/element/getValue.d.ts +25 -0
- package/build/commands/element/getValue.d.ts.map +1 -0
- package/build/commands/element/getValue.js +33 -0
- package/build/commands/element/isClickable.d.ts +40 -0
- package/build/commands/element/isClickable.d.ts.map +1 -0
- package/build/commands/element/isClickable.js +57 -0
- package/build/commands/element/isDisplayed.d.ts +50 -0
- package/build/commands/element/isDisplayed.d.ts.map +1 -0
- package/build/commands/element/isDisplayed.js +85 -0
- package/build/commands/element/isDisplayedInViewport.d.ts +38 -0
- package/build/commands/element/isDisplayedInViewport.d.ts.map +1 -0
- package/build/commands/element/isDisplayedInViewport.js +55 -0
- package/build/commands/element/isEnabled.d.ts +34 -0
- package/build/commands/element/isEnabled.d.ts.map +1 -0
- package/build/commands/element/isEnabled.js +38 -0
- package/build/commands/element/isEqual.d.ts +24 -0
- package/build/commands/element/isEqual.d.ts.map +1 -0
- package/build/commands/element/isEqual.js +52 -0
- package/build/commands/element/isExisting.d.ts +49 -0
- package/build/commands/element/isExisting.d.ts.map +1 -0
- package/build/commands/element/isExisting.js +65 -0
- package/build/commands/element/isFocused.d.ts +28 -0
- package/build/commands/element/isFocused.d.ts.map +1 -0
- package/build/commands/element/isFocused.js +42 -0
- package/build/commands/element/isSelected.d.ts +31 -0
- package/build/commands/element/isSelected.d.ts.map +1 -0
- package/build/commands/element/isSelected.js +35 -0
- package/build/commands/element/moveTo.d.ts +21 -0
- package/build/commands/element/moveTo.d.ts.map +1 -0
- package/build/commands/element/moveTo.js +39 -0
- package/build/commands/element/nextElement.d.ts +25 -0
- package/build/commands/element/nextElement.d.ts.map +1 -0
- package/build/commands/element/nextElement.js +31 -0
- package/build/commands/element/parentElement.d.ts +25 -0
- package/build/commands/element/parentElement.d.ts.map +1 -0
- package/build/commands/element/parentElement.js +31 -0
- package/build/commands/element/previousElement.d.ts +25 -0
- package/build/commands/element/previousElement.d.ts.map +1 -0
- package/build/commands/element/previousElement.js +31 -0
- package/build/commands/element/react$$.d.ts +36 -0
- package/build/commands/element/react$$.d.ts.map +1 -0
- package/build/commands/element/react$$.js +51 -0
- package/build/commands/element/react$.d.ts +46 -0
- package/build/commands/element/react$.d.ts.map +1 -0
- package/build/commands/element/react$.js +59 -0
- package/build/commands/element/saveScreenshot.d.ts +21 -0
- package/build/commands/element/saveScreenshot.d.ts.map +1 -0
- package/build/commands/element/saveScreenshot.js +40 -0
- package/build/commands/element/scrollIntoView.d.ts +21 -0
- package/build/commands/element/scrollIntoView.d.ts.map +1 -0
- package/build/commands/element/scrollIntoView.js +31 -0
- package/build/commands/element/selectByAttribute.d.ts +37 -0
- package/build/commands/element/selectByAttribute.d.ts.map +1 -0
- package/build/commands/element/selectByAttribute.js +59 -0
- package/build/commands/element/selectByIndex.d.ts +31 -0
- package/build/commands/element/selectByIndex.d.ts.map +1 -0
- package/build/commands/element/selectByIndex.js +55 -0
- package/build/commands/element/selectByVisibleText.d.ts +31 -0
- package/build/commands/element/selectByVisibleText.d.ts.map +1 -0
- package/build/commands/element/selectByVisibleText.js +66 -0
- package/build/commands/element/setValue.d.ts +29 -0
- package/build/commands/element/setValue.d.ts.map +1 -0
- package/build/commands/element/setValue.js +33 -0
- package/build/commands/element/shadow$$.d.ts +22 -0
- package/build/commands/element/shadow$$.d.ts.map +1 -0
- package/build/commands/element/shadow$$.js +27 -0
- package/build/commands/element/shadow$.d.ts +22 -0
- package/build/commands/element/shadow$.d.ts.map +1 -0
- package/build/commands/element/shadow$.js +27 -0
- package/build/commands/element/touchAction.d.ts +54 -0
- package/build/commands/element/touchAction.d.ts.map +1 -0
- package/build/commands/element/touchAction.js +58 -0
- package/build/commands/element/waitForClickable.d.ts +34 -0
- package/build/commands/element/waitForClickable.d.ts.map +1 -0
- package/build/commands/element/waitForClickable.js +37 -0
- package/build/commands/element/waitForDisplayed.d.ts +44 -0
- package/build/commands/element/waitForDisplayed.d.ts.map +1 -0
- package/build/commands/element/waitForDisplayed.js +47 -0
- package/build/commands/element/waitForEnabled.d.ts +46 -0
- package/build/commands/element/waitForEnabled.d.ts.map +1 -0
- package/build/commands/element/waitForEnabled.js +55 -0
- package/build/commands/element/waitForExist.d.ts +46 -0
- package/build/commands/element/waitForExist.d.ts.map +1 -0
- package/build/commands/element/waitForExist.js +49 -0
- package/build/commands/element/waitUntil.d.ts +49 -0
- package/build/commands/element/waitUntil.d.ts.map +1 -0
- package/build/commands/element/waitUntil.js +53 -0
- package/build/commands/element.d.ts +100 -0
- package/build/commands/element.d.ts.map +1 -0
- package/build/commands/element.js +63 -0
- package/build/commands/mock/abort.d.ts +19 -0
- package/build/commands/mock/abort.d.ts.map +1 -0
- package/build/commands/mock/abort.js +20 -0
- package/build/commands/mock/abortOnce.d.ts +27 -0
- package/build/commands/mock/abortOnce.d.ts.map +1 -0
- package/build/commands/mock/abortOnce.js +28 -0
- package/build/commands/mock/clear.d.ts +18 -0
- package/build/commands/mock/clear.d.ts.map +1 -0
- package/build/commands/mock/clear.js +19 -0
- package/build/commands/mock/respond.d.ts +54 -0
- package/build/commands/mock/respond.d.ts.map +1 -0
- package/build/commands/mock/respond.js +55 -0
- package/build/commands/mock/respondOnce.d.ts +55 -0
- package/build/commands/mock/respondOnce.d.ts.map +1 -0
- package/build/commands/mock/respondOnce.js +56 -0
- package/build/commands/mock/restore.d.ts +18 -0
- package/build/commands/mock/restore.d.ts.map +1 -0
- package/build/commands/mock/restore.js +19 -0
- package/build/constants.d.ts +14 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +286 -0
- package/build/index.d.ts +45 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +175 -0
- package/build/middlewares.d.ts +12 -0
- package/build/middlewares.d.ts.map +1 -0
- package/build/middlewares.js +65 -0
- package/build/multiremote.d.ts +71 -0
- package/build/multiremote.d.ts.map +1 -0
- package/build/multiremote.js +160 -0
- package/build/protocol-stub.d.ts +16 -0
- package/build/protocol-stub.d.ts.map +1 -0
- package/build/protocol-stub.js +77 -0
- package/build/scripts/getHTML.d.ts +9 -0
- package/build/scripts/getHTML.d.ts.map +1 -0
- package/build/scripts/getHTML.js +13 -0
- package/build/scripts/getProperty.d.ts +43 -0
- package/build/scripts/getProperty.d.ts.map +1 -0
- package/build/scripts/getProperty.js +12 -0
- package/build/scripts/isElementClickable.d.ts +7 -0
- package/build/scripts/isElementClickable.d.ts.map +1 -0
- package/build/scripts/isElementClickable.js +121 -0
- package/build/scripts/isElementDisplayed.d.ts +7 -0
- package/build/scripts/isElementDisplayed.d.ts.map +1 -0
- package/build/scripts/isElementDisplayed.js +216 -0
- package/build/scripts/isElementInViewport.d.ts +10 -0
- package/build/scripts/isElementInViewport.d.ts.map +1 -0
- package/build/scripts/isElementInViewport.js +22 -0
- package/build/scripts/isFocused.d.ts +7 -0
- package/build/scripts/isFocused.d.ts.map +1 -0
- package/build/scripts/isFocused.js +11 -0
- package/build/scripts/newWindow.d.ts +10 -0
- package/build/scripts/newWindow.d.ts.map +1 -0
- package/build/scripts/newWindow.js +14 -0
- package/build/scripts/resq.d.ts +6 -0
- package/build/scripts/resq.d.ts.map +1 -0
- package/build/scripts/resq.js +58 -0
- package/build/scripts/shadowFnFactory.d.ts +2 -0
- package/build/scripts/shadowFnFactory.d.ts.map +1 -0
- package/build/scripts/shadowFnFactory.js +17 -0
- package/build/types.d.ts +402 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/utils/SevereServiceError.d.ts +7 -0
- package/build/utils/SevereServiceError.d.ts.map +1 -0
- package/build/utils/SevereServiceError.js +12 -0
- package/build/utils/Timer.d.ts +33 -0
- package/build/utils/Timer.d.ts.map +1 -0
- package/build/utils/Timer.js +126 -0
- package/build/utils/detectBackend.d.ts +23 -0
- package/build/utils/detectBackend.d.ts.map +1 -0
- package/build/utils/detectBackend.js +119 -0
- package/build/utils/findStrategy.d.ts +10 -0
- package/build/utils/findStrategy.d.ts.map +1 -0
- package/build/utils/findStrategy.js +267 -0
- package/build/utils/getElementObject.d.ts +17 -0
- package/build/utils/getElementObject.d.ts.map +1 -0
- package/build/utils/getElementObject.js +107 -0
- package/build/utils/implicitWait.d.ts +7 -0
- package/build/utils/implicitWait.d.ts.map +1 -0
- package/build/utils/implicitWait.js +39 -0
- package/build/utils/index.d.ts +102 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +543 -0
- package/build/utils/interception/devtools.d.ts +61 -0
- package/build/utils/interception/devtools.d.ts.map +1 -0
- package/build/utils/interception/devtools.js +247 -0
- package/build/utils/interception/index.d.ts +26 -0
- package/build/utils/interception/index.d.ts.map +1 -0
- package/build/utils/interception/index.js +49 -0
- package/build/utils/interception/types.d.ts +94 -0
- package/build/utils/interception/types.d.ts.map +1 -0
- package/build/utils/interception/types.js +2 -0
- package/build/utils/interception/webdriver.d.ts +48 -0
- package/build/utils/interception/webdriver.d.ts.map +1 -0
- package/build/utils/interception/webdriver.js +75 -0
- package/build/utils/refetchElement.d.ts +6 -0
- package/build/utils/refetchElement.d.ts.map +1 -0
- package/build/utils/refetchElement.js +32 -0
- package/package.json +10 -10
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Returns true if element exists in the DOM.
|
|
4
|
+
*
|
|
5
|
+
* :::info
|
|
6
|
+
*
|
|
7
|
+
* As opposed to other element commands WebdriverIO will not wait for the element
|
|
8
|
+
* to exist to execute this command.
|
|
9
|
+
*
|
|
10
|
+
* :::
|
|
11
|
+
*
|
|
12
|
+
* <example>
|
|
13
|
+
:index.html
|
|
14
|
+
<div id="notDisplayed" style="display: none"></div>
|
|
15
|
+
<div id="notVisible" style="visibility: hidden"></div>
|
|
16
|
+
<div id="notInViewport" style="position:absolute; left: 9999999"></div>
|
|
17
|
+
<div id="zeroOpacity" style="opacity: 0"></div>
|
|
18
|
+
:isExisting.js
|
|
19
|
+
it('should detect if elements are existing', async () => {
|
|
20
|
+
let elem = await $('#someRandomNonExistingElement')
|
|
21
|
+
let isExisting = await elem.isExisting()
|
|
22
|
+
console.log(isExisting); // outputs: false
|
|
23
|
+
|
|
24
|
+
elem = await $('#notDisplayed')
|
|
25
|
+
isExisting = await elem.isExisting()
|
|
26
|
+
console.log(isExisting); // outputs: true
|
|
27
|
+
|
|
28
|
+
elem = await $('#notVisible')
|
|
29
|
+
isExisting = await elem.isExisting()
|
|
30
|
+
console.log(isExisting); // outputs: true
|
|
31
|
+
|
|
32
|
+
elem = await $('#notInViewport')
|
|
33
|
+
isExisting = await elem.isExisting()
|
|
34
|
+
console.log(isExisting); // outputs: true
|
|
35
|
+
|
|
36
|
+
elem = await $('#zeroOpacity')
|
|
37
|
+
isExisting = await elem.isExisting()
|
|
38
|
+
console.log(isExisting); // outputs: true
|
|
39
|
+
});
|
|
40
|
+
* </example>
|
|
41
|
+
*
|
|
42
|
+
* @alias element.isExisting
|
|
43
|
+
* @return {Boolean} true if element(s)* [is|are] existing
|
|
44
|
+
* @uses protocol/elements
|
|
45
|
+
* @type state
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
export default function isExisting(this: WebdriverIO.Element): Promise<boolean>;
|
|
49
|
+
//# sourceMappingURL=isExisting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isExisting.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isExisting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAA8B,UAAU,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAkBlE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Returns true if element exists in the DOM.
|
|
6
|
+
*
|
|
7
|
+
* :::info
|
|
8
|
+
*
|
|
9
|
+
* As opposed to other element commands WebdriverIO will not wait for the element
|
|
10
|
+
* to exist to execute this command.
|
|
11
|
+
*
|
|
12
|
+
* :::
|
|
13
|
+
*
|
|
14
|
+
* <example>
|
|
15
|
+
:index.html
|
|
16
|
+
<div id="notDisplayed" style="display: none"></div>
|
|
17
|
+
<div id="notVisible" style="visibility: hidden"></div>
|
|
18
|
+
<div id="notInViewport" style="position:absolute; left: 9999999"></div>
|
|
19
|
+
<div id="zeroOpacity" style="opacity: 0"></div>
|
|
20
|
+
:isExisting.js
|
|
21
|
+
it('should detect if elements are existing', async () => {
|
|
22
|
+
let elem = await $('#someRandomNonExistingElement')
|
|
23
|
+
let isExisting = await elem.isExisting()
|
|
24
|
+
console.log(isExisting); // outputs: false
|
|
25
|
+
|
|
26
|
+
elem = await $('#notDisplayed')
|
|
27
|
+
isExisting = await elem.isExisting()
|
|
28
|
+
console.log(isExisting); // outputs: true
|
|
29
|
+
|
|
30
|
+
elem = await $('#notVisible')
|
|
31
|
+
isExisting = await elem.isExisting()
|
|
32
|
+
console.log(isExisting); // outputs: true
|
|
33
|
+
|
|
34
|
+
elem = await $('#notInViewport')
|
|
35
|
+
isExisting = await elem.isExisting()
|
|
36
|
+
console.log(isExisting); // outputs: true
|
|
37
|
+
|
|
38
|
+
elem = await $('#zeroOpacity')
|
|
39
|
+
isExisting = await elem.isExisting()
|
|
40
|
+
console.log(isExisting); // outputs: true
|
|
41
|
+
});
|
|
42
|
+
* </example>
|
|
43
|
+
*
|
|
44
|
+
* @alias element.isExisting
|
|
45
|
+
* @return {Boolean} true if element(s)* [is|are] existing
|
|
46
|
+
* @uses protocol/elements
|
|
47
|
+
* @type state
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
async function isExisting() {
|
|
51
|
+
/**
|
|
52
|
+
* if an element was composed via `const elem = $({ 'element-6066-11e4-a52e-4f735466cecf': <elementId> })`
|
|
53
|
+
* we don't have any selector information. Therefore we can only check existance
|
|
54
|
+
* by calling a command with the element id to check if it is successful or not.
|
|
55
|
+
* Using `getElementTagName` to validate the element existance works as it is
|
|
56
|
+
* a command that should be available for desktop and mobile and fails with a
|
|
57
|
+
* stale element exeception if element is not existing.
|
|
58
|
+
*/
|
|
59
|
+
if (!this.selector) {
|
|
60
|
+
return this.getElementTagName(this.elementId).then(() => true, () => false);
|
|
61
|
+
}
|
|
62
|
+
const command = this.isReactElement ? this.parent.react$$.bind(this.parent) : this.parent.$$.bind(this.parent);
|
|
63
|
+
return command(this.selector).then((res) => res.length > 0);
|
|
64
|
+
}
|
|
65
|
+
exports.default = isExisting;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Return true or false if the selected DOM-element currently has focus. If the selector matches
|
|
4
|
+
* multiple elements, it will return true if one of the elements has focus.
|
|
5
|
+
*
|
|
6
|
+
* <example>
|
|
7
|
+
:index.html
|
|
8
|
+
<input name="login" autofocus="" />
|
|
9
|
+
:hasFocus.js
|
|
10
|
+
it('should detect the focus of an element', async () => {
|
|
11
|
+
await browser.url('/');
|
|
12
|
+
const loginInput = await $('[name="login"]');
|
|
13
|
+
console.log(await loginInput.isFocused()); // outputs: false
|
|
14
|
+
|
|
15
|
+
await loginInput.click();
|
|
16
|
+
console.log(await loginInput.isFocused()); // outputs: true
|
|
17
|
+
})
|
|
18
|
+
* </example>
|
|
19
|
+
*
|
|
20
|
+
* @alias element.isFocused
|
|
21
|
+
* @return {Boolean} true if one of the matching elements has focus
|
|
22
|
+
*
|
|
23
|
+
* @uses protocol/execute
|
|
24
|
+
* @type state
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export default function isFocused(this: WebdriverIO.Element): Promise<boolean>;
|
|
28
|
+
//# sourceMappingURL=isFocused.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFocused.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isFocused.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAA8B,SAAS,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAMjE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
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"));
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* Return true or false if the selected DOM-element currently has focus. If the selector matches
|
|
12
|
+
* multiple elements, it will return true if one of the elements has focus.
|
|
13
|
+
*
|
|
14
|
+
* <example>
|
|
15
|
+
:index.html
|
|
16
|
+
<input name="login" autofocus="" />
|
|
17
|
+
:hasFocus.js
|
|
18
|
+
it('should detect the focus of an element', async () => {
|
|
19
|
+
await browser.url('/');
|
|
20
|
+
const loginInput = await $('[name="login"]');
|
|
21
|
+
console.log(await loginInput.isFocused()); // outputs: false
|
|
22
|
+
|
|
23
|
+
await loginInput.click();
|
|
24
|
+
console.log(await loginInput.isFocused()); // outputs: true
|
|
25
|
+
})
|
|
26
|
+
* </example>
|
|
27
|
+
*
|
|
28
|
+
* @alias element.isFocused
|
|
29
|
+
* @return {Boolean} true if one of the matching elements has focus
|
|
30
|
+
*
|
|
31
|
+
* @uses protocol/execute
|
|
32
|
+
* @type state
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
async function isFocused() {
|
|
36
|
+
const browser = await (0, utils_1.getBrowserObject)(this);
|
|
37
|
+
return browser.execute(isFocused_1.default, {
|
|
38
|
+
[constants_1.ELEMENT_KEY]: this.elementId,
|
|
39
|
+
ELEMENT: this.elementId // jsonwp compatible
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
exports.default = isFocused;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Will return true or false whether or not an `<option>` or `<input>` element of type
|
|
4
|
+
* checkbox or radio is currently selected.
|
|
5
|
+
*
|
|
6
|
+
* <example>
|
|
7
|
+
:index.html
|
|
8
|
+
<select name="selectbox" id="selectbox">
|
|
9
|
+
<option value="John Doe">John Doe</option>
|
|
10
|
+
<option value="Layla Terry" selected="selected">Layla Terry</option>
|
|
11
|
+
<option value="Bill Gilbert">Bill Gilbert"</option>
|
|
12
|
+
</select>
|
|
13
|
+
|
|
14
|
+
:isSelected.js
|
|
15
|
+
it('should detect if an element is selected', async () => {
|
|
16
|
+
let element = await $('[value="Layla Terry"]');
|
|
17
|
+
console.log(await element.isSelected()); // outputs: true
|
|
18
|
+
|
|
19
|
+
element = await $('[value="Bill Gilbert"]')
|
|
20
|
+
console.log(await element.isSelected()); // outputs: false
|
|
21
|
+
});
|
|
22
|
+
* </example>
|
|
23
|
+
*
|
|
24
|
+
* @alias element.isSelected
|
|
25
|
+
* @return {Boolean} true if element is selected
|
|
26
|
+
* @uses protocol/elements, protocol/elementIdSelected
|
|
27
|
+
* @type state
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export default function isSelected(this: WebdriverIO.Element): Promise<boolean>;
|
|
31
|
+
//# sourceMappingURL=isSelected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSelected.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isSelected.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAE5D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Will return true or false whether or not an `<option>` or `<input>` element of type
|
|
6
|
+
* checkbox or radio is currently selected.
|
|
7
|
+
*
|
|
8
|
+
* <example>
|
|
9
|
+
:index.html
|
|
10
|
+
<select name="selectbox" id="selectbox">
|
|
11
|
+
<option value="John Doe">John Doe</option>
|
|
12
|
+
<option value="Layla Terry" selected="selected">Layla Terry</option>
|
|
13
|
+
<option value="Bill Gilbert">Bill Gilbert"</option>
|
|
14
|
+
</select>
|
|
15
|
+
|
|
16
|
+
:isSelected.js
|
|
17
|
+
it('should detect if an element is selected', async () => {
|
|
18
|
+
let element = await $('[value="Layla Terry"]');
|
|
19
|
+
console.log(await element.isSelected()); // outputs: true
|
|
20
|
+
|
|
21
|
+
element = await $('[value="Bill Gilbert"]')
|
|
22
|
+
console.log(await element.isSelected()); // outputs: false
|
|
23
|
+
});
|
|
24
|
+
* </example>
|
|
25
|
+
*
|
|
26
|
+
* @alias element.isSelected
|
|
27
|
+
* @return {Boolean} true if element is selected
|
|
28
|
+
* @uses protocol/elements, protocol/elementIdSelected
|
|
29
|
+
* @type state
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
function isSelected() {
|
|
33
|
+
return this.isElementSelected(this.elementId);
|
|
34
|
+
}
|
|
35
|
+
exports.default = isSelected;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare type MoveToOptions = {
|
|
2
|
+
xOffset?: number;
|
|
3
|
+
yOffset?: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Move the mouse by an offset of the specified element. If no element is specified,
|
|
8
|
+
* the move is relative to the current mouse cursor. If an element is provided but
|
|
9
|
+
* no offset, the mouse will be moved to the center of the element. If the element
|
|
10
|
+
* is not visible, it will be scrolled into view.
|
|
11
|
+
*
|
|
12
|
+
* @param {MoveToOptions=} options moveTo command options
|
|
13
|
+
* @param {Number=} options.xOffset X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
|
|
14
|
+
* @param {Number=} options.yOffset Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidmoveto
|
|
17
|
+
* @type protocol
|
|
18
|
+
*/
|
|
19
|
+
export default function moveTo(this: WebdriverIO.Element, { xOffset, yOffset }?: MoveToOptions): Promise<void>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=moveTo.d.ts.map
|
|
@@ -0,0 +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,iBAuB3C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../utils");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Move the mouse by an offset of the specified element. If no element is specified,
|
|
7
|
+
* the move is relative to the current mouse cursor. If an element is provided but
|
|
8
|
+
* no offset, the mouse will be moved to the center of the element. If the element
|
|
9
|
+
* is not visible, it will be scrolled into view.
|
|
10
|
+
*
|
|
11
|
+
* @param {MoveToOptions=} options moveTo command options
|
|
12
|
+
* @param {Number=} options.xOffset X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
|
|
13
|
+
* @param {Number=} options.yOffset Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidmoveto
|
|
16
|
+
* @type protocol
|
|
17
|
+
*/
|
|
18
|
+
async function moveTo({ xOffset, yOffset } = {}) {
|
|
19
|
+
if (!this.isW3C) {
|
|
20
|
+
return this.moveToElement(this.elementId, xOffset, yOffset);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* get rect of element
|
|
24
|
+
*/
|
|
25
|
+
const { x, y, width, height } = await (0, utils_1.getElementRect)(this);
|
|
26
|
+
const { scrollX, scrollY } = await (0, utils_1.getScrollPosition)(this);
|
|
27
|
+
const newXOffset = Math.floor(x - scrollX + (typeof xOffset === 'number' ? xOffset : (width / 2)));
|
|
28
|
+
const newYOffset = Math.floor(y - scrollY + (typeof yOffset === 'number' ? yOffset : (height / 2)));
|
|
29
|
+
/**
|
|
30
|
+
* W3C way of handle the mouse move actions
|
|
31
|
+
*/
|
|
32
|
+
return this.performActions([{
|
|
33
|
+
type: 'pointer',
|
|
34
|
+
id: 'finger1',
|
|
35
|
+
parameters: { pointerType: 'mouse' },
|
|
36
|
+
actions: [{ type: 'pointerMove', duration: 0, x: newXOffset, y: newYOffset }]
|
|
37
|
+
}]).then(() => this.releaseActions());
|
|
38
|
+
}
|
|
39
|
+
exports.default = moveTo;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Returns the next sibling element of the selected DOM-element.
|
|
4
|
+
*
|
|
5
|
+
* <example>
|
|
6
|
+
:index.html
|
|
7
|
+
<div class="parent">
|
|
8
|
+
<p>Sibling One</p>
|
|
9
|
+
<p>Sibling Two</p>
|
|
10
|
+
<p>Sibling Three</p>
|
|
11
|
+
</div>
|
|
12
|
+
:nextElement.js
|
|
13
|
+
it('should get text from next sibling element', async () => {
|
|
14
|
+
const elem = await $$('p');
|
|
15
|
+
const nextElement = await elem[1].nextElement()
|
|
16
|
+
console.log(await nextElement.getText()); // outputs: "Sibling Three"
|
|
17
|
+
});
|
|
18
|
+
* </example>
|
|
19
|
+
*
|
|
20
|
+
* @alias element.nextElement
|
|
21
|
+
* @return {Element}
|
|
22
|
+
* @type utility
|
|
23
|
+
*/
|
|
24
|
+
export default function nextElement(this: WebdriverIO.Element): import("../..").ChainablePromiseElement<WebdriverIO.Element>;
|
|
25
|
+
//# sourceMappingURL=nextElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextElement.d.ts","sourceRoot":"","sources":["../../../src/commands/element/nextElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,gEAI7D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Returns the next sibling element of the selected DOM-element.
|
|
5
|
+
*
|
|
6
|
+
* <example>
|
|
7
|
+
:index.html
|
|
8
|
+
<div class="parent">
|
|
9
|
+
<p>Sibling One</p>
|
|
10
|
+
<p>Sibling Two</p>
|
|
11
|
+
<p>Sibling Three</p>
|
|
12
|
+
</div>
|
|
13
|
+
:nextElement.js
|
|
14
|
+
it('should get text from next sibling element', async () => {
|
|
15
|
+
const elem = await $$('p');
|
|
16
|
+
const nextElement = await elem[1].nextElement()
|
|
17
|
+
console.log(await nextElement.getText()); // outputs: "Sibling Three"
|
|
18
|
+
});
|
|
19
|
+
* </example>
|
|
20
|
+
*
|
|
21
|
+
* @alias element.nextElement
|
|
22
|
+
* @return {Element}
|
|
23
|
+
* @type utility
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
function nextElement() {
|
|
27
|
+
return this.$(/* istanbul ignore next */ function () {
|
|
28
|
+
return this.nextElementSibling;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.default = nextElement;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Returns the parent element of the selected DOM-element.
|
|
4
|
+
*
|
|
5
|
+
* <example>
|
|
6
|
+
:index.html
|
|
7
|
+
<div class="parent">
|
|
8
|
+
<p>Sibling One</p>
|
|
9
|
+
<p>Sibling Two</p>
|
|
10
|
+
<p>Sibling Three</p>
|
|
11
|
+
</div>
|
|
12
|
+
:parentElement.js
|
|
13
|
+
it('should get class from parent element', async () => {
|
|
14
|
+
const elem = await $$('p');
|
|
15
|
+
const parent = await elem[2].parentElement()
|
|
16
|
+
console.log(await parent.getAttribute('class')); // outputs: "parent"
|
|
17
|
+
});
|
|
18
|
+
* </example>
|
|
19
|
+
*
|
|
20
|
+
* @alias element.parentElement
|
|
21
|
+
* @return {Element}
|
|
22
|
+
* @type utility
|
|
23
|
+
*/
|
|
24
|
+
export default function parentElement(this: WebdriverIO.Element): import("../..").ChainablePromiseElement<WebdriverIO.Element>;
|
|
25
|
+
//# sourceMappingURL=parentElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parentElement.d.ts","sourceRoot":"","sources":["../../../src/commands/element/parentElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,gEAI/D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Returns the parent element of the selected DOM-element.
|
|
6
|
+
*
|
|
7
|
+
* <example>
|
|
8
|
+
:index.html
|
|
9
|
+
<div class="parent">
|
|
10
|
+
<p>Sibling One</p>
|
|
11
|
+
<p>Sibling Two</p>
|
|
12
|
+
<p>Sibling Three</p>
|
|
13
|
+
</div>
|
|
14
|
+
:parentElement.js
|
|
15
|
+
it('should get class from parent element', async () => {
|
|
16
|
+
const elem = await $$('p');
|
|
17
|
+
const parent = await elem[2].parentElement()
|
|
18
|
+
console.log(await parent.getAttribute('class')); // outputs: "parent"
|
|
19
|
+
});
|
|
20
|
+
* </example>
|
|
21
|
+
*
|
|
22
|
+
* @alias element.parentElement
|
|
23
|
+
* @return {Element}
|
|
24
|
+
* @type utility
|
|
25
|
+
*/
|
|
26
|
+
function parentElement() {
|
|
27
|
+
return this.$(/* istanbul ignore next */ function () {
|
|
28
|
+
return this.parentElement;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.default = parentElement;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Returns the previous sibling element of the selected DOM-element.
|
|
4
|
+
*
|
|
5
|
+
* <example>
|
|
6
|
+
:index.html
|
|
7
|
+
<div class="parent">
|
|
8
|
+
<p>Sibling One</p>
|
|
9
|
+
<p>Sibling Two</p>
|
|
10
|
+
<p>Sibling Three</p>
|
|
11
|
+
</div>
|
|
12
|
+
:previousElement.js
|
|
13
|
+
it('should get text from previous sibling element', async () => {
|
|
14
|
+
const elem = await $$('p');
|
|
15
|
+
const previousElem = await elem[1].previousElement()
|
|
16
|
+
console.log(await previousElem.getText()); // outputs: "Sibling One"
|
|
17
|
+
});
|
|
18
|
+
* </example>
|
|
19
|
+
*
|
|
20
|
+
* @alias element.previousElement
|
|
21
|
+
* @return {Element}
|
|
22
|
+
* @type utility
|
|
23
|
+
*/
|
|
24
|
+
export default function previousElement(this: WebdriverIO.Element): import("../..").ChainablePromiseElement<WebdriverIO.Element>;
|
|
25
|
+
//# sourceMappingURL=previousElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previousElement.d.ts","sourceRoot":"","sources":["../../../src/commands/element/previousElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,gEAIjE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Returns the previous sibling element of the selected DOM-element.
|
|
6
|
+
*
|
|
7
|
+
* <example>
|
|
8
|
+
:index.html
|
|
9
|
+
<div class="parent">
|
|
10
|
+
<p>Sibling One</p>
|
|
11
|
+
<p>Sibling Two</p>
|
|
12
|
+
<p>Sibling Three</p>
|
|
13
|
+
</div>
|
|
14
|
+
:previousElement.js
|
|
15
|
+
it('should get text from previous sibling element', async () => {
|
|
16
|
+
const elem = await $$('p');
|
|
17
|
+
const previousElem = await elem[1].previousElement()
|
|
18
|
+
console.log(await previousElem.getText()); // outputs: "Sibling One"
|
|
19
|
+
});
|
|
20
|
+
* </example>
|
|
21
|
+
*
|
|
22
|
+
* @alias element.previousElement
|
|
23
|
+
* @return {Element}
|
|
24
|
+
* @type utility
|
|
25
|
+
*/
|
|
26
|
+
function previousElement() {
|
|
27
|
+
return this.$(/* istanbul ignore next */ function () {
|
|
28
|
+
return this.previousElementSibling;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.default = previousElement;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactSelectorOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* The `react$$` command is a useful command to query multiple React Components
|
|
5
|
+
* by their actual name and filter them by props and state.
|
|
6
|
+
*
|
|
7
|
+
* :::info
|
|
8
|
+
*
|
|
9
|
+
* The command only works with applications using React v16.x. Read more about React
|
|
10
|
+
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
11
|
+
*
|
|
12
|
+
* :::
|
|
13
|
+
*
|
|
14
|
+
* <example>
|
|
15
|
+
:pause.js
|
|
16
|
+
it('should calculate 7 * 6', async () => {
|
|
17
|
+
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
18
|
+
|
|
19
|
+
const orangeButtons = await browser.react$$('t', {
|
|
20
|
+
props: { orange: true }
|
|
21
|
+
})
|
|
22
|
+
console.log(await orangeButtons.map((btn) => btn.getText()));
|
|
23
|
+
// prints "[ '÷', 'x', '-', '+', '=' ]"
|
|
24
|
+
});
|
|
25
|
+
* </example>
|
|
26
|
+
*
|
|
27
|
+
* @alias react$$
|
|
28
|
+
* @param {String} selector of React component
|
|
29
|
+
* @param {ReactSelectorOptions=} options React selector options
|
|
30
|
+
* @param {Object=} options.props React props the element should contain
|
|
31
|
+
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
32
|
+
* @return {ElementArray}
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export default function react$$(this: WebdriverIO.Element, selector: string, { props, state }?: ReactSelectorOptions): Promise<import("../../types").ElementArray>;
|
|
36
|
+
//# sourceMappingURL=react$$.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react$$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/react$$.ts"],"names":[],"mappings":"AAMA,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,+CAUxD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
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");
|
|
8
|
+
const getElementObject_1 = require("../../utils/getElementObject");
|
|
9
|
+
const resq_1 = require("../../scripts/resq");
|
|
10
|
+
const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* The `react$$` command is a useful command to query multiple React Components
|
|
14
|
+
* by their actual name and filter them by props and state.
|
|
15
|
+
*
|
|
16
|
+
* :::info
|
|
17
|
+
*
|
|
18
|
+
* The command only works with applications using React v16.x. Read more about React
|
|
19
|
+
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
20
|
+
*
|
|
21
|
+
* :::
|
|
22
|
+
*
|
|
23
|
+
* <example>
|
|
24
|
+
:pause.js
|
|
25
|
+
it('should calculate 7 * 6', async () => {
|
|
26
|
+
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
27
|
+
|
|
28
|
+
const orangeButtons = await browser.react$$('t', {
|
|
29
|
+
props: { orange: true }
|
|
30
|
+
})
|
|
31
|
+
console.log(await orangeButtons.map((btn) => btn.getText()));
|
|
32
|
+
// prints "[ '÷', 'x', '-', '+', '=' ]"
|
|
33
|
+
});
|
|
34
|
+
* </example>
|
|
35
|
+
*
|
|
36
|
+
* @alias react$$
|
|
37
|
+
* @param {String} selector of React component
|
|
38
|
+
* @param {ReactSelectorOptions=} options React selector options
|
|
39
|
+
* @param {Object=} options.props React props the element should contain
|
|
40
|
+
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
41
|
+
* @return {ElementArray}
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
async function react$$(selector, { props = {}, state = {} } = {}) {
|
|
45
|
+
await this.executeScript(resqScript.toString(), []);
|
|
46
|
+
await this.execute(resq_1.waitToLoadReact);
|
|
47
|
+
const res = await this.execute(resq_1.react$$, selector, props, state, this);
|
|
48
|
+
const elements = await getElementObject_1.getElements.call(this, selector, res, true);
|
|
49
|
+
return (0, utils_1.enhanceElementsArray)(elements, this, selector, 'react$$', [props, state]);
|
|
50
|
+
}
|
|
51
|
+
exports.default = react$$;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactSelectorOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* The `react$` command is a useful command to query React Components by their
|
|
5
|
+
* actual name and filter them by props and state.
|
|
6
|
+
*
|
|
7
|
+
* :::info
|
|
8
|
+
*
|
|
9
|
+
* The command only works with applications using React v16.x. Read more about React
|
|
10
|
+
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
11
|
+
*
|
|
12
|
+
* :::
|
|
13
|
+
*
|
|
14
|
+
* <example>
|
|
15
|
+
:pause.js
|
|
16
|
+
it('should calculate 7 * 6', async () => {
|
|
17
|
+
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
18
|
+
const appWrapper = await browser.$('div#root')
|
|
19
|
+
|
|
20
|
+
await browser.react$('t', {
|
|
21
|
+
props: { name: '7' }
|
|
22
|
+
}).click()
|
|
23
|
+
await browser.react$('t', {
|
|
24
|
+
props: { name: 'x' }
|
|
25
|
+
}).click()
|
|
26
|
+
await browser.react$('t', {
|
|
27
|
+
props: { name: '6' }
|
|
28
|
+
}).click()
|
|
29
|
+
await browser.react$('t', {
|
|
30
|
+
props: { name: '=' }
|
|
31
|
+
}).click()
|
|
32
|
+
|
|
33
|
+
console.log(await $('.component-display').getText()); // prints "42"
|
|
34
|
+
});
|
|
35
|
+
* </example>
|
|
36
|
+
*
|
|
37
|
+
* @alias react$
|
|
38
|
+
* @param {String} selector of React component
|
|
39
|
+
* @param {ReactSelectorOptions=} options React selector options
|
|
40
|
+
* @param {Object=} options.props React props the element should contain
|
|
41
|
+
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
42
|
+
* @return {Element}
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
export default function react$(this: WebdriverIO.Element, selector: string, { props, state }?: ReactSelectorOptions): Promise<WebdriverIO.Element>;
|
|
46
|
+
//# sourceMappingURL=react$.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/react$.ts"],"names":[],"mappings":"AAKA,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,gCASxD"}
|