webdriverio 7.16.16 → 7.17.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/package.json +7 -7
- package/build/commands/browser/$$.d.ts +0 -50
- package/build/commands/browser/$$.d.ts.map +0 -1
- package/build/commands/browser/$$.js +0 -57
- package/build/commands/browser/$.d.ts +0 -77
- package/build/commands/browser/$.d.ts.map +0 -1
- package/build/commands/browser/$.js +0 -91
- package/build/commands/browser/addCommand.d.ts +0 -37
- package/build/commands/browser/addCommand.d.ts.map +0 -1
- package/build/commands/browser/addCommand.js +0 -37
- package/build/commands/browser/call.d.ts +0 -42
- package/build/commands/browser/call.d.ts.map +0 -1
- package/build/commands/browser/call.js +0 -49
- package/build/commands/browser/custom$$.d.ts +0 -26
- package/build/commands/browser/custom$$.d.ts.map +0 -1
- package/build/commands/browser/custom$$.js +0 -47
- package/build/commands/browser/custom$.d.ts +0 -25
- package/build/commands/browser/custom$.d.ts.map +0 -1
- package/build/commands/browser/custom$.js +0 -47
- package/build/commands/browser/debug.d.ts +0 -32
- package/build/commands/browser/debug.d.ts.map +0 -1
- package/build/commands/browser/debug.js +0 -108
- package/build/commands/browser/deleteCookies.d.ts +0 -45
- package/build/commands/browser/deleteCookies.d.ts.map +0 -1
- package/build/commands/browser/deleteCookies.js +0 -56
- package/build/commands/browser/execute.d.ts +0 -37
- package/build/commands/browser/execute.d.ts.map +0 -1
- package/build/commands/browser/execute.js +0 -55
- package/build/commands/browser/executeAsync.d.ts +0 -45
- package/build/commands/browser/executeAsync.d.ts.map +0 -1
- package/build/commands/browser/executeAsync.js +0 -63
- package/build/commands/browser/getCookies.d.ts +0 -34
- package/build/commands/browser/getCookies.d.ts.map +0 -1
- package/build/commands/browser/getCookies.js +0 -46
- package/build/commands/browser/getPuppeteer.d.ts +0 -38
- package/build/commands/browser/getPuppeteer.d.ts.map +0 -1
- package/build/commands/browser/getPuppeteer.js +0 -119
- package/build/commands/browser/getWindowSize.d.ts +0 -25
- package/build/commands/browser/getWindowSize.d.ts.map +0 -1
- package/build/commands/browser/getWindowSize.js +0 -30
- package/build/commands/browser/keys.d.ts +0 -28
- package/build/commands/browser/keys.d.ts.map +0 -1
- package/build/commands/browser/keys.js +0 -64
- package/build/commands/browser/mock.d.ts +0 -111
- package/build/commands/browser/mock.d.ts.map +0 -1
- package/build/commands/browser/mock.js +0 -164
- package/build/commands/browser/mockClearAll.d.ts +0 -28
- package/build/commands/browser/mockClearAll.d.ts.map +0 -1
- package/build/commands/browser/mockClearAll.js +0 -43
- package/build/commands/browser/mockRestoreAll.d.ts +0 -26
- package/build/commands/browser/mockRestoreAll.d.ts.map +0 -1
- package/build/commands/browser/mockRestoreAll.js +0 -41
- package/build/commands/browser/newWindow.d.ts +0 -41
- package/build/commands/browser/newWindow.d.ts.map +0 -1
- package/build/commands/browser/newWindow.js +0 -83
- package/build/commands/browser/overwriteCommand.d.ts +0 -32
- package/build/commands/browser/overwriteCommand.d.ts.map +0 -1
- package/build/commands/browser/overwriteCommand.js +0 -32
- package/build/commands/browser/pause.d.ts +0 -23
- package/build/commands/browser/pause.d.ts.map +0 -1
- package/build/commands/browser/pause.js +0 -27
- package/build/commands/browser/react$$.d.ts +0 -36
- package/build/commands/browser/react$$.d.ts.map +0 -1
- package/build/commands/browser/react$$.js +0 -51
- package/build/commands/browser/react$.d.ts +0 -46
- package/build/commands/browser/react$.d.ts.map +0 -1
- package/build/commands/browser/react$.js +0 -59
- package/build/commands/browser/reloadSession.d.ts +0 -23
- package/build/commands/browser/reloadSession.d.ts.map +0 -1
- package/build/commands/browser/reloadSession.js +0 -58
- package/build/commands/browser/savePDF.d.ts +0 -46
- package/build/commands/browser/savePDF.d.ts.map +0 -1
- package/build/commands/browser/savePDF.js +0 -51
- package/build/commands/browser/saveRecordingScreen.d.ts +0 -28
- package/build/commands/browser/saveRecordingScreen.d.ts.map +0 -1
- package/build/commands/browser/saveRecordingScreen.js +0 -47
- package/build/commands/browser/saveScreenshot.d.ts +0 -22
- package/build/commands/browser/saveScreenshot.d.ts.map +0 -1
- package/build/commands/browser/saveScreenshot.js +0 -41
- package/build/commands/browser/setCookies.d.ts +0 -57
- package/build/commands/browser/setCookies.d.ts.map +0 -1
- package/build/commands/browser/setCookies.js +0 -66
- package/build/commands/browser/setTimeout.d.ts +0 -31
- package/build/commands/browser/setTimeout.d.ts.map +0 -1
- package/build/commands/browser/setTimeout.js +0 -61
- package/build/commands/browser/setWindowSize.d.ts +0 -20
- package/build/commands/browser/setWindowSize.d.ts.map +0 -1
- package/build/commands/browser/setWindowSize.js +0 -43
- package/build/commands/browser/switchWindow.d.ts +0 -30
- package/build/commands/browser/switchWindow.d.ts.map +0 -1
- package/build/commands/browser/switchWindow.js +0 -73
- package/build/commands/browser/throttle.d.ts +0 -3
- package/build/commands/browser/throttle.d.ts.map +0 -1
- package/build/commands/browser/throttle.js +0 -144
- package/build/commands/browser/touchAction.d.ts +0 -61
- package/build/commands/browser/touchAction.d.ts.map +0 -1
- package/build/commands/browser/touchAction.js +0 -65
- package/build/commands/browser/uploadFile.d.ts +0 -32
- package/build/commands/browser/uploadFile.d.ts.map +0 -1
- package/build/commands/browser/uploadFile.js +0 -63
- package/build/commands/browser/url.d.ts +0 -38
- package/build/commands/browser/url.d.ts.map +0 -1
- package/build/commands/browser/url.js +0 -49
- package/build/commands/browser/waitUntil.d.ts +0 -44
- package/build/commands/browser/waitUntil.d.ts.map +0 -1
- package/build/commands/browser/waitUntil.js +0 -73
- package/build/commands/browser.d.ts +0 -70
- package/build/commands/browser.d.ts.map +0 -1
- package/build/commands/browser.js +0 -44
- package/build/commands/constant.d.ts +0 -19
- package/build/commands/constant.d.ts.map +0 -1
- package/build/commands/constant.js +0 -91
- package/build/commands/element/$$.d.ts +0 -46
- package/build/commands/element/$$.d.ts.map +0 -1
- package/build/commands/element/$$.js +0 -50
- package/build/commands/element/$.d.ts +0 -72
- package/build/commands/element/$.d.ts.map +0 -1
- package/build/commands/element/$.js +0 -76
- package/build/commands/element/addValue.d.ts +0 -33
- package/build/commands/element/addValue.d.ts.map +0 -1
- package/build/commands/element/addValue.js +0 -48
- package/build/commands/element/clearValue.d.ts +0 -28
- package/build/commands/element/clearValue.d.ts.map +0 -1
- package/build/commands/element/clearValue.js +0 -32
- package/build/commands/element/click.d.ts +0 -73
- package/build/commands/element/click.d.ts.map +0 -1
- package/build/commands/element/click.js +0 -134
- package/build/commands/element/custom$$.d.ts +0 -28
- package/build/commands/element/custom$$.d.ts.map +0 -1
- package/build/commands/element/custom$$.js +0 -57
- package/build/commands/element/custom$.d.ts +0 -27
- package/build/commands/element/custom$.d.ts.map +0 -1
- package/build/commands/element/custom$.js +0 -57
- package/build/commands/element/doubleClick.d.ts +0 -25
- package/build/commands/element/doubleClick.d.ts.map +0 -1
- package/build/commands/element/doubleClick.js +0 -51
- package/build/commands/element/dragAndDrop.d.ts +0 -41
- package/build/commands/element/dragAndDrop.d.ts.map +0 -1
- package/build/commands/element/dragAndDrop.js +0 -98
- package/build/commands/element/getAttribute.d.ts +0 -28
- package/build/commands/element/getAttribute.d.ts.map +0 -1
- package/build/commands/element/getAttribute.js +0 -32
- package/build/commands/element/getCSSProperty.d.ts +0 -71
- package/build/commands/element/getCSSProperty.d.ts.map +0 -1
- package/build/commands/element/getCSSProperty.js +0 -108
- package/build/commands/element/getComputedLabel.d.ts +0 -20
- package/build/commands/element/getComputedLabel.d.ts.map +0 -1
- package/build/commands/element/getComputedLabel.js +0 -24
- package/build/commands/element/getComputedRole.d.ts +0 -20
- package/build/commands/element/getComputedRole.d.ts.map +0 -1
- package/build/commands/element/getComputedRole.js +0 -24
- package/build/commands/element/getHTML.d.ts +0 -32
- package/build/commands/element/getHTML.d.ts.map +0 -1
- package/build/commands/element/getHTML.js +0 -46
- package/build/commands/element/getLocation.d.ts +0 -6
- package/build/commands/element/getLocation.d.ts.map +0 -1
- package/build/commands/element/getLocation.js +0 -46
- package/build/commands/element/getProperty.d.ts +0 -53
- package/build/commands/element/getProperty.d.ts.map +0 -1
- package/build/commands/element/getProperty.js +0 -31
- package/build/commands/element/getSize.d.ts +0 -6
- package/build/commands/element/getSize.d.ts.map +0 -1
- package/build/commands/element/getSize.js +0 -47
- package/build/commands/element/getTagName.d.ts +0 -25
- package/build/commands/element/getTagName.d.ts.map +0 -1
- package/build/commands/element/getTagName.js +0 -29
- package/build/commands/element/getText.d.ts +0 -42
- package/build/commands/element/getText.d.ts.map +0 -1
- package/build/commands/element/getText.js +0 -46
- package/build/commands/element/getValue.d.ts +0 -25
- package/build/commands/element/getValue.d.ts.map +0 -1
- package/build/commands/element/getValue.js +0 -33
- package/build/commands/element/isClickable.d.ts +0 -40
- package/build/commands/element/isClickable.d.ts.map +0 -1
- package/build/commands/element/isClickable.js +0 -57
- package/build/commands/element/isDisplayed.d.ts +0 -50
- package/build/commands/element/isDisplayed.d.ts.map +0 -1
- package/build/commands/element/isDisplayed.js +0 -85
- package/build/commands/element/isDisplayedInViewport.d.ts +0 -38
- package/build/commands/element/isDisplayedInViewport.d.ts.map +0 -1
- package/build/commands/element/isDisplayedInViewport.js +0 -55
- package/build/commands/element/isEnabled.d.ts +0 -34
- package/build/commands/element/isEnabled.d.ts.map +0 -1
- package/build/commands/element/isEnabled.js +0 -38
- package/build/commands/element/isEqual.d.ts +0 -24
- package/build/commands/element/isEqual.d.ts.map +0 -1
- package/build/commands/element/isEqual.js +0 -52
- package/build/commands/element/isExisting.d.ts +0 -49
- package/build/commands/element/isExisting.d.ts.map +0 -1
- package/build/commands/element/isExisting.js +0 -65
- package/build/commands/element/isFocused.d.ts +0 -28
- package/build/commands/element/isFocused.d.ts.map +0 -1
- package/build/commands/element/isFocused.js +0 -42
- package/build/commands/element/isSelected.d.ts +0 -31
- package/build/commands/element/isSelected.d.ts.map +0 -1
- package/build/commands/element/isSelected.js +0 -35
- package/build/commands/element/moveTo.d.ts +0 -21
- package/build/commands/element/moveTo.d.ts.map +0 -1
- package/build/commands/element/moveTo.js +0 -39
- package/build/commands/element/nextElement.d.ts +0 -25
- package/build/commands/element/nextElement.d.ts.map +0 -1
- package/build/commands/element/nextElement.js +0 -31
- package/build/commands/element/parentElement.d.ts +0 -25
- package/build/commands/element/parentElement.d.ts.map +0 -1
- package/build/commands/element/parentElement.js +0 -31
- package/build/commands/element/previousElement.d.ts +0 -25
- package/build/commands/element/previousElement.d.ts.map +0 -1
- package/build/commands/element/previousElement.js +0 -31
- package/build/commands/element/react$$.d.ts +0 -36
- package/build/commands/element/react$$.d.ts.map +0 -1
- package/build/commands/element/react$$.js +0 -51
- package/build/commands/element/react$.d.ts +0 -46
- package/build/commands/element/react$.d.ts.map +0 -1
- package/build/commands/element/react$.js +0 -59
- package/build/commands/element/saveScreenshot.d.ts +0 -21
- package/build/commands/element/saveScreenshot.d.ts.map +0 -1
- package/build/commands/element/saveScreenshot.js +0 -40
- package/build/commands/element/scrollIntoView.d.ts +0 -21
- package/build/commands/element/scrollIntoView.d.ts.map +0 -1
- package/build/commands/element/scrollIntoView.js +0 -31
- package/build/commands/element/selectByAttribute.d.ts +0 -37
- package/build/commands/element/selectByAttribute.d.ts.map +0 -1
- package/build/commands/element/selectByAttribute.js +0 -59
- package/build/commands/element/selectByIndex.d.ts +0 -31
- package/build/commands/element/selectByIndex.d.ts.map +0 -1
- package/build/commands/element/selectByIndex.js +0 -55
- package/build/commands/element/selectByVisibleText.d.ts +0 -31
- package/build/commands/element/selectByVisibleText.d.ts.map +0 -1
- package/build/commands/element/selectByVisibleText.js +0 -66
- package/build/commands/element/setValue.d.ts +0 -29
- package/build/commands/element/setValue.d.ts.map +0 -1
- package/build/commands/element/setValue.js +0 -33
- package/build/commands/element/shadow$$.d.ts +0 -22
- package/build/commands/element/shadow$$.d.ts.map +0 -1
- package/build/commands/element/shadow$$.js +0 -27
- package/build/commands/element/shadow$.d.ts +0 -22
- package/build/commands/element/shadow$.d.ts.map +0 -1
- package/build/commands/element/shadow$.js +0 -27
- package/build/commands/element/touchAction.d.ts +0 -54
- package/build/commands/element/touchAction.d.ts.map +0 -1
- package/build/commands/element/touchAction.js +0 -58
- package/build/commands/element/waitForClickable.d.ts +0 -34
- package/build/commands/element/waitForClickable.d.ts.map +0 -1
- package/build/commands/element/waitForClickable.js +0 -37
- package/build/commands/element/waitForDisplayed.d.ts +0 -44
- package/build/commands/element/waitForDisplayed.d.ts.map +0 -1
- package/build/commands/element/waitForDisplayed.js +0 -47
- package/build/commands/element/waitForEnabled.d.ts +0 -46
- package/build/commands/element/waitForEnabled.d.ts.map +0 -1
- package/build/commands/element/waitForEnabled.js +0 -55
- package/build/commands/element/waitForExist.d.ts +0 -46
- package/build/commands/element/waitForExist.d.ts.map +0 -1
- package/build/commands/element/waitForExist.js +0 -49
- package/build/commands/element/waitUntil.d.ts +0 -49
- package/build/commands/element/waitUntil.d.ts.map +0 -1
- package/build/commands/element/waitUntil.js +0 -53
- package/build/commands/element.d.ts +0 -100
- package/build/commands/element.d.ts.map +0 -1
- package/build/commands/element.js +0 -63
- package/build/commands/mock/abort.d.ts +0 -19
- package/build/commands/mock/abort.d.ts.map +0 -1
- package/build/commands/mock/abort.js +0 -20
- package/build/commands/mock/abortOnce.d.ts +0 -27
- package/build/commands/mock/abortOnce.d.ts.map +0 -1
- package/build/commands/mock/abortOnce.js +0 -28
- package/build/commands/mock/clear.d.ts +0 -18
- package/build/commands/mock/clear.d.ts.map +0 -1
- package/build/commands/mock/clear.js +0 -19
- package/build/commands/mock/respond.d.ts +0 -54
- package/build/commands/mock/respond.d.ts.map +0 -1
- package/build/commands/mock/respond.js +0 -55
- package/build/commands/mock/respondOnce.d.ts +0 -55
- package/build/commands/mock/respondOnce.d.ts.map +0 -1
- package/build/commands/mock/respondOnce.js +0 -56
- package/build/commands/mock/restore.d.ts +0 -18
- package/build/commands/mock/restore.d.ts.map +0 -1
- package/build/commands/mock/restore.js +0 -19
- package/build/constants.d.ts +0 -14
- package/build/constants.d.ts.map +0 -1
- package/build/constants.js +0 -286
- package/build/index.d.ts +0 -45
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -171
- package/build/middlewares.d.ts +0 -12
- package/build/middlewares.d.ts.map +0 -1
- package/build/middlewares.js +0 -65
- package/build/multiremote.d.ts +0 -71
- package/build/multiremote.d.ts.map +0 -1
- package/build/multiremote.js +0 -160
- package/build/protocol-stub.d.ts +0 -16
- package/build/protocol-stub.d.ts.map +0 -1
- package/build/protocol-stub.js +0 -77
- package/build/scripts/getHTML.d.ts +0 -9
- package/build/scripts/getHTML.d.ts.map +0 -1
- package/build/scripts/getHTML.js +0 -13
- package/build/scripts/getProperty.d.ts +0 -43
- package/build/scripts/getProperty.d.ts.map +0 -1
- package/build/scripts/getProperty.js +0 -12
- package/build/scripts/isElementClickable.d.ts +0 -7
- package/build/scripts/isElementClickable.d.ts.map +0 -1
- package/build/scripts/isElementClickable.js +0 -121
- package/build/scripts/isElementDisplayed.d.ts +0 -7
- package/build/scripts/isElementDisplayed.d.ts.map +0 -1
- package/build/scripts/isElementDisplayed.js +0 -216
- package/build/scripts/isElementInViewport.d.ts +0 -10
- package/build/scripts/isElementInViewport.d.ts.map +0 -1
- package/build/scripts/isElementInViewport.js +0 -22
- package/build/scripts/isFocused.d.ts +0 -7
- package/build/scripts/isFocused.d.ts.map +0 -1
- package/build/scripts/isFocused.js +0 -11
- package/build/scripts/newWindow.d.ts +0 -10
- package/build/scripts/newWindow.d.ts.map +0 -1
- package/build/scripts/newWindow.js +0 -14
- package/build/scripts/resq.d.ts +0 -6
- package/build/scripts/resq.d.ts.map +0 -1
- package/build/scripts/resq.js +0 -58
- package/build/scripts/shadowFnFactory.d.ts +0 -2
- package/build/scripts/shadowFnFactory.d.ts.map +0 -1
- package/build/scripts/shadowFnFactory.js +0 -17
- package/build/types.d.ts +0 -402
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -2
- package/build/utils/SevereServiceError.d.ts +0 -7
- package/build/utils/SevereServiceError.d.ts.map +0 -1
- package/build/utils/SevereServiceError.js +0 -12
- package/build/utils/Timer.d.ts +0 -33
- package/build/utils/Timer.d.ts.map +0 -1
- package/build/utils/Timer.js +0 -126
- package/build/utils/detectBackend.d.ts +0 -23
- package/build/utils/detectBackend.d.ts.map +0 -1
- package/build/utils/detectBackend.js +0 -119
- package/build/utils/findStrategy.d.ts +0 -10
- package/build/utils/findStrategy.d.ts.map +0 -1
- package/build/utils/findStrategy.js +0 -267
- package/build/utils/getElementObject.d.ts +0 -17
- package/build/utils/getElementObject.d.ts.map +0 -1
- package/build/utils/getElementObject.js +0 -107
- package/build/utils/implicitWait.d.ts +0 -7
- package/build/utils/implicitWait.d.ts.map +0 -1
- package/build/utils/implicitWait.js +0 -39
- package/build/utils/index.d.ts +0 -102
- package/build/utils/index.d.ts.map +0 -1
- package/build/utils/index.js +0 -543
- package/build/utils/interception/devtools.d.ts +0 -61
- package/build/utils/interception/devtools.d.ts.map +0 -1
- package/build/utils/interception/devtools.js +0 -247
- package/build/utils/interception/index.d.ts +0 -26
- package/build/utils/interception/index.d.ts.map +0 -1
- package/build/utils/interception/index.js +0 -49
- package/build/utils/interception/types.d.ts +0 -94
- package/build/utils/interception/types.d.ts.map +0 -1
- package/build/utils/interception/types.js +0 -2
- package/build/utils/interception/webdriver.d.ts +0 -48
- package/build/utils/interception/webdriver.d.ts.map +0 -1
- package/build/utils/interception/webdriver.js +0 -75
- package/build/utils/refetchElement.d.ts +0 -6
- package/build/utils/refetchElement.d.ts.map +0 -1
- package/build/utils/refetchElement.js +0 -32
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Prints the page of the current browsing context to a PDF file on your OS.
|
|
11
|
-
*
|
|
12
|
-
* <example>
|
|
13
|
-
:savePDF.js
|
|
14
|
-
it('should save a PDF screenshot of the browser view', function () {
|
|
15
|
-
await browser.savePDF('./some/path/screenshot.pdf');
|
|
16
|
-
});
|
|
17
|
-
* </example>
|
|
18
|
-
*
|
|
19
|
-
* @alias browser.savePDF
|
|
20
|
-
* @param {String} filepath path to the generated pdf (`.pdf` suffix is required) relative to the execution directory
|
|
21
|
-
* @param {PDFPrintOptions=} options Print PDF Options
|
|
22
|
-
* @param {String=} options.orientation Orientation of PDF page
|
|
23
|
-
* @param {number=} options.scale Scale of PDF page
|
|
24
|
-
* @param {boolean=} options.background Include background of PDF page
|
|
25
|
-
* @param {number=} options.width Width of PDF page
|
|
26
|
-
* @param {number=} options.height Height of PDF page
|
|
27
|
-
* @param {number=} options.top Top padding of PDF page
|
|
28
|
-
* @param {number=} options.bottom Bottom padding of PDF page
|
|
29
|
-
* @param {number=} options.left Left padding of PDF page
|
|
30
|
-
* @param {number=} options.right Right padding of PDF page
|
|
31
|
-
* @param {boolean=} options.shrinkToFit Shrink page to fit page
|
|
32
|
-
* @param {object[]=} options.pageRanges Range of pages to include in PDF
|
|
33
|
-
* @return {Buffer} screenshot buffer
|
|
34
|
-
* @type utility
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
async function savePDF(filepath, options) {
|
|
38
|
-
/**
|
|
39
|
-
* type check
|
|
40
|
-
*/
|
|
41
|
-
if (typeof filepath != 'string' || !filepath.endsWith('.pdf')) {
|
|
42
|
-
throw new Error('savePDF expects a filepath of type string and ".pdf" file ending');
|
|
43
|
-
}
|
|
44
|
-
const absoluteFilepath = (0, utils_1.getAbsoluteFilepath)(filepath);
|
|
45
|
-
(0, utils_1.assertDirectoryExists)(absoluteFilepath);
|
|
46
|
-
const pdf = await this.printPage(options === null || options === void 0 ? void 0 : options.orientation, options === null || options === void 0 ? void 0 : options.scale, options === null || options === void 0 ? void 0 : options.background, options === null || options === void 0 ? void 0 : options.width, options === null || options === void 0 ? void 0 : options.height, options === null || options === void 0 ? void 0 : options.top, options === null || options === void 0 ? void 0 : options.bottom, options === null || options === void 0 ? void 0 : options.left, options === null || options === void 0 ? void 0 : options.right, options === null || options === void 0 ? void 0 : options.shrinkToFit, options === null || options === void 0 ? void 0 : options.pageRanges);
|
|
47
|
-
const page = Buffer.from(pdf, 'base64');
|
|
48
|
-
fs_1.default.writeFileSync(absoluteFilepath, page);
|
|
49
|
-
return page;
|
|
50
|
-
}
|
|
51
|
-
exports.default = savePDF;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* Save a video started by [`startRecordingScreen`](/docs/api/appium#startrecordingscreen) command to file.
|
|
5
|
-
*
|
|
6
|
-
* :::info
|
|
7
|
-
*
|
|
8
|
-
* This command is only supported for mobile sessions running on [Appium](http://appium.io/docs/en/commands/device/recording-screen/start-recording-screen/).
|
|
9
|
-
*
|
|
10
|
-
* :::
|
|
11
|
-
*
|
|
12
|
-
* <example>
|
|
13
|
-
:saveRecordingScreen.js
|
|
14
|
-
it('should save a video', async () => {
|
|
15
|
-
await browser.startRecordingScreen();
|
|
16
|
-
await $('~BUTTON').click();
|
|
17
|
-
await browser.saveRecordingScreen('./some/path/video.mp4');
|
|
18
|
-
});
|
|
19
|
-
* </example>
|
|
20
|
-
*
|
|
21
|
-
* @alias browser.saveRecordingScreen
|
|
22
|
-
* @param {String} filepath full or relative to the execution directory path to the generated video
|
|
23
|
-
* @return {Buffer} video buffer
|
|
24
|
-
* @type utility
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
export default function saveRecordingScreen(this: WebdriverIO.Browser, filepath: string): Promise<Buffer>;
|
|
28
|
-
//# sourceMappingURL=saveRecordingScreen.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"saveRecordingScreen.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveRecordingScreen.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAA8B,mBAAmB,CAC7C,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAiBnB"}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Save a video started by [`startRecordingScreen`](/docs/api/appium#startrecordingscreen) command to file.
|
|
11
|
-
*
|
|
12
|
-
* :::info
|
|
13
|
-
*
|
|
14
|
-
* This command is only supported for mobile sessions running on [Appium](http://appium.io/docs/en/commands/device/recording-screen/start-recording-screen/).
|
|
15
|
-
*
|
|
16
|
-
* :::
|
|
17
|
-
*
|
|
18
|
-
* <example>
|
|
19
|
-
:saveRecordingScreen.js
|
|
20
|
-
it('should save a video', async () => {
|
|
21
|
-
await browser.startRecordingScreen();
|
|
22
|
-
await $('~BUTTON').click();
|
|
23
|
-
await browser.saveRecordingScreen('./some/path/video.mp4');
|
|
24
|
-
});
|
|
25
|
-
* </example>
|
|
26
|
-
*
|
|
27
|
-
* @alias browser.saveRecordingScreen
|
|
28
|
-
* @param {String} filepath full or relative to the execution directory path to the generated video
|
|
29
|
-
* @return {Buffer} video buffer
|
|
30
|
-
* @type utility
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
async function saveRecordingScreen(filepath) {
|
|
34
|
-
/**
|
|
35
|
-
* type check
|
|
36
|
-
*/
|
|
37
|
-
if (typeof filepath !== 'string') {
|
|
38
|
-
throw new Error('saveRecordingScreen expects a filepath');
|
|
39
|
-
}
|
|
40
|
-
const absoluteFilepath = (0, utils_1.getAbsoluteFilepath)(filepath);
|
|
41
|
-
(0, utils_1.assertDirectoryExists)(absoluteFilepath);
|
|
42
|
-
const videoBuffer = await this.stopRecordingScreen();
|
|
43
|
-
const video = Buffer.from(videoBuffer, 'base64');
|
|
44
|
-
fs_1.default.writeFileSync(absoluteFilepath, video);
|
|
45
|
-
return video;
|
|
46
|
-
}
|
|
47
|
-
exports.default = saveRecordingScreen;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* Save a screenshot of the current browsing context to a PNG file on your OS. Be aware that
|
|
5
|
-
* some browser drivers take screenshots of the whole document (e.g. Geckodriver with Firefox)
|
|
6
|
-
* and others only of the current viewport (e.g. Chromedriver with Chrome).
|
|
7
|
-
*
|
|
8
|
-
* <example>
|
|
9
|
-
:saveScreenshot.js
|
|
10
|
-
it('should save a screenshot of the browser view', async () => {
|
|
11
|
-
await browser.saveScreenshot('./some/path/screenshot.png');
|
|
12
|
-
});
|
|
13
|
-
* </example>
|
|
14
|
-
*
|
|
15
|
-
* @alias browser.saveScreenshot
|
|
16
|
-
* @param {String} filepath path to the generated image (`.png` suffix is required) relative to the execution directory
|
|
17
|
-
* @return {Buffer} screenshot buffer
|
|
18
|
-
* @type utility
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
export default function saveScreenshot(this: WebdriverIO.Browser, filepath: string): Promise<Buffer>;
|
|
22
|
-
//# sourceMappingURL=saveScreenshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAA8B,cAAc,CACxC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAiBnB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Save a screenshot of the current browsing context to a PNG file on your OS. Be aware that
|
|
11
|
-
* some browser drivers take screenshots of the whole document (e.g. Geckodriver with Firefox)
|
|
12
|
-
* and others only of the current viewport (e.g. Chromedriver with Chrome).
|
|
13
|
-
*
|
|
14
|
-
* <example>
|
|
15
|
-
:saveScreenshot.js
|
|
16
|
-
it('should save a screenshot of the browser view', async () => {
|
|
17
|
-
await browser.saveScreenshot('./some/path/screenshot.png');
|
|
18
|
-
});
|
|
19
|
-
* </example>
|
|
20
|
-
*
|
|
21
|
-
* @alias browser.saveScreenshot
|
|
22
|
-
* @param {String} filepath path to the generated image (`.png` suffix is required) relative to the execution directory
|
|
23
|
-
* @return {Buffer} screenshot buffer
|
|
24
|
-
* @type utility
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
async function saveScreenshot(filepath) {
|
|
28
|
-
/**
|
|
29
|
-
* type check
|
|
30
|
-
*/
|
|
31
|
-
if (typeof filepath !== 'string' || !filepath.endsWith('.png')) {
|
|
32
|
-
throw new Error('saveScreenshot expects a filepath of type string and ".png" file ending');
|
|
33
|
-
}
|
|
34
|
-
const absoluteFilepath = (0, utils_1.getAbsoluteFilepath)(filepath);
|
|
35
|
-
(0, utils_1.assertDirectoryExists)(absoluteFilepath);
|
|
36
|
-
const screenBuffer = await this.takeScreenshot();
|
|
37
|
-
const screenshot = Buffer.from(screenBuffer, 'base64');
|
|
38
|
-
fs_1.default.writeFileSync(absoluteFilepath, screenshot);
|
|
39
|
-
return screenshot;
|
|
40
|
-
}
|
|
41
|
-
exports.default = saveScreenshot;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Cookie } from '@wdio/protocols';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* Sets one or more [cookies](https://w3c.github.io/webdriver/#cookies) for the current page. Make sure you are
|
|
5
|
-
* on the page that should receive the cookie. You can't set a cookie for an arbitrary page without
|
|
6
|
-
* being on that page.
|
|
7
|
-
*
|
|
8
|
-
* <example>
|
|
9
|
-
:setCookies.js
|
|
10
|
-
it('should set a cookie for the page', async () => {
|
|
11
|
-
await browser.url('/')
|
|
12
|
-
|
|
13
|
-
// set a single cookie
|
|
14
|
-
await browser.setCookies({
|
|
15
|
-
name: 'test1',
|
|
16
|
-
value: 'one'
|
|
17
|
-
// The below options are optional
|
|
18
|
-
// path: '/foo', // The cookie path. Defaults to "/"
|
|
19
|
-
// domain: '.example.com', // The domain the cookie is visible to. Defaults to the current browsing context’s active document’s URL domain
|
|
20
|
-
// secure: true, // Whether the cookie is a secure cookie. Defaults to false
|
|
21
|
-
// httpOnly: true, // Whether the cookie is an HTTP only cookie. Defaults to false
|
|
22
|
-
// expiry: 1551393875 // When the cookie expires, specified in seconds since Unix Epoch
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
// set multiple cookies
|
|
26
|
-
await browser.setCookies([
|
|
27
|
-
{name: 'test2', value: 'two'},
|
|
28
|
-
{name: 'test3', value: 'three'}
|
|
29
|
-
])
|
|
30
|
-
|
|
31
|
-
const cookies = await browser.getCookies()
|
|
32
|
-
console.log(cookies);
|
|
33
|
-
// outputs:
|
|
34
|
-
// [
|
|
35
|
-
// {name: 'test1', value: 'one', domain: 'www.example.com'},
|
|
36
|
-
// {name: 'test2', value: 'two', domain: 'www.example.com'},
|
|
37
|
-
// {name: 'test3', value: 'three', domain: 'www.example.com'}
|
|
38
|
-
// ]
|
|
39
|
-
});
|
|
40
|
-
* </example>
|
|
41
|
-
*
|
|
42
|
-
* @alias browser.setCookies
|
|
43
|
-
* @param {Array<WebDriver.Cookie>|WebDriver.Cookie} cookie cookie object or object array.
|
|
44
|
-
* @param {String=} cookie.name The name of the cookie.
|
|
45
|
-
* @param {String=} cookie.value The cookie value.
|
|
46
|
-
* @param {String=} cookie.path The cookie path. Defaults to "/" if omitted when adding a cookie.
|
|
47
|
-
* @param {String=} cookie.domain The domain the cookie is visible to. Defaults to the current browsing context’s active document’s URL domain if omitted when adding a cookie.
|
|
48
|
-
* @param {Boolean=} cookie.secure Whether the cookie is a secure cookie. Defaults to false if omitted when adding a cookie.
|
|
49
|
-
* @param {Boolean=} cookie.httpOnly Whether the cookie is an HTTP only cookie. Defaults to false if omitted when adding a cookie.
|
|
50
|
-
* @param {Number=} cookie.expiry When the cookie expires, specified in seconds since Unix Epoch. Must not be set if omitted when adding a cookie.
|
|
51
|
-
* @param {String=} cookie.sameSite Whether the cookie applies to a SameSite policy. Defaults to None if omitted when adding a cookie. Can be set to either "Lax" or "Strict".
|
|
52
|
-
* @uses protocol/addCookie
|
|
53
|
-
* @type cookie
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
export default function setCookies(this: WebdriverIO.Browser, cookieObjs: Cookie | Cookie[]): Promise<void>;
|
|
57
|
-
//# sourceMappingURL=setCookies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setCookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAA8B,UAAU,CACpC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,iBAWhC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Sets one or more [cookies](https://w3c.github.io/webdriver/#cookies) for the current page. Make sure you are
|
|
6
|
-
* on the page that should receive the cookie. You can't set a cookie for an arbitrary page without
|
|
7
|
-
* being on that page.
|
|
8
|
-
*
|
|
9
|
-
* <example>
|
|
10
|
-
:setCookies.js
|
|
11
|
-
it('should set a cookie for the page', async () => {
|
|
12
|
-
await browser.url('/')
|
|
13
|
-
|
|
14
|
-
// set a single cookie
|
|
15
|
-
await browser.setCookies({
|
|
16
|
-
name: 'test1',
|
|
17
|
-
value: 'one'
|
|
18
|
-
// The below options are optional
|
|
19
|
-
// path: '/foo', // The cookie path. Defaults to "/"
|
|
20
|
-
// domain: '.example.com', // The domain the cookie is visible to. Defaults to the current browsing context’s active document’s URL domain
|
|
21
|
-
// secure: true, // Whether the cookie is a secure cookie. Defaults to false
|
|
22
|
-
// httpOnly: true, // Whether the cookie is an HTTP only cookie. Defaults to false
|
|
23
|
-
// expiry: 1551393875 // When the cookie expires, specified in seconds since Unix Epoch
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
// set multiple cookies
|
|
27
|
-
await browser.setCookies([
|
|
28
|
-
{name: 'test2', value: 'two'},
|
|
29
|
-
{name: 'test3', value: 'three'}
|
|
30
|
-
])
|
|
31
|
-
|
|
32
|
-
const cookies = await browser.getCookies()
|
|
33
|
-
console.log(cookies);
|
|
34
|
-
// outputs:
|
|
35
|
-
// [
|
|
36
|
-
// {name: 'test1', value: 'one', domain: 'www.example.com'},
|
|
37
|
-
// {name: 'test2', value: 'two', domain: 'www.example.com'},
|
|
38
|
-
// {name: 'test3', value: 'three', domain: 'www.example.com'}
|
|
39
|
-
// ]
|
|
40
|
-
});
|
|
41
|
-
* </example>
|
|
42
|
-
*
|
|
43
|
-
* @alias browser.setCookies
|
|
44
|
-
* @param {Array<WebDriver.Cookie>|WebDriver.Cookie} cookie cookie object or object array.
|
|
45
|
-
* @param {String=} cookie.name The name of the cookie.
|
|
46
|
-
* @param {String=} cookie.value The cookie value.
|
|
47
|
-
* @param {String=} cookie.path The cookie path. Defaults to "/" if omitted when adding a cookie.
|
|
48
|
-
* @param {String=} cookie.domain The domain the cookie is visible to. Defaults to the current browsing context’s active document’s URL domain if omitted when adding a cookie.
|
|
49
|
-
* @param {Boolean=} cookie.secure Whether the cookie is a secure cookie. Defaults to false if omitted when adding a cookie.
|
|
50
|
-
* @param {Boolean=} cookie.httpOnly Whether the cookie is an HTTP only cookie. Defaults to false if omitted when adding a cookie.
|
|
51
|
-
* @param {Number=} cookie.expiry When the cookie expires, specified in seconds since Unix Epoch. Must not be set if omitted when adding a cookie.
|
|
52
|
-
* @param {String=} cookie.sameSite Whether the cookie applies to a SameSite policy. Defaults to None if omitted when adding a cookie. Can be set to either "Lax" or "Strict".
|
|
53
|
-
* @uses protocol/addCookie
|
|
54
|
-
* @type cookie
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
async function setCookies(cookieObjs) {
|
|
58
|
-
const cookieObjsList = !Array.isArray(cookieObjs) ? [cookieObjs] : cookieObjs;
|
|
59
|
-
if (cookieObjsList.some(obj => (typeof obj !== 'object'))) {
|
|
60
|
-
throw new Error('Invalid input (see https://webdriver.io/docs/api/browser/setCookies for documentation)');
|
|
61
|
-
}
|
|
62
|
-
await Promise.all(cookieObjsList
|
|
63
|
-
.map(cookieObj => this.addCookie(cookieObj)));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
exports.default = setCookies;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Timeouts } from '@wdio/protocols';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* Sets the timeouts associated with the current session, timeout durations control such
|
|
5
|
-
* behaviour as timeouts on script injection, document navigation, and element retrieval.
|
|
6
|
-
* For more information and examples, see [timeouts guide](https://webdriver.io/docs/timeouts#selenium-timeouts).
|
|
7
|
-
*
|
|
8
|
-
* <example>
|
|
9
|
-
:setTimeout.js
|
|
10
|
-
it('should change timeout duration for session with long code duration', async () => {
|
|
11
|
-
await browser.setTimeout({
|
|
12
|
-
'pageLoad': 10000,
|
|
13
|
-
'script': 60000
|
|
14
|
-
});
|
|
15
|
-
// Execute code which takes a long time
|
|
16
|
-
await browser.executeAsync((done) => {
|
|
17
|
-
console.log('Wake me up before you go!');
|
|
18
|
-
setTimeout(done, 59000);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
* </example>
|
|
22
|
-
*
|
|
23
|
-
* @param {Timeouts} timeouts Object containing session timeout values
|
|
24
|
-
* @param {Number=} timeouts.implicit Time in milliseconds to retry the element location strategy when finding an element.
|
|
25
|
-
* @param {Number=} timeouts.pageLoad Time in milliseconds to wait for the document to finish loading.
|
|
26
|
-
* @param {Number=} timeouts.script Scripts injected with [`execute`](https://webdriver.io/docs/api/browser/execute) or [`executeAsync`](https://webdriver.io/docs/api/browser/executeAsync) will run until they hit the script timeout duration, which is also given in milliseconds.
|
|
27
|
-
* @see https://w3c.github.io/webdriver/#set-timeouts
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
export default function setTimeout(this: WebdriverIO.Browser, timeouts: Partial<Timeouts>): Promise<void>;
|
|
31
|
-
//# sourceMappingURL=setTimeout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setTimeout.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,wBAA8B,UAAU,CACpC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Sets the timeouts associated with the current session, timeout durations control such
|
|
6
|
-
* behaviour as timeouts on script injection, document navigation, and element retrieval.
|
|
7
|
-
* For more information and examples, see [timeouts guide](https://webdriver.io/docs/timeouts#selenium-timeouts).
|
|
8
|
-
*
|
|
9
|
-
* <example>
|
|
10
|
-
:setTimeout.js
|
|
11
|
-
it('should change timeout duration for session with long code duration', async () => {
|
|
12
|
-
await browser.setTimeout({
|
|
13
|
-
'pageLoad': 10000,
|
|
14
|
-
'script': 60000
|
|
15
|
-
});
|
|
16
|
-
// Execute code which takes a long time
|
|
17
|
-
await browser.executeAsync((done) => {
|
|
18
|
-
console.log('Wake me up before you go!');
|
|
19
|
-
setTimeout(done, 59000);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
* </example>
|
|
23
|
-
*
|
|
24
|
-
* @param {Timeouts} timeouts Object containing session timeout values
|
|
25
|
-
* @param {Number=} timeouts.implicit Time in milliseconds to retry the element location strategy when finding an element.
|
|
26
|
-
* @param {Number=} timeouts.pageLoad Time in milliseconds to wait for the document to finish loading.
|
|
27
|
-
* @param {Number=} timeouts.script Scripts injected with [`execute`](https://webdriver.io/docs/api/browser/execute) or [`executeAsync`](https://webdriver.io/docs/api/browser/executeAsync) will run until they hit the script timeout duration, which is also given in milliseconds.
|
|
28
|
-
* @see https://w3c.github.io/webdriver/#set-timeouts
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
async function setTimeout(timeouts) {
|
|
32
|
-
if (typeof timeouts !== 'object') {
|
|
33
|
-
throw new Error('Parameter for "setTimeout" command needs to be an object');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* If value is not an integer, or it is less than 0 or greater than the maximum safe
|
|
37
|
-
* integer, return error with error code invalid argument.
|
|
38
|
-
*/
|
|
39
|
-
const timeoutValues = Object.values(timeouts);
|
|
40
|
-
if (timeoutValues.length && timeoutValues.every(timeout => typeof timeout !== 'number' || timeout < 0 || timeout > Number.MAX_SAFE_INTEGER)) {
|
|
41
|
-
throw new Error('Specified timeout values are not valid integer (see https://webdriver.io/docs/api/browser/setTimeout for documentation).');
|
|
42
|
-
}
|
|
43
|
-
const implicit = timeouts.implicit;
|
|
44
|
-
// Previously also known as `page load` with JsonWireProtocol
|
|
45
|
-
const pageLoad = timeouts['page load'] || timeouts.pageLoad;
|
|
46
|
-
const script = timeouts.script;
|
|
47
|
-
const setTimeouts = this.setTimeouts.bind(this);
|
|
48
|
-
/**
|
|
49
|
-
* JsonWireProtocol action
|
|
50
|
-
*/
|
|
51
|
-
if (!this.isW3C) {
|
|
52
|
-
await Promise.all([
|
|
53
|
-
isFinite(implicit) && setTimeouts('implicit', implicit),
|
|
54
|
-
isFinite(pageLoad) && setTimeouts('page load', pageLoad),
|
|
55
|
-
isFinite(script) && setTimeouts('script', script),
|
|
56
|
-
].filter(Boolean));
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
return setTimeouts(implicit, pageLoad, script);
|
|
60
|
-
}
|
|
61
|
-
exports.default = setTimeout;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Resizes browser window outer size according to provided width and height.
|
|
4
|
-
*
|
|
5
|
-
* <example>
|
|
6
|
-
* :setWindowSize.js
|
|
7
|
-
it('should re-size browser outer window with 500 width and 600 height', async () => {
|
|
8
|
-
await browser.setWindowSize(500, 600);
|
|
9
|
-
});
|
|
10
|
-
* </example>
|
|
11
|
-
*
|
|
12
|
-
* @alias browser.setWindowSize
|
|
13
|
-
* @param {Number} width browser will be resized to provided width
|
|
14
|
-
* @param {Number} height browser will be resized to provided height
|
|
15
|
-
* @return {Null|Object} Null for *NO*W3C browser and Object{x, y, width, height} for W3C browser
|
|
16
|
-
* @type window
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
export default function setWindowSize(this: WebdriverIO.Browser, width: number, height: number): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=setWindowSize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setWindowSize.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setWindowSize.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAA8B,aAAa,CACvC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,iBAuBjB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
4
|
-
const minWindowSize = 0;
|
|
5
|
-
const maxWindowSize = Number.MAX_SAFE_INTEGER;
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* Resizes browser window outer size according to provided width and height.
|
|
9
|
-
*
|
|
10
|
-
* <example>
|
|
11
|
-
* :setWindowSize.js
|
|
12
|
-
it('should re-size browser outer window with 500 width and 600 height', async () => {
|
|
13
|
-
await browser.setWindowSize(500, 600);
|
|
14
|
-
});
|
|
15
|
-
* </example>
|
|
16
|
-
*
|
|
17
|
-
* @alias browser.setWindowSize
|
|
18
|
-
* @param {Number} width browser will be resized to provided width
|
|
19
|
-
* @param {Number} height browser will be resized to provided height
|
|
20
|
-
* @return {Null|Object} Null for *NO*W3C browser and Object{x, y, width, height} for W3C browser
|
|
21
|
-
* @type window
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
async function setWindowSize(width, height) {
|
|
25
|
-
/**
|
|
26
|
-
* type check
|
|
27
|
-
*/
|
|
28
|
-
if (typeof width !== 'number' || typeof height !== 'number') {
|
|
29
|
-
throw new Error('setWindowSize expects width and height of type number');
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* value check
|
|
33
|
-
*/
|
|
34
|
-
if (width < minWindowSize || width > maxWindowSize || height < minWindowSize || height > maxWindowSize) {
|
|
35
|
-
throw new Error('setWindowSize expects width and height to be a number in the 0 to 2^31 − 1 range');
|
|
36
|
-
}
|
|
37
|
-
const browser = (0, utils_1.getBrowserObject)(this);
|
|
38
|
-
if (!browser.isW3C) {
|
|
39
|
-
return browser._setWindowSize(width, height);
|
|
40
|
-
}
|
|
41
|
-
await browser.setWindowRect(null, null, width, height);
|
|
42
|
-
}
|
|
43
|
-
exports.default = setWindowSize;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Switch focus to a particular tab / window.
|
|
4
|
-
*
|
|
5
|
-
* <example>
|
|
6
|
-
:switchWindow.js
|
|
7
|
-
it('should switch to another window', async () => {
|
|
8
|
-
// open url
|
|
9
|
-
await browser.url('https://google.com')
|
|
10
|
-
|
|
11
|
-
// create new window
|
|
12
|
-
await browser.newWindow('https://webdriver.io')
|
|
13
|
-
|
|
14
|
-
// switch back via url match
|
|
15
|
-
await browser.switchWindow('google.com')
|
|
16
|
-
|
|
17
|
-
// switch back via title match
|
|
18
|
-
await browser.switchWindow('Next-gen browser and mobile automation test framework for Node.js')
|
|
19
|
-
});
|
|
20
|
-
* </example>
|
|
21
|
-
*
|
|
22
|
-
* @param {String|RegExp} matcher String or regular expression that matches the title and url of the page or window name
|
|
23
|
-
*
|
|
24
|
-
* @uses protocol/getWindowHandles, protocol/switchToWindow, protocol/getUrl, protocol/getTitle
|
|
25
|
-
* @alias browser.switchTab
|
|
26
|
-
* @type window
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
export default function switchWindow(this: WebdriverIO.Browser, matcher: string | RegExp): Promise<string>;
|
|
30
|
-
//# sourceMappingURL=switchWindow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switchWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAA8B,YAAY,CACtC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,MAAM,GAAG,MAAM,mBAiD3B"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Switch focus to a particular tab / window.
|
|
6
|
-
*
|
|
7
|
-
* <example>
|
|
8
|
-
:switchWindow.js
|
|
9
|
-
it('should switch to another window', async () => {
|
|
10
|
-
// open url
|
|
11
|
-
await browser.url('https://google.com')
|
|
12
|
-
|
|
13
|
-
// create new window
|
|
14
|
-
await browser.newWindow('https://webdriver.io')
|
|
15
|
-
|
|
16
|
-
// switch back via url match
|
|
17
|
-
await browser.switchWindow('google.com')
|
|
18
|
-
|
|
19
|
-
// switch back via title match
|
|
20
|
-
await browser.switchWindow('Next-gen browser and mobile automation test framework for Node.js')
|
|
21
|
-
});
|
|
22
|
-
* </example>
|
|
23
|
-
*
|
|
24
|
-
* @param {String|RegExp} matcher String or regular expression that matches the title and url of the page or window name
|
|
25
|
-
*
|
|
26
|
-
* @uses protocol/getWindowHandles, protocol/switchToWindow, protocol/getUrl, protocol/getTitle
|
|
27
|
-
* @alias browser.switchTab
|
|
28
|
-
* @type window
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
async function switchWindow(matcher) {
|
|
32
|
-
/**
|
|
33
|
-
* parameter check
|
|
34
|
-
*/
|
|
35
|
-
if (typeof matcher !== 'string' && !(matcher instanceof RegExp)) {
|
|
36
|
-
throw new Error('Unsupported parameter for switchWindow, required is "string" or an RegExp');
|
|
37
|
-
}
|
|
38
|
-
const tabs = await this.getWindowHandles();
|
|
39
|
-
const matchesTarget = (target) => {
|
|
40
|
-
if (typeof matcher === 'string') {
|
|
41
|
-
return target.includes(matcher);
|
|
42
|
-
}
|
|
43
|
-
return !!target.match(matcher);
|
|
44
|
-
};
|
|
45
|
-
for (const tab of tabs) {
|
|
46
|
-
await this.switchToWindow(tab);
|
|
47
|
-
/**
|
|
48
|
-
* check if url matches
|
|
49
|
-
*/
|
|
50
|
-
const url = await this.getUrl();
|
|
51
|
-
if (matchesTarget(url)) {
|
|
52
|
-
return tab;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* check title
|
|
56
|
-
*/
|
|
57
|
-
const title = await this.getTitle();
|
|
58
|
-
if (matchesTarget(title)) {
|
|
59
|
-
return tab;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* check window name
|
|
63
|
-
*/
|
|
64
|
-
const windowName = await this.execute(
|
|
65
|
-
/* istanbul ignore next */
|
|
66
|
-
() => window.name);
|
|
67
|
-
if (windowName && matchesTarget(windowName)) {
|
|
68
|
-
return tab;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
throw new Error(`No window found with title, url or name matching "${matcher}"`);
|
|
72
|
-
}
|
|
73
|
-
exports.default = switchWindow;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/throttle.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAmErE,wBAA8B,QAAQ,CAClC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,EAAE,eAAe,iBA0C1B"}
|