webdriverio 7.21.0 → 8.0.0-alpha.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +3 -0
- package/build/cjs/index.d.ts.map +1 -0
- package/build/cjs/index.js +13 -0
- package/build/cjs/package.json +3 -0
- package/build/commands/browser/$$.js +6 -9
- package/build/commands/browser/$.js +8 -11
- package/build/commands/browser/action.d.ts +128 -0
- package/build/commands/browser/action.d.ts.map +1 -0
- package/build/commands/browser/action.js +13 -0
- package/build/commands/browser/actions.d.ts +29 -0
- package/build/commands/browser/actions.d.ts.map +1 -0
- package/build/commands/browser/actions.js +30 -0
- package/build/commands/browser/call.js +1 -4
- package/build/commands/browser/custom$$.js +7 -10
- package/build/commands/browser/custom$.js +5 -8
- package/build/commands/browser/debug.js +8 -14
- package/build/commands/browser/deleteCookies.js +1 -4
- package/build/commands/browser/execute.js +3 -6
- package/build/commands/browser/executeAsync.js +3 -6
- package/build/commands/browser/getCookies.js +1 -4
- package/build/commands/browser/getPuppeteer.d.ts +1 -1
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
- package/build/commands/browser/getPuppeteer.js +14 -21
- package/build/commands/browser/getWindowSize.js +3 -6
- package/build/commands/browser/keys.d.ts +20 -10
- package/build/commands/browser/keys.d.ts.map +1 -1
- package/build/commands/browser/keys.js +29 -24
- package/build/commands/browser/mock.d.ts +1 -1
- package/build/commands/browser/mock.d.ts.map +1 -1
- package/build/commands/browser/mock.js +12 -19
- package/build/commands/browser/mockClearAll.js +5 -11
- package/build/commands/browser/mockRestoreAll.js +5 -11
- package/build/commands/browser/newWindow.js +5 -11
- package/build/commands/browser/pause.js +1 -4
- package/build/commands/browser/react$$.d.ts.map +1 -1
- package/build/commands/browser/react$$.js +12 -16
- package/build/commands/browser/react$.d.ts.map +1 -1
- package/build/commands/browser/react$.js +10 -14
- package/build/commands/browser/reloadSession.js +5 -12
- package/build/commands/browser/savePDF.js +7 -13
- package/build/commands/browser/saveRecordingScreen.js +6 -12
- package/build/commands/browser/saveScreenshot.js +6 -12
- package/build/commands/browser/scroll.d.ts +25 -0
- package/build/commands/browser/scroll.d.ts.map +1 -0
- package/build/commands/browser/scroll.js +41 -0
- package/build/commands/browser/setCookies.js +1 -4
- package/build/commands/browser/setTimeout.js +1 -4
- package/build/commands/browser/setWindowSize.js +3 -6
- package/build/commands/browser/switchWindow.js +1 -4
- package/build/commands/browser/throttle.js +3 -6
- package/build/commands/browser/touchAction.d.ts +1 -1
- package/build/commands/browser/touchAction.d.ts.map +1 -1
- package/build/commands/browser/touchAction.js +3 -6
- package/build/commands/browser/uploadFile.d.ts +1 -1
- package/build/commands/browser/uploadFile.d.ts.map +1 -1
- package/build/commands/browser/uploadFile.js +10 -15
- package/build/commands/browser/url.js +3 -6
- package/build/commands/browser/waitUntil.js +3 -9
- package/build/commands/browser.d.ts +39 -33
- package/build/commands/browser.d.ts.map +1 -1
- package/build/commands/browser.js +42 -43
- package/build/commands/constant.d.ts +1 -1
- package/build/commands/constant.d.ts.map +1 -1
- package/build/commands/constant.js +6 -12
- package/build/commands/element/$$.d.ts +1 -1
- package/build/commands/element/$$.d.ts.map +1 -1
- package/build/commands/element/$$.js +2 -7
- package/build/commands/element/$.d.ts +1 -1
- package/build/commands/element/$.d.ts.map +1 -1
- package/build/commands/element/$.js +2 -7
- package/build/commands/element/addValue.d.ts +10 -14
- package/build/commands/element/addValue.d.ts.map +1 -1
- package/build/commands/element/addValue.js +23 -27
- package/build/commands/element/clearValue.d.ts +1 -1
- package/build/commands/element/clearValue.js +2 -5
- package/build/commands/element/click.d.ts +1 -1
- package/build/commands/element/click.d.ts.map +1 -1
- package/build/commands/element/click.js +19 -34
- package/build/commands/element/custom$$.js +9 -11
- package/build/commands/element/custom$.js +8 -10
- package/build/commands/element/doubleClick.d.ts.map +1 -1
- package/build/commands/element/doubleClick.js +11 -17
- package/build/commands/element/dragAndDrop.d.ts.map +1 -1
- package/build/commands/element/dragAndDrop.js +13 -19
- package/build/commands/element/getAttribute.js +1 -4
- package/build/commands/element/getCSSProperty.d.ts +1 -1
- package/build/commands/element/getCSSProperty.d.ts.map +1 -1
- package/build/commands/element/getCSSProperty.js +7 -13
- package/build/commands/element/getComputedLabel.js +1 -4
- package/build/commands/element/getComputedRole.js +1 -4
- package/build/commands/element/getHTML.js +7 -13
- package/build/commands/element/getLocation.js +3 -5
- package/build/commands/element/getProperty.d.ts +8 -8
- package/build/commands/element/getProperty.d.ts.map +1 -1
- package/build/commands/element/getProperty.js +5 -11
- package/build/commands/element/getSize.js +3 -5
- package/build/commands/element/getTagName.js +1 -4
- package/build/commands/element/getText.js +1 -4
- package/build/commands/element/getValue.js +1 -4
- package/build/commands/element/isClickable.js +7 -13
- package/build/commands/element/isDisplayed.js +9 -16
- package/build/commands/element/isDisplayedInViewport.js +7 -13
- package/build/commands/element/isEnabled.js +1 -4
- package/build/commands/element/isEqual.d.ts.map +1 -1
- package/build/commands/element/isEqual.js +9 -9
- package/build/commands/element/isExisting.js +1 -4
- package/build/commands/element/isFocused.js +7 -13
- package/build/commands/element/isSelected.js +1 -4
- package/build/commands/element/moveTo.d.ts.map +1 -1
- package/build/commands/element/moveTo.js +8 -13
- package/build/commands/element/nextElement.js +2 -5
- package/build/commands/element/parentElement.js +2 -5
- package/build/commands/element/previousElement.js +2 -5
- package/build/commands/element/react$$.d.ts.map +1 -1
- package/build/commands/element/react$$.js +13 -16
- package/build/commands/element/react$.d.ts.map +1 -1
- package/build/commands/element/react$.js +12 -14
- package/build/commands/element/saveScreenshot.js +6 -12
- package/build/commands/element/scrollIntoView.d.ts +3 -2
- package/build/commands/element/scrollIntoView.d.ts.map +1 -1
- package/build/commands/element/scrollIntoView.js +32 -12
- package/build/commands/element/selectByAttribute.js +3 -6
- package/build/commands/element/selectByIndex.js +3 -6
- package/build/commands/element/selectByVisibleText.js +3 -6
- package/build/commands/element/setValue.d.ts +13 -14
- package/build/commands/element/setValue.d.ts.map +1 -1
- package/build/commands/element/setValue.js +14 -17
- package/build/commands/element/shadow$$.d.ts +1 -1
- package/build/commands/element/shadow$$.d.ts.map +1 -1
- package/build/commands/element/shadow$$.js +3 -6
- package/build/commands/element/shadow$.js +3 -6
- package/build/commands/element/touchAction.js +3 -6
- package/build/commands/element/waitForClickable.js +1 -4
- package/build/commands/element/waitForDisplayed.js +1 -4
- package/build/commands/element/waitForEnabled.js +1 -4
- package/build/commands/element/waitForExist.js +1 -4
- package/build/commands/element/waitUntil.d.ts +1 -1
- package/build/commands/element/waitUntil.d.ts.map +1 -1
- package/build/commands/element/waitUntil.js +2 -7
- package/build/commands/element.d.ts +48 -48
- package/build/commands/element.d.ts.map +1 -1
- package/build/commands/element.js +57 -62
- package/build/constants.d.ts +66 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +91 -12
- package/build/index.d.ts +64 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +47 -85
- package/build/middlewares.d.ts +1 -1
- package/build/middlewares.js +11 -19
- package/build/multiremote.js +12 -20
- package/build/protocol-stub.d.ts.map +1 -1
- package/build/protocol-stub.js +4 -6
- package/build/scripts/getHTML.js +1 -4
- package/build/scripts/getProperty.d.ts +8 -8
- package/build/scripts/getProperty.d.ts.map +1 -1
- package/build/scripts/getProperty.js +1 -4
- package/build/scripts/isElementClickable.js +1 -4
- package/build/scripts/isElementDisplayed.js +1 -4
- package/build/scripts/isElementInViewport.js +1 -4
- package/build/scripts/isFocused.js +1 -4
- package/build/scripts/newWindow.js +1 -4
- package/build/scripts/resq.js +3 -9
- package/build/scripts/shadowFnFactory.js +2 -6
- package/build/types.d.ts +1 -5
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -2
- package/build/utils/SevereServiceError.js +1 -4
- package/build/utils/Timer.d.ts.map +1 -1
- package/build/utils/Timer.js +1 -25
- package/build/utils/actions/base.d.ts +32 -0
- package/build/utils/actions/base.d.ts.map +1 -0
- package/build/utils/actions/base.js +78 -0
- package/build/utils/actions/index.d.ts +6 -0
- package/build/utils/actions/index.d.ts.map +1 -0
- package/build/utils/actions/index.js +5 -0
- package/build/utils/actions/key.d.ts +15 -0
- package/build/utils/actions/key.d.ts.map +1 -0
- package/build/utils/actions/key.js +22 -0
- package/build/utils/actions/pointer.d.ts +62 -0
- package/build/utils/actions/pointer.d.ts.map +1 -0
- package/build/utils/actions/pointer.js +76 -0
- package/build/utils/actions/wheel.d.ts +36 -0
- package/build/utils/actions/wheel.d.ts.map +1 -0
- package/build/utils/actions/wheel.js +20 -0
- package/build/utils/detectBackend.d.ts +1 -1
- package/build/utils/detectBackend.d.ts.map +1 -1
- package/build/utils/detectBackend.js +3 -7
- package/build/utils/findStrategy.js +11 -19
- package/build/utils/getElementObject.d.ts.map +1 -1
- package/build/utils/getElementObject.js +42 -31
- package/build/utils/implicitWait.js +3 -9
- package/build/utils/index.d.ts +2 -6
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +92 -142
- package/build/utils/interception/devtools.d.ts +1 -1
- package/build/utils/interception/devtools.d.ts.map +1 -1
- package/build/utils/interception/devtools.js +17 -23
- package/build/utils/interception/index.d.ts +2 -2
- package/build/utils/interception/index.d.ts.map +1 -1
- package/build/utils/interception/index.js +5 -11
- package/build/utils/interception/types.d.ts +1 -1
- package/build/utils/interception/types.d.ts.map +1 -1
- package/build/utils/interception/types.js +1 -2
- package/build/utils/interception/webdriver.d.ts +1 -1
- package/build/utils/interception/webdriver.d.ts.map +1 -1
- package/build/utils/interception/webdriver.js +5 -11
- package/build/utils/refetchElement.js +3 -9
- package/package.json +22 -11
- package/async.d.ts +0 -24
- package/sync.d.ts +0 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cjs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAGxD,oBAAY,aAAa,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
exports.remote = async function (params, remoteModifier) {
|
|
2
|
+
const { remote } = await import('../index.js');
|
|
3
|
+
return remote(params, remoteModifier);
|
|
4
|
+
};
|
|
5
|
+
exports.attach = async function (attachOptions) {
|
|
6
|
+
const { attach } = await import('../index.js');
|
|
7
|
+
return attach(attachOptions);
|
|
8
|
+
};
|
|
9
|
+
exports.multiremote = async function (params, { automationProtocol } = {}) {
|
|
10
|
+
const { multiremote } = await import('../index.js');
|
|
11
|
+
return multiremote(params, { automationProtocol });
|
|
12
|
+
};
|
|
13
|
+
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
4
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
1
|
+
import { findElements, enhanceElementsArray } from '../../utils/index.js';
|
|
2
|
+
import { getElements } from '../../utils/getElementObject.js';
|
|
5
3
|
/**
|
|
6
4
|
* The `$$` command is a short way to call the [`findElements`](/docs/api/webdriver#findelements) command in order
|
|
7
5
|
* to fetch multiple elements on the page. It returns an array with element results that will have an
|
|
@@ -49,9 +47,8 @@ const getElementObject_1 = require("../../utils/getElementObject");
|
|
|
49
47
|
* @type utility
|
|
50
48
|
*
|
|
51
49
|
*/
|
|
52
|
-
async function $$(selector) {
|
|
53
|
-
const res = await
|
|
54
|
-
const elements = await
|
|
55
|
-
return
|
|
50
|
+
export default async function $$(selector) {
|
|
51
|
+
const res = await findElements.call(this, selector);
|
|
52
|
+
const elements = await getElements.call(this, selector, res);
|
|
53
|
+
return enhanceElementsArray(elements, this, selector);
|
|
56
54
|
}
|
|
57
|
-
exports.default = $$;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { findElement } from '../../utils/index.js';
|
|
2
|
+
import { getElement } from '../../utils/getElementObject.js';
|
|
3
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
6
4
|
/**
|
|
7
5
|
* The `$` command is a short way to call the [`findElement`](/docs/api/webdriver#findelement) command in order
|
|
8
6
|
* to fetch a single element on the page. It returns an object that with an extended prototype to call
|
|
@@ -77,18 +75,17 @@ const constants_1 = require("../../constants");
|
|
|
77
75
|
* @type utility
|
|
78
76
|
*
|
|
79
77
|
*/
|
|
80
|
-
async function $(selector) {
|
|
78
|
+
export default async function $(selector) {
|
|
81
79
|
/**
|
|
82
80
|
* convert protocol result into WebdriverIO element
|
|
83
81
|
* e.g. when element was fetched with `getActiveElement`
|
|
84
82
|
*/
|
|
85
83
|
if (typeof selector === 'object') {
|
|
86
84
|
const elementRef = selector;
|
|
87
|
-
if (typeof elementRef[
|
|
88
|
-
return
|
|
85
|
+
if (typeof elementRef[ELEMENT_KEY] === 'string') {
|
|
86
|
+
return getElement.call(this, undefined, elementRef);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
|
-
const res = await
|
|
92
|
-
return
|
|
89
|
+
const res = await findElement.call(this, selector);
|
|
90
|
+
return getElement.call(this, selector, res);
|
|
93
91
|
}
|
|
94
|
-
exports.default = $;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { KeyAction, PointerAction, WheelAction, BaseActionParams } from '../../utils/actions/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The action command is a low-level interface for providing virtualized device input actions to the web browser.
|
|
4
|
+
*
|
|
5
|
+
* In addition to high level commands such like `scrollIntoView`, `doubleClick`, the Actions API provides granular
|
|
6
|
+
* control over exactly what designated input devices can do. WebdriverIO provides an interface for 3 kinds of input
|
|
7
|
+
* sources:
|
|
8
|
+
*
|
|
9
|
+
* - a key input for keyboard devices
|
|
10
|
+
* - a pointer input for a mouse, pen or touch devices
|
|
11
|
+
* - and wheel inputs for scroll wheel devices
|
|
12
|
+
*
|
|
13
|
+
* Every chain of action commands has to be completed calling `perform` in order to trigger the set of actions. This
|
|
14
|
+
* causes actions [to be released](https://w3c.github.io/webdriver/#release-actions) and events to be fired. You can
|
|
15
|
+
* skip this by passing in `true` (e.g. `browser.actions(...).perform(true)`).
|
|
16
|
+
*
|
|
17
|
+
* :::info
|
|
18
|
+
*
|
|
19
|
+
* Support for this command and specific actions can differ based on the environment. Progress on the development
|
|
20
|
+
* can be followed on [wpt.fyi](https://wpt.fyi/results/webdriver/tests/perform_actions?label=experimental&label=master&aligned).
|
|
21
|
+
* For mobile you might want to use Appium specific gesture commands on [iOS](https://github.com/appium/appium-xcuitest-driver#mobile-pinch)
|
|
22
|
+
* and [Android](https://github.com/appium/appium-uiautomator2-driver#mobile-gesture-commands).
|
|
23
|
+
*
|
|
24
|
+
* :::
|
|
25
|
+
*
|
|
26
|
+
* ### Key input source
|
|
27
|
+
*
|
|
28
|
+
* A key input source is an input source that is associated with a keyboard-type device. It can be triggered
|
|
29
|
+
* by using the `key` type parameters. e.g.:
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* browser.action('key')
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* It returns a `KeyAction` object that supports the following actions:
|
|
36
|
+
*
|
|
37
|
+
* - `down(value: string)`: generates a key down action
|
|
38
|
+
* - `up(value: string)`: generates a key up action
|
|
39
|
+
* - `pause(ms: number)`: indicate that an input source does nothing during a particular tick
|
|
40
|
+
*
|
|
41
|
+
* ### Pointer input source
|
|
42
|
+
*
|
|
43
|
+
* A pointer input source is an input source that is associated with a pointer-type input device. The type can be
|
|
44
|
+
* specified when invoking the `action` command, e.g.:
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* browser.action('pointer'. {
|
|
48
|
+
* parameters: { pointerType: 'mouse' } // "mouse" is default value, also possible: "pen" or "touch"
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* It returns a `PointerAction` object that supports the following actions:
|
|
53
|
+
*
|
|
54
|
+
* - `down (button: 'left' | 'middle' | 'right')`: creates an action to press a single key
|
|
55
|
+
* - `down (params: PointerActionParams)`: creates an action to press a single key with detailed parameters
|
|
56
|
+
* - `move (x: number, y: number)`: Creates an action for moving the pointer `x` and `y` pixels from the viewport
|
|
57
|
+
* - `move (params: PointerActionMoveParams)`: Creates an action for moving the pointer `x` and `y` pixels from the
|
|
58
|
+
* specified `origin`. The `origin` may be defined as the pointers current position (e.g. "pointer"), the viewport
|
|
59
|
+
* (e.g. "viewport") or the center of a specific element.
|
|
60
|
+
* - `up (button: 'left' | 'middle' | 'right')`: creates an action to release a single key
|
|
61
|
+
* - `up (params: PointerActionUpParams)`: creates an action to release a single key with detailed parameters
|
|
62
|
+
* - `cancel()`: An action that cancels this pointer's current input.
|
|
63
|
+
* - `pause(ms: number)`: indicate that an input source does nothing during a particular tick
|
|
64
|
+
*
|
|
65
|
+
* You can find detailed information on the [`PointerActionParams`](https://github.com/webdriverio/webdriverio/blob/8ca026c75bf7c27ef9d574f0ec48d8bc13658602/packages/webdriverio/src/utils/actions/pointer.ts#L20-L35), [`PointerActionMoveParams`](https://github.com/webdriverio/webdriverio/blob/8ca026c75bf7c27ef9d574f0ec48d8bc13658602/packages/webdriverio/src/utils/actions/pointer.ts#L20-L42) and [`PointerActionUpParams`](https://github.com/webdriverio/webdriverio/blob/8ca026c75bf7c27ef9d574f0ec48d8bc13658602/packages/webdriverio/src/utils/actions/pointer.ts#L13-L19)
|
|
66
|
+
* parameter types in the project type definition.
|
|
67
|
+
*
|
|
68
|
+
* ### Wheel input source
|
|
69
|
+
*
|
|
70
|
+
* A wheel input source is an input source that is associated with a wheel-type input device.
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* browser.action('wheel')
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* It returns a `WheelAction` object that supports the following actions:
|
|
77
|
+
*
|
|
78
|
+
* - `scroll (params: ScrollParams)`: scrolls a page to given coordinates or origin
|
|
79
|
+
* - `pause(ms: number)`: indicate that an input source does nothing during a particular tick
|
|
80
|
+
*
|
|
81
|
+
* You can find detailed information on the [`ScrollParams`](https://github.com/webdriverio/webdriverio/blob/8ca026c75bf7c27ef9d574f0ec48d8bc13658602/packages/webdriverio/src/utils/actions/wheel.ts#L4-L29) parameter type in the project type definition.
|
|
82
|
+
*
|
|
83
|
+
* <example>
|
|
84
|
+
:pointer-action.js
|
|
85
|
+
it('drag and drop using pointer action command', async () => {
|
|
86
|
+
const origin = await $('#source')
|
|
87
|
+
const targetOrigin = await $('#target')
|
|
88
|
+
|
|
89
|
+
return browser.action('pointer')
|
|
90
|
+
.move({ duration: 0, origin, x: 0, y: 0 })
|
|
91
|
+
.down({ button: 0 }) // left button
|
|
92
|
+
.pause(10)
|
|
93
|
+
.move({ duration, origin: targetOrigin })
|
|
94
|
+
.up({ button: 0 })
|
|
95
|
+
.perform()
|
|
96
|
+
});
|
|
97
|
+
:key-action.js
|
|
98
|
+
it('should emit key events using key action commands', async () => {
|
|
99
|
+
const elem = await $('input')
|
|
100
|
+
await elem.click() // make element active
|
|
101
|
+
|
|
102
|
+
await browser.action('key)
|
|
103
|
+
.down('f')
|
|
104
|
+
.down('o')
|
|
105
|
+
.down('o')
|
|
106
|
+
.up('f')
|
|
107
|
+
.up('o')
|
|
108
|
+
.up('o')
|
|
109
|
+
.perform()
|
|
110
|
+
|
|
111
|
+
console.log(await elem.getValue()) // returns "foo"
|
|
112
|
+
})
|
|
113
|
+
:wheel-action.js
|
|
114
|
+
it('should scroll using wheel action commands', async () => {
|
|
115
|
+
console.log(await browser.execute(() => window.scrollY)) // returns 0
|
|
116
|
+
await browser.scroll(0, 200)
|
|
117
|
+
console.log(await browser.execute(() => window.scrollY)) // returns 200
|
|
118
|
+
})
|
|
119
|
+
* </example>
|
|
120
|
+
*
|
|
121
|
+
* @alias browser.action
|
|
122
|
+
* @type utility
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
export default function action(this: WebdriverIO.Browser, type: 'key', opts?: Pick<BaseActionParams, 'id'>): KeyAction;
|
|
126
|
+
export default function action(this: WebdriverIO.Browser, type: 'pointer', opts?: BaseActionParams): PointerAction;
|
|
127
|
+
export default function action(this: WebdriverIO.Browser, type: 'wheel', opts?: Pick<BaseActionParams, 'id'>): WheelAction;
|
|
128
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAc,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0HG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,KAAK,EACX,IAAI,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,GACpC,SAAS,CAAA;AACZ,MAAM,CAAC,OAAO,UAAU,MAAM,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,SAAS,EACf,IAAI,CAAC,EAAE,gBAAgB,GACxB,aAAa,CAAA;AAChB,MAAM,CAAC,OAAO,UAAU,MAAM,CAC1B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,OAAO,EACb,IAAI,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,GACpC,WAAW,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KeyAction, PointerAction, WheelAction } from '../../utils/actions/index.js';
|
|
2
|
+
export default function action(type, opts) {
|
|
3
|
+
if (type === 'key') {
|
|
4
|
+
return new KeyAction(this, opts);
|
|
5
|
+
}
|
|
6
|
+
if (type === 'pointer') {
|
|
7
|
+
return new PointerAction(this, opts);
|
|
8
|
+
}
|
|
9
|
+
if (type === 'wheel') {
|
|
10
|
+
return new WheelAction(this, opts);
|
|
11
|
+
}
|
|
12
|
+
throw new Error(`Unsupported action type "${type}", supported are "key", "pointer", "wheel"`);
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { KeyAction, PointerAction, WheelAction } from '../../utils/actions/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Allows to run multiple action interaction at once, e.g. to simulate a pinch zoom.
|
|
4
|
+
* For more information on the `action` command, check out the [docs](./action).
|
|
5
|
+
*
|
|
6
|
+
* <example>
|
|
7
|
+
:action.js
|
|
8
|
+
it('run multiple actions at once for a pinch zoom', async () => {
|
|
9
|
+
await browser.actions([
|
|
10
|
+
browser.action('pointer')
|
|
11
|
+
.move(500, 500)
|
|
12
|
+
.down()
|
|
13
|
+
.move(250, 250)
|
|
14
|
+
.up(),
|
|
15
|
+
browser.action('pointer')
|
|
16
|
+
.move(500, 500)
|
|
17
|
+
.down()
|
|
18
|
+
.move(750, 750)
|
|
19
|
+
.up()
|
|
20
|
+
])
|
|
21
|
+
});
|
|
22
|
+
* </example>
|
|
23
|
+
*
|
|
24
|
+
* @alias browser.action
|
|
25
|
+
* @type utility
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export default function actions(this: WebdriverIO.Browser, actions: (KeyAction | PointerAction | WheelAction)[]): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,CAAC,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC,EAAE,GACrD,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows to run multiple action interaction at once, e.g. to simulate a pinch zoom.
|
|
3
|
+
* For more information on the `action` command, check out the [docs](./action).
|
|
4
|
+
*
|
|
5
|
+
* <example>
|
|
6
|
+
:action.js
|
|
7
|
+
it('run multiple actions at once for a pinch zoom', async () => {
|
|
8
|
+
await browser.actions([
|
|
9
|
+
browser.action('pointer')
|
|
10
|
+
.move(500, 500)
|
|
11
|
+
.down()
|
|
12
|
+
.move(250, 250)
|
|
13
|
+
.up(),
|
|
14
|
+
browser.action('pointer')
|
|
15
|
+
.move(500, 500)
|
|
16
|
+
.down()
|
|
17
|
+
.move(750, 750)
|
|
18
|
+
.up()
|
|
19
|
+
])
|
|
20
|
+
});
|
|
21
|
+
* </example>
|
|
22
|
+
*
|
|
23
|
+
* @alias browser.action
|
|
24
|
+
* @type utility
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export default async function actions(actions) {
|
|
28
|
+
await this.performActions(actions.map((action) => action.toJSON()));
|
|
29
|
+
await this.releaseActions();
|
|
30
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* You can use `call` to execute any async action within your test spec. The command itself
|
|
5
3
|
* is treated like a synchronous function. It accepts promises and stops the execution until
|
|
@@ -40,10 +38,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
38
|
* @type utility
|
|
41
39
|
*
|
|
42
40
|
*/
|
|
43
|
-
function call(fn) {
|
|
41
|
+
export default function call(fn) {
|
|
44
42
|
if (typeof fn === 'function') {
|
|
45
43
|
return fn();
|
|
46
44
|
}
|
|
47
45
|
throw new Error('Command argument for "call" needs to be a function');
|
|
48
46
|
}
|
|
49
|
-
exports.default = call;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { enhanceElementsArray } from '../../utils/index.js';
|
|
2
|
+
import { getElements } from '../../utils/getElementObject.js';
|
|
3
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
6
4
|
/**
|
|
7
5
|
*
|
|
8
6
|
* The `customs$$` allows you to use a custom strategy declared by using `browser.addLocatorStrategy`
|
|
@@ -26,7 +24,7 @@ const constants_1 = require("../../constants");
|
|
|
26
24
|
* @param {Any} strategyArguments
|
|
27
25
|
* @return {ElementArray}
|
|
28
26
|
*/
|
|
29
|
-
async function custom$$(strategyName, ...strategyArguments) {
|
|
27
|
+
export default async function custom$$(strategyName, ...strategyArguments) {
|
|
30
28
|
const strategy = this.strategies.get(strategyName);
|
|
31
29
|
if (!strategy) {
|
|
32
30
|
throw Error('No strategy found for ' + strategyName);
|
|
@@ -41,8 +39,7 @@ async function custom$$(strategyName, ...strategyArguments) {
|
|
|
41
39
|
if (!Array.isArray(res)) {
|
|
42
40
|
res = [res];
|
|
43
41
|
}
|
|
44
|
-
res = res.filter(el => !!el && typeof el[
|
|
45
|
-
const elements = res.length ? await
|
|
46
|
-
return
|
|
42
|
+
res = res.filter(el => !!el && typeof el[ELEMENT_KEY] === 'string');
|
|
43
|
+
const elements = res.length ? await getElements.call(this, strategyRef, res) : [];
|
|
44
|
+
return enhanceElementsArray(elements, this, strategyName, 'custom$$', strategyArguments);
|
|
47
45
|
}
|
|
48
|
-
exports.default = custom$$;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { getElement } from '../../utils/getElementObject.js';
|
|
2
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
5
3
|
/**
|
|
6
4
|
*
|
|
7
5
|
* The `custom$` allows you to use a custom strategy declared by using `browser.addLocatorStrategy`
|
|
@@ -25,7 +23,7 @@ const constants_1 = require("../../constants");
|
|
|
25
23
|
* @param {Any} strategyArguments
|
|
26
24
|
* @return {Element}
|
|
27
25
|
*/
|
|
28
|
-
async function custom$(strategyName, ...strategyArguments) {
|
|
26
|
+
export default async function custom$(strategyName, ...strategyArguments) {
|
|
29
27
|
const strategy = this.strategies.get(strategyName);
|
|
30
28
|
if (!strategy) {
|
|
31
29
|
throw Error('No strategy found for ' + strategyName);
|
|
@@ -40,9 +38,8 @@ async function custom$(strategyName, ...strategyArguments) {
|
|
|
40
38
|
if (Array.isArray(res)) {
|
|
41
39
|
res = res[0];
|
|
42
40
|
}
|
|
43
|
-
if (res && typeof res[
|
|
44
|
-
return await
|
|
41
|
+
if (res && typeof res[ELEMENT_KEY] === 'string') {
|
|
42
|
+
return await getElement.call(this, strategyRef, res);
|
|
45
43
|
}
|
|
46
44
|
throw Error('Your locator strategy script must return an element');
|
|
47
45
|
}
|
|
48
|
-
exports.default = custom$;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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"));
|
|
1
|
+
import { serializeError } from 'serialize-error';
|
|
2
|
+
import WDIORepl from '@wdio/repl';
|
|
8
3
|
/**
|
|
9
4
|
*
|
|
10
5
|
* This command helps you to debug your integration tests. It stops the running browser and gives
|
|
@@ -35,15 +30,15 @@ const repl_1 = __importDefault(require("@wdio/repl"));
|
|
|
35
30
|
* @type utility
|
|
36
31
|
*
|
|
37
32
|
*/
|
|
38
|
-
function debug(commandTimeout = 5000) {
|
|
39
|
-
const repl = new
|
|
40
|
-
const { introMessage } =
|
|
33
|
+
export default function debug(commandTimeout = 5000) {
|
|
34
|
+
const repl = new WDIORepl();
|
|
35
|
+
const { introMessage } = WDIORepl;
|
|
41
36
|
/**
|
|
42
37
|
* run repl in standalone mode
|
|
43
38
|
*/
|
|
44
|
-
if (!process.env.
|
|
39
|
+
if (!process.env.WDIO_WORKER_ID || typeof process.send !== 'function') {
|
|
45
40
|
// eslint-disable-next-line
|
|
46
|
-
console.log(
|
|
41
|
+
console.log(WDIORepl.introMessage);
|
|
47
42
|
const context = {
|
|
48
43
|
browser: this,
|
|
49
44
|
driver: this,
|
|
@@ -85,7 +80,7 @@ function debug(commandTimeout = 5000) {
|
|
|
85
80
|
name: 'result',
|
|
86
81
|
params: {
|
|
87
82
|
error: true,
|
|
88
|
-
...
|
|
83
|
+
...serializeError(err)
|
|
89
84
|
}
|
|
90
85
|
});
|
|
91
86
|
}
|
|
@@ -105,4 +100,3 @@ function debug(commandTimeout = 5000) {
|
|
|
105
100
|
});
|
|
106
101
|
return new Promise((resolve) => (commandResolve = resolve));
|
|
107
102
|
}
|
|
108
|
-
exports.default = debug;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
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.
|
|
@@ -43,7 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
43
41
|
* @type cookie
|
|
44
42
|
*
|
|
45
43
|
*/
|
|
46
|
-
function deleteCookies(names) {
|
|
44
|
+
export default function deleteCookies(names) {
|
|
47
45
|
if (names === undefined) {
|
|
48
46
|
return this.deleteAllCookies();
|
|
49
47
|
}
|
|
@@ -53,4 +51,3 @@ function deleteCookies(names) {
|
|
|
53
51
|
}
|
|
54
52
|
return Promise.all(namesList.map(name => this.deleteCookie(name)));
|
|
55
53
|
}
|
|
56
|
-
exports.default = deleteCookies;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { verifyArgsAndStripIfElement } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
|
@@ -36,7 +34,7 @@ const utils_1 = require("../../utils");
|
|
|
36
34
|
* @type protocol
|
|
37
35
|
*
|
|
38
36
|
*/
|
|
39
|
-
function execute(script, ...args) {
|
|
37
|
+
export default function execute(script, ...args) {
|
|
40
38
|
/**
|
|
41
39
|
* parameter check
|
|
42
40
|
*/
|
|
@@ -50,6 +48,5 @@ function execute(script, ...args) {
|
|
|
50
48
|
if (typeof script === 'function') {
|
|
51
49
|
script = `return (${script}).apply(null, arguments)`;
|
|
52
50
|
}
|
|
53
|
-
return this.executeScript(script,
|
|
51
|
+
return this.executeScript(script, verifyArgsAndStripIfElement(args));
|
|
54
52
|
}
|
|
55
|
-
exports.default = execute;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { verifyArgsAndStripIfElement } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected
|
|
@@ -44,7 +42,7 @@ const utils_1 = require("../../utils");
|
|
|
44
42
|
* @type protocol
|
|
45
43
|
*
|
|
46
44
|
*/
|
|
47
|
-
function executeAsync(script, ...args) {
|
|
45
|
+
export default function executeAsync(script, ...args) {
|
|
48
46
|
/**
|
|
49
47
|
* parameter check
|
|
50
48
|
*/
|
|
@@ -58,6 +56,5 @@ function executeAsync(script, ...args) {
|
|
|
58
56
|
if (typeof script === 'function') {
|
|
59
57
|
script = `return (${script}).apply(null, arguments)`;
|
|
60
58
|
}
|
|
61
|
-
return this.executeAsyncScript(script,
|
|
59
|
+
return this.executeAsyncScript(script, verifyArgsAndStripIfElement(args));
|
|
62
60
|
}
|
|
63
|
-
exports.default = executeAsync;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Retrieve a [cookie](https://w3c.github.io/webdriver/webdriver-spec.html#cookies)
|
|
@@ -32,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
30
|
* @uses webdriver/getAllCookies
|
|
33
31
|
*
|
|
34
32
|
*/
|
|
35
|
-
async function getCookies(names) {
|
|
33
|
+
export default async function getCookies(names) {
|
|
36
34
|
if (names === undefined) {
|
|
37
35
|
return this.getAllCookies();
|
|
38
36
|
}
|
|
@@ -43,4 +41,3 @@ async function getCookies(names) {
|
|
|
43
41
|
const allCookies = await this.getAllCookies();
|
|
44
42
|
return allCookies.filter(cookie => namesList.includes(cookie.name));
|
|
45
43
|
}
|
|
46
|
-
exports.default = getCookies;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Browser as PuppeteerBrowser } from 'puppeteer-core/lib/cjs/puppeteer/common/Browser';
|
|
1
|
+
import { Browser as PuppeteerBrowser } from 'puppeteer-core/lib/cjs/puppeteer/common/Browser.js';
|
|
2
2
|
/**
|
|
3
3
|
* Get the [Puppeteer Browser instance](https://pptr.dev/#?product=Puppeteer&version=v5.1.0&show=api-class-browser)
|
|
4
4
|
* to run commands with Puppeteer. Note that all Puppeteer commands are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oDAAoD,CAAA;AAOhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAA8B,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,6BAiFpE"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
7
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
8
|
-
const constants_1 = require("../../constants");
|
|
9
|
-
const log = (0, logger_1.default)('webdriverio');
|
|
1
|
+
import puppeteer from 'puppeteer-core';
|
|
2
|
+
import logger from '@wdio/logger';
|
|
3
|
+
import { FF_REMOTE_DEBUG_ARG } from '../../constants.js';
|
|
4
|
+
const log = logger('webdriverio');
|
|
10
5
|
/**
|
|
11
6
|
* Get the [Puppeteer Browser instance](https://pptr.dev/#?product=Puppeteer&version=v5.1.0&show=api-class-browser)
|
|
12
7
|
* to run commands with Puppeteer. Note that all Puppeteer commands are
|
|
@@ -42,13 +37,12 @@ const log = (0, logger_1.default)('webdriverio');
|
|
|
42
37
|
*
|
|
43
38
|
* @return {PuppeteerBrowser} initiated puppeteer instance connected to the browser
|
|
44
39
|
*/
|
|
45
|
-
async function getPuppeteer() {
|
|
46
|
-
var _a, _b, _c, _d, _e;
|
|
40
|
+
export default async function getPuppeteer() {
|
|
47
41
|
/**
|
|
48
42
|
* check if we already connected Puppeteer and if so return
|
|
49
43
|
* that instance
|
|
50
44
|
*/
|
|
51
|
-
if (
|
|
45
|
+
if (this.puppeteer?.isConnected()) {
|
|
52
46
|
log.debug('Reusing existing puppeteer session');
|
|
53
47
|
return this.puppeteer;
|
|
54
48
|
}
|
|
@@ -58,7 +52,7 @@ async function getPuppeteer() {
|
|
|
58
52
|
*/
|
|
59
53
|
const cdpEndpoint = caps['se:cdp'];
|
|
60
54
|
if (cdpEndpoint) {
|
|
61
|
-
this.puppeteer = await
|
|
55
|
+
this.puppeteer = await puppeteer.connect({
|
|
62
56
|
browserWSEndpoint: cdpEndpoint,
|
|
63
57
|
defaultViewport: null
|
|
64
58
|
});
|
|
@@ -67,11 +61,11 @@ async function getPuppeteer() {
|
|
|
67
61
|
/**
|
|
68
62
|
* attach to a Selenoid\Moon CDP Session if there are Aerokube vendor capabilities
|
|
69
63
|
*/
|
|
70
|
-
const requestedCapabilities =
|
|
64
|
+
const requestedCapabilities = this.requestedCapabilities?.alwaysMatch || this.requestedCapabilities;
|
|
71
65
|
const isAerokubeSession = requestedCapabilities['selenoid:options'] || requestedCapabilities['moon:options'];
|
|
72
66
|
if (isAerokubeSession) {
|
|
73
67
|
const { hostname, port } = this.options;
|
|
74
|
-
this.puppeteer = await
|
|
68
|
+
this.puppeteer = await puppeteer.connect({
|
|
75
69
|
browserWSEndpoint: `ws://${hostname}:${port}/devtools/${this.sessionId}`,
|
|
76
70
|
defaultViewport: null
|
|
77
71
|
});
|
|
@@ -82,7 +76,7 @@ async function getPuppeteer() {
|
|
|
82
76
|
*/
|
|
83
77
|
const chromiumOptions = caps['goog:chromeOptions'] || caps['ms:edgeOptions'];
|
|
84
78
|
if (chromiumOptions && chromiumOptions.debuggerAddress) {
|
|
85
|
-
this.puppeteer = await
|
|
79
|
+
this.puppeteer = await puppeteer.connect({
|
|
86
80
|
browserURL: `http://${chromiumOptions.debuggerAddress}`,
|
|
87
81
|
defaultViewport: null
|
|
88
82
|
});
|
|
@@ -91,7 +85,7 @@ async function getPuppeteer() {
|
|
|
91
85
|
/**
|
|
92
86
|
* attach to Firefox debugger session
|
|
93
87
|
*/
|
|
94
|
-
if (
|
|
88
|
+
if (caps.browserName?.toLowerCase() === 'firefox') {
|
|
95
89
|
if (!caps.browserVersion) {
|
|
96
90
|
throw new Error('Can\'t find "browserVersion" in capabilities');
|
|
97
91
|
}
|
|
@@ -99,14 +93,14 @@ async function getPuppeteer() {
|
|
|
99
93
|
if (majorVersion >= 79) {
|
|
100
94
|
const reqCaps = this.requestedCapabilities.alwaysMatch || this.requestedCapabilities;
|
|
101
95
|
const ffOptions = caps['moz:firefoxOptions'];
|
|
102
|
-
const ffArgs =
|
|
96
|
+
const ffArgs = reqCaps['moz:firefoxOptions']?.args;
|
|
103
97
|
const rdPort = ffOptions && ffOptions.debuggerAddress
|
|
104
98
|
? ffOptions.debuggerAddress
|
|
105
|
-
:
|
|
99
|
+
: ffArgs?.[ffArgs.findIndex((arg) => arg === FF_REMOTE_DEBUG_ARG) + 1] ?? null;
|
|
106
100
|
if (!rdPort) {
|
|
107
101
|
throw new Error('Could\'t find remote debug port in Firefox options');
|
|
108
102
|
}
|
|
109
|
-
this.puppeteer = await
|
|
103
|
+
this.puppeteer = await puppeteer.connect({
|
|
110
104
|
browserURL: `http://localhost:${rdPort}`,
|
|
111
105
|
defaultViewport: null
|
|
112
106
|
});
|
|
@@ -116,4 +110,3 @@ async function getPuppeteer() {
|
|
|
116
110
|
throw new Error('Using DevTools capabilities is not supported for this session. ' +
|
|
117
111
|
'This feature is only supported for local testing on Chrome, Firefox and Chromium Edge.');
|
|
118
112
|
}
|
|
119
|
-
exports.default = getPuppeteer;
|