webdriverio 7.17.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/browser/$$.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 +287 -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 +11 -11
|
@@ -0,0 +1,108 @@
|
|
|
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 serialize_error_1 = require("serialize-error");
|
|
7
|
+
const repl_1 = __importDefault(require("@wdio/repl"));
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* This command helps you to debug your integration tests. It stops the running browser and gives
|
|
11
|
+
* you time to jump into it and check the state of your application (e.g. using dev tools).
|
|
12
|
+
* Your terminal transforms into a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)
|
|
13
|
+
* interface that will allow you to try out certain commands, find elements and test actions on
|
|
14
|
+
* them.
|
|
15
|
+
*
|
|
16
|
+
* [](https://webdriver.io/img/repl.gif)
|
|
17
|
+
*
|
|
18
|
+
* If you run the WDIO testrunner make sure you increase the timeout property of the test framework
|
|
19
|
+
* you are using (e.g. Mocha or Jasmine) in order to prevent test termination due to a test timeout.
|
|
20
|
+
* Also avoid executing the command with multiple capabilities running at the same time.
|
|
21
|
+
*
|
|
22
|
+
* <iframe width="560" height="315" src="https://www.youtube.com/embed/xWwP-3B_YyE" frameborder="0" allowFullScreen></iframe>
|
|
23
|
+
*
|
|
24
|
+
* <example>
|
|
25
|
+
:debug.js
|
|
26
|
+
it('should demonstrate the debug command', async () => {
|
|
27
|
+
await $('#input').setValue('FOO')
|
|
28
|
+
await browser.debug() // jumping into the browser and change value of #input to 'BAR'
|
|
29
|
+
const value = await $('#input').getValue()
|
|
30
|
+
console.log(value) // outputs: "BAR"
|
|
31
|
+
})
|
|
32
|
+
* </example>
|
|
33
|
+
*
|
|
34
|
+
* @alias browser.debug
|
|
35
|
+
* @type utility
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
function debug(commandTimeout = 5000) {
|
|
39
|
+
const repl = new repl_1.default();
|
|
40
|
+
const { introMessage } = repl_1.default;
|
|
41
|
+
/**
|
|
42
|
+
* run repl in standalone mode
|
|
43
|
+
*/
|
|
44
|
+
if (!process.env.WDIO_WORKER || typeof process.send !== 'function') {
|
|
45
|
+
// eslint-disable-next-line
|
|
46
|
+
console.log(repl_1.default.introMessage);
|
|
47
|
+
const context = {
|
|
48
|
+
browser: this,
|
|
49
|
+
driver: this,
|
|
50
|
+
$: this.$.bind(this),
|
|
51
|
+
$$: this.$$.bind(this)
|
|
52
|
+
};
|
|
53
|
+
return repl.start(context);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* register worker process as debugger target
|
|
57
|
+
*/
|
|
58
|
+
process._debugProcess(process.pid);
|
|
59
|
+
/**
|
|
60
|
+
* initialise repl in testrunner
|
|
61
|
+
*/
|
|
62
|
+
process.send({
|
|
63
|
+
origin: 'debugger',
|
|
64
|
+
name: 'start',
|
|
65
|
+
params: { commandTimeout, introMessage }
|
|
66
|
+
});
|
|
67
|
+
let commandResolve = /* istanbul ignore next */ () => { };
|
|
68
|
+
process.on('message', (m) => {
|
|
69
|
+
if (m.origin !== 'debugger') {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (m.name === 'stop') {
|
|
73
|
+
process._debugEnd(process.pid);
|
|
74
|
+
return commandResolve();
|
|
75
|
+
}
|
|
76
|
+
/* istanbul ignore if */
|
|
77
|
+
if (m.name === 'eval') {
|
|
78
|
+
repl.eval(m.content.cmd, global, undefined, (err, result) => {
|
|
79
|
+
if (typeof process.send !== 'function') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (err) {
|
|
83
|
+
process.send({
|
|
84
|
+
origin: 'debugger',
|
|
85
|
+
name: 'result',
|
|
86
|
+
params: {
|
|
87
|
+
error: true,
|
|
88
|
+
...(0, serialize_error_1.serializeError)(err)
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* try to do some smart serializations
|
|
94
|
+
*/
|
|
95
|
+
if (typeof result === 'function') {
|
|
96
|
+
result = `[Function: ${result.name}]`;
|
|
97
|
+
}
|
|
98
|
+
process.send({
|
|
99
|
+
origin: 'debugger',
|
|
100
|
+
name: 'result',
|
|
101
|
+
params: { result }
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return new Promise((resolve) => (commandResolve = resolve));
|
|
107
|
+
}
|
|
108
|
+
exports.default = debug;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Delete cookies visible to the current page. By providing a cookie name it just removes the single cookie or more when multiple names are passed.
|
|
4
|
+
*
|
|
5
|
+
* <example>
|
|
6
|
+
:deleteCookie.js
|
|
7
|
+
it('should delete cookies', async () => {
|
|
8
|
+
await browser.setCookies([
|
|
9
|
+
{name: 'test', value: '123'},
|
|
10
|
+
{name: 'test2', value: '456'},
|
|
11
|
+
{name: 'test3', value: '789'}
|
|
12
|
+
])
|
|
13
|
+
|
|
14
|
+
let cookies = await browser.getCookies()
|
|
15
|
+
console.log(cookies)
|
|
16
|
+
// outputs:
|
|
17
|
+
// [
|
|
18
|
+
// { name: 'test', value: '123' },
|
|
19
|
+
// { name: 'test2', value: '456' }
|
|
20
|
+
// { name: 'test3', value: '789' }
|
|
21
|
+
// ]
|
|
22
|
+
|
|
23
|
+
await browser.deleteCookies(['test3'])
|
|
24
|
+
cookies = await browser.getCookies()
|
|
25
|
+
console.log(cookies)
|
|
26
|
+
// outputs:
|
|
27
|
+
// [
|
|
28
|
+
// { name: 'test', value: '123' },
|
|
29
|
+
// { name: 'test2', value: '456' }
|
|
30
|
+
// ]
|
|
31
|
+
|
|
32
|
+
await browser.deleteCookies()
|
|
33
|
+
cookies = await browser.getCookies()
|
|
34
|
+
console.log(cookies) // outputs: []
|
|
35
|
+
})
|
|
36
|
+
* </example>
|
|
37
|
+
*
|
|
38
|
+
* @alias browser.deleteCookies
|
|
39
|
+
* @param {String=|String[]=} names names of cookies to be deleted
|
|
40
|
+
* @uses webdriver/deleteAllCookies,webdriver/deleteCookie
|
|
41
|
+
* @type cookie
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export default function deleteCookies(this: WebdriverIO.Browser, names?: string | string[]): Promise<void> | Promise<void[]>;
|
|
45
|
+
//# sourceMappingURL=deleteCookies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/deleteCookies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,mCAa5B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Delete cookies visible to the current page. By providing a cookie name it just removes the single cookie or more when multiple names are passed.
|
|
6
|
+
*
|
|
7
|
+
* <example>
|
|
8
|
+
:deleteCookie.js
|
|
9
|
+
it('should delete cookies', async () => {
|
|
10
|
+
await browser.setCookies([
|
|
11
|
+
{name: 'test', value: '123'},
|
|
12
|
+
{name: 'test2', value: '456'},
|
|
13
|
+
{name: 'test3', value: '789'}
|
|
14
|
+
])
|
|
15
|
+
|
|
16
|
+
let cookies = await browser.getCookies()
|
|
17
|
+
console.log(cookies)
|
|
18
|
+
// outputs:
|
|
19
|
+
// [
|
|
20
|
+
// { name: 'test', value: '123' },
|
|
21
|
+
// { name: 'test2', value: '456' }
|
|
22
|
+
// { name: 'test3', value: '789' }
|
|
23
|
+
// ]
|
|
24
|
+
|
|
25
|
+
await browser.deleteCookies(['test3'])
|
|
26
|
+
cookies = await browser.getCookies()
|
|
27
|
+
console.log(cookies)
|
|
28
|
+
// outputs:
|
|
29
|
+
// [
|
|
30
|
+
// { name: 'test', value: '123' },
|
|
31
|
+
// { name: 'test2', value: '456' }
|
|
32
|
+
// ]
|
|
33
|
+
|
|
34
|
+
await browser.deleteCookies()
|
|
35
|
+
cookies = await browser.getCookies()
|
|
36
|
+
console.log(cookies) // outputs: []
|
|
37
|
+
})
|
|
38
|
+
* </example>
|
|
39
|
+
*
|
|
40
|
+
* @alias browser.deleteCookies
|
|
41
|
+
* @param {String=|String[]=} names names of cookies to be deleted
|
|
42
|
+
* @uses webdriver/deleteAllCookies,webdriver/deleteCookie
|
|
43
|
+
* @type cookie
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
function deleteCookies(names) {
|
|
47
|
+
if (names === undefined) {
|
|
48
|
+
return this.deleteAllCookies();
|
|
49
|
+
}
|
|
50
|
+
const namesList = Array.isArray(names) ? names : [names];
|
|
51
|
+
if (namesList.every(obj => typeof obj !== 'string')) {
|
|
52
|
+
return Promise.reject(new Error('Invalid input (see https://webdriver.io/docs/api/browser/deleteCookies for documentation)'));
|
|
53
|
+
}
|
|
54
|
+
return Promise.all(namesList.map(name => this.deleteCookie(name)));
|
|
55
|
+
}
|
|
56
|
+
exports.default = deleteCookies;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
|
4
|
+
* The executed script is assumed to be synchronous and the result of evaluating the script is returned to
|
|
5
|
+
* the client.
|
|
6
|
+
*
|
|
7
|
+
* The script argument defines the script to execute in the form of a function body. The value returned by
|
|
8
|
+
* that function will be returned to the client. The function will be invoked with the provided args array
|
|
9
|
+
* and the values may be accessed via the arguments object in the order specified.
|
|
10
|
+
*
|
|
11
|
+
* Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement
|
|
12
|
+
* reference will be converted to the corresponding DOM element. Likewise, any WebElements in the script
|
|
13
|
+
* result will be returned to the client as WebElement JSON objects.
|
|
14
|
+
*
|
|
15
|
+
* <example>
|
|
16
|
+
:execute.js
|
|
17
|
+
it('should inject javascript on the page', async () => {
|
|
18
|
+
const result = await browser.execute((a, b, c, d) => {
|
|
19
|
+
// browser context - you may not access client or console
|
|
20
|
+
return a + b + c + d
|
|
21
|
+
}, 1, 2, 3, 4)
|
|
22
|
+
// node.js context - client and console are available
|
|
23
|
+
console.log(result) // outputs: 10
|
|
24
|
+
});
|
|
25
|
+
* </example>
|
|
26
|
+
*
|
|
27
|
+
* @param {String|Function} script The script to execute.
|
|
28
|
+
* @param {*=} arguments script arguments
|
|
29
|
+
*
|
|
30
|
+
* @return {*} The script result.
|
|
31
|
+
*
|
|
32
|
+
* @see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-execute-script
|
|
33
|
+
* @type protocol
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export default function execute<ReturnValue, InnerArguments extends any[]>(this: WebdriverIO.Browser | WebdriverIO.Element, script: string | ((...innerArgs: InnerArguments) => ReturnValue), ...args: InnerArguments): Promise<ReturnValue>;
|
|
37
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/execute.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EACrE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,cAAc,KAAK,WAAW,CAAC,EAChE,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../utils");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
|
7
|
+
* The executed script is assumed to be synchronous and the result of evaluating the script is returned to
|
|
8
|
+
* the client.
|
|
9
|
+
*
|
|
10
|
+
* The script argument defines the script to execute in the form of a function body. The value returned by
|
|
11
|
+
* that function will be returned to the client. The function will be invoked with the provided args array
|
|
12
|
+
* and the values may be accessed via the arguments object in the order specified.
|
|
13
|
+
*
|
|
14
|
+
* Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement
|
|
15
|
+
* reference will be converted to the corresponding DOM element. Likewise, any WebElements in the script
|
|
16
|
+
* result will be returned to the client as WebElement JSON objects.
|
|
17
|
+
*
|
|
18
|
+
* <example>
|
|
19
|
+
:execute.js
|
|
20
|
+
it('should inject javascript on the page', async () => {
|
|
21
|
+
const result = await browser.execute((a, b, c, d) => {
|
|
22
|
+
// browser context - you may not access client or console
|
|
23
|
+
return a + b + c + d
|
|
24
|
+
}, 1, 2, 3, 4)
|
|
25
|
+
// node.js context - client and console are available
|
|
26
|
+
console.log(result) // outputs: 10
|
|
27
|
+
});
|
|
28
|
+
* </example>
|
|
29
|
+
*
|
|
30
|
+
* @param {String|Function} script The script to execute.
|
|
31
|
+
* @param {*=} arguments script arguments
|
|
32
|
+
*
|
|
33
|
+
* @return {*} The script result.
|
|
34
|
+
*
|
|
35
|
+
* @see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-execute-script
|
|
36
|
+
* @type protocol
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
function execute(script, ...args) {
|
|
40
|
+
/**
|
|
41
|
+
* parameter check
|
|
42
|
+
*/
|
|
43
|
+
if ((typeof script !== 'string' && typeof script !== 'function')) {
|
|
44
|
+
throw new Error('number or type of arguments don\'t agree with execute protocol command');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* instances started as multibrowserinstance can't getting called with
|
|
48
|
+
* a function parameter, therefore we need to check if it starts with "function () {"
|
|
49
|
+
*/
|
|
50
|
+
if (typeof script === 'function') {
|
|
51
|
+
script = `return (${script}).apply(null, arguments)`;
|
|
52
|
+
}
|
|
53
|
+
return this.executeScript(script, (0, utils_1.verifyArgsAndStripIfElement)(args));
|
|
54
|
+
}
|
|
55
|
+
exports.default = execute;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected
|
|
4
|
+
* frame. The executed script is assumed to be asynchronous and must signal that is done by invoking
|
|
5
|
+
* the provided callback, which is always provided as the final argument to the function. The value
|
|
6
|
+
* to this callback will be returned to the client.
|
|
7
|
+
*
|
|
8
|
+
* Asynchronous script commands may not span page loads. If an unload event is fired while waiting
|
|
9
|
+
* for a script result, an error should be returned to the client.
|
|
10
|
+
*
|
|
11
|
+
* The script argument defines the script to execute in the form of a function body. The function will
|
|
12
|
+
* be invoked with the provided args array and the values may be accessed via the arguments object
|
|
13
|
+
* in the order specified. The final argument will always be a callback function that must be invoked
|
|
14
|
+
* to signal that the script has finished.
|
|
15
|
+
*
|
|
16
|
+
* Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement
|
|
17
|
+
* reference will be converted to the corresponding DOM element. Likewise, any WebElements in the script
|
|
18
|
+
* result will be returned to the client as WebElement JSON objects.
|
|
19
|
+
*
|
|
20
|
+
* <example>
|
|
21
|
+
:executeAsync.js
|
|
22
|
+
it('should execute async JavaScript on the page', async () => {
|
|
23
|
+
await browser.setTimeout({ script: 5000 })
|
|
24
|
+
const result = await browser.executeAsync(function(a, b, c, d, done) {
|
|
25
|
+
// browser context - you may not access client or console
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
done(a + b + c + d)
|
|
28
|
+
}, 3000);
|
|
29
|
+
}, 1, 2, 3, 4)
|
|
30
|
+
// node.js context - client and console are available
|
|
31
|
+
console.log(result) // outputs: 10
|
|
32
|
+
});
|
|
33
|
+
* </example>
|
|
34
|
+
*
|
|
35
|
+
* @param {String|Function} script The script to execute.
|
|
36
|
+
* @param {*=} arguments script arguments
|
|
37
|
+
*
|
|
38
|
+
* @return {*} The script result.
|
|
39
|
+
*
|
|
40
|
+
* @see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-execute-async-script
|
|
41
|
+
* @type protocol
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export default function executeAsync<ReturnValue, InnerArguments extends any[]>(this: WebdriverIO.Browser | WebdriverIO.Element, script: string | ((...args: [...innerArgs: InnerArguments, callback: (result?: ReturnValue) => void]) => void), ...args: InnerArguments): Promise<ReturnValue>;
|
|
45
|
+
//# sourceMappingURL=executeAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeAsync.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/executeAsync.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EAC1E,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,MAAM,EACF,MAAM,GACN,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,EACjG,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../utils");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected
|
|
7
|
+
* frame. The executed script is assumed to be asynchronous and must signal that is done by invoking
|
|
8
|
+
* the provided callback, which is always provided as the final argument to the function. The value
|
|
9
|
+
* to this callback will be returned to the client.
|
|
10
|
+
*
|
|
11
|
+
* Asynchronous script commands may not span page loads. If an unload event is fired while waiting
|
|
12
|
+
* for a script result, an error should be returned to the client.
|
|
13
|
+
*
|
|
14
|
+
* The script argument defines the script to execute in the form of a function body. The function will
|
|
15
|
+
* be invoked with the provided args array and the values may be accessed via the arguments object
|
|
16
|
+
* in the order specified. The final argument will always be a callback function that must be invoked
|
|
17
|
+
* to signal that the script has finished.
|
|
18
|
+
*
|
|
19
|
+
* Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement
|
|
20
|
+
* reference will be converted to the corresponding DOM element. Likewise, any WebElements in the script
|
|
21
|
+
* result will be returned to the client as WebElement JSON objects.
|
|
22
|
+
*
|
|
23
|
+
* <example>
|
|
24
|
+
:executeAsync.js
|
|
25
|
+
it('should execute async JavaScript on the page', async () => {
|
|
26
|
+
await browser.setTimeout({ script: 5000 })
|
|
27
|
+
const result = await browser.executeAsync(function(a, b, c, d, done) {
|
|
28
|
+
// browser context - you may not access client or console
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
done(a + b + c + d)
|
|
31
|
+
}, 3000);
|
|
32
|
+
}, 1, 2, 3, 4)
|
|
33
|
+
// node.js context - client and console are available
|
|
34
|
+
console.log(result) // outputs: 10
|
|
35
|
+
});
|
|
36
|
+
* </example>
|
|
37
|
+
*
|
|
38
|
+
* @param {String|Function} script The script to execute.
|
|
39
|
+
* @param {*=} arguments script arguments
|
|
40
|
+
*
|
|
41
|
+
* @return {*} The script result.
|
|
42
|
+
*
|
|
43
|
+
* @see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-execute-async-script
|
|
44
|
+
* @type protocol
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
function executeAsync(script, ...args) {
|
|
48
|
+
/**
|
|
49
|
+
* parameter check
|
|
50
|
+
*/
|
|
51
|
+
if ((typeof script !== 'string' && typeof script !== 'function')) {
|
|
52
|
+
throw new Error('number or type of arguments don\'t agree with execute protocol command');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* instances started as multibrowserinstance can't getting called with
|
|
56
|
+
* a function parameter, therefore we need to check if it starts with "function () {"
|
|
57
|
+
*/
|
|
58
|
+
if (typeof script === 'function') {
|
|
59
|
+
script = `return (${script}).apply(null, arguments)`;
|
|
60
|
+
}
|
|
61
|
+
return this.executeAsyncScript(script, (0, utils_1.verifyArgsAndStripIfElement)(args));
|
|
62
|
+
}
|
|
63
|
+
exports.default = executeAsync;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Retrieve a [cookie](https://w3c.github.io/webdriver/webdriver-spec.html#cookies)
|
|
4
|
+
* visible to the current page. You can query a specific cookie by providing the cookie name or
|
|
5
|
+
* retrieve all.
|
|
6
|
+
*
|
|
7
|
+
* <example>
|
|
8
|
+
:getCookies.js
|
|
9
|
+
it('should return a cookie for me', async () => {
|
|
10
|
+
await browser.setCookies([
|
|
11
|
+
{name: 'test', value: '123'},
|
|
12
|
+
{name: 'test2', value: '456'}
|
|
13
|
+
])
|
|
14
|
+
const testCookie = await browser.getCookies(['test'])
|
|
15
|
+
console.log(testCookie); // outputs: [{ name: 'test', value: '123' }]
|
|
16
|
+
|
|
17
|
+
const allCookies = await browser.getCookies()
|
|
18
|
+
console.log(allCookies);
|
|
19
|
+
// outputs:
|
|
20
|
+
// [
|
|
21
|
+
// { name: 'test', value: '123' },
|
|
22
|
+
// { name: 'test2', value: '456' }
|
|
23
|
+
// ]
|
|
24
|
+
})
|
|
25
|
+
* </example>
|
|
26
|
+
*
|
|
27
|
+
* @alias browser.getCookies
|
|
28
|
+
* @param {String[]=|String=} names names of requested cookies (if omitted, all cookies will be returned)
|
|
29
|
+
* @return {WebDriver.Cookie[]} requested cookies if existing
|
|
30
|
+
* @uses webdriver/getAllCookies
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export default function getCookies(this: WebdriverIO.Browser, names?: string | string[]): Promise<import("@wdio/protocols").Cookie[]>;
|
|
34
|
+
//# sourceMappingURL=getCookies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getCookies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAA8B,UAAU,CACpC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,+CAc5B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Retrieve a [cookie](https://w3c.github.io/webdriver/webdriver-spec.html#cookies)
|
|
6
|
+
* visible to the current page. You can query a specific cookie by providing the cookie name or
|
|
7
|
+
* retrieve all.
|
|
8
|
+
*
|
|
9
|
+
* <example>
|
|
10
|
+
:getCookies.js
|
|
11
|
+
it('should return a cookie for me', async () => {
|
|
12
|
+
await browser.setCookies([
|
|
13
|
+
{name: 'test', value: '123'},
|
|
14
|
+
{name: 'test2', value: '456'}
|
|
15
|
+
])
|
|
16
|
+
const testCookie = await browser.getCookies(['test'])
|
|
17
|
+
console.log(testCookie); // outputs: [{ name: 'test', value: '123' }]
|
|
18
|
+
|
|
19
|
+
const allCookies = await browser.getCookies()
|
|
20
|
+
console.log(allCookies);
|
|
21
|
+
// outputs:
|
|
22
|
+
// [
|
|
23
|
+
// { name: 'test', value: '123' },
|
|
24
|
+
// { name: 'test2', value: '456' }
|
|
25
|
+
// ]
|
|
26
|
+
})
|
|
27
|
+
* </example>
|
|
28
|
+
*
|
|
29
|
+
* @alias browser.getCookies
|
|
30
|
+
* @param {String[]=|String=} names names of requested cookies (if omitted, all cookies will be returned)
|
|
31
|
+
* @return {WebDriver.Cookie[]} requested cookies if existing
|
|
32
|
+
* @uses webdriver/getAllCookies
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
async function getCookies(names) {
|
|
36
|
+
if (names === undefined) {
|
|
37
|
+
return this.getAllCookies();
|
|
38
|
+
}
|
|
39
|
+
const namesList = Array.isArray(names) ? names : [names];
|
|
40
|
+
if (namesList.every(obj => typeof obj !== 'string')) {
|
|
41
|
+
throw new Error('Invalid input (see https://webdriver.io/docs/api/browser/getCookies for documentation)');
|
|
42
|
+
}
|
|
43
|
+
const allCookies = await this.getAllCookies();
|
|
44
|
+
return allCookies.filter(cookie => namesList.includes(cookie.name));
|
|
45
|
+
}
|
|
46
|
+
exports.default = getCookies;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Browser as PuppeteerBrowser } from 'puppeteer-core/lib/cjs/puppeteer/common/Browser';
|
|
2
|
+
/**
|
|
3
|
+
* Get the [Puppeteer Browser instance](https://pptr.dev/#?product=Puppeteer&version=v5.1.0&show=api-class-browser)
|
|
4
|
+
* to run commands with Puppeteer. Note that all Puppeteer commands are
|
|
5
|
+
* asynchronous by default so in order to interchange between sync and async
|
|
6
|
+
* execution make sure to wrap your Puppeteer calls within a `browser.call`
|
|
7
|
+
* commands as shown in the example.
|
|
8
|
+
*
|
|
9
|
+
* :::info
|
|
10
|
+
*
|
|
11
|
+
* Note that using Puppeteer requires support for Chrome DevTools protocol and e.g.
|
|
12
|
+
* can not be used when running automated tests in the cloud. Find out more in the
|
|
13
|
+
* [Automation Protocols](/docs/automationProtocols) section.
|
|
14
|
+
*
|
|
15
|
+
* :::
|
|
16
|
+
*
|
|
17
|
+
* <example>
|
|
18
|
+
:getPuppeteer.test.js
|
|
19
|
+
it('should allow me to use Puppeteer', async () => {
|
|
20
|
+
// WebDriver command
|
|
21
|
+
await browser.url('https://webdriver.io')
|
|
22
|
+
|
|
23
|
+
const puppeteerBrowser = await browser.getPuppeteer()
|
|
24
|
+
// switch to Puppeteer
|
|
25
|
+
const metrics = await browser.call(async () => {
|
|
26
|
+
const pages = await puppeteerBrowser.pages()
|
|
27
|
+
pages[0].setGeolocation({ latitude: 59.95, longitude: 30.31667 })
|
|
28
|
+
return pages[0].metrics()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
console.log(metrics.LayoutCount) // returns LayoutCount value
|
|
32
|
+
})
|
|
33
|
+
* </example>
|
|
34
|
+
*
|
|
35
|
+
* @return {PuppeteerBrowser} initiated puppeteer instance connected to the browser
|
|
36
|
+
*/
|
|
37
|
+
export default function getPuppeteer(this: WebdriverIO.Browser): Promise<PuppeteerBrowser>;
|
|
38
|
+
//# sourceMappingURL=getPuppeteer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iDAAiD,CAAA;AAM7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAA8B,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,6BAiFpE"}
|