webdriverio 7.20.7 → 7.20.8-alpha.504

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/build/cjs/index.d.ts +3 -0
  2. package/build/cjs/index.d.ts.map +1 -0
  3. package/build/cjs/index.js +13 -0
  4. package/build/cjs/package.json +3 -0
  5. package/build/commands/browser/$$.d.ts +10 -1
  6. package/build/commands/browser/$$.d.ts.map +1 -1
  7. package/build/commands/browser/$$.js +16 -9
  8. package/build/commands/browser/$.js +8 -11
  9. package/build/commands/browser/action.d.ts +132 -0
  10. package/build/commands/browser/action.d.ts.map +1 -0
  11. package/build/commands/browser/action.js +13 -0
  12. package/build/commands/browser/actions.d.ts +29 -0
  13. package/build/commands/browser/actions.d.ts.map +1 -0
  14. package/build/commands/browser/actions.js +30 -0
  15. package/build/commands/browser/addCommand.d.ts +1 -1
  16. package/build/commands/browser/addCommand.js +1 -1
  17. package/build/commands/browser/call.d.ts +7 -5
  18. package/build/commands/browser/call.d.ts.map +1 -1
  19. package/build/commands/browser/call.js +8 -9
  20. package/build/commands/browser/custom$$.js +7 -10
  21. package/build/commands/browser/custom$.d.ts +1 -1
  22. package/build/commands/browser/custom$.js +6 -9
  23. package/build/commands/browser/debug.js +8 -14
  24. package/build/commands/browser/deleteCookies.d.ts +3 -3
  25. package/build/commands/browser/deleteCookies.js +4 -7
  26. package/build/commands/browser/execute.d.ts +2 -2
  27. package/build/commands/browser/execute.js +5 -8
  28. package/build/commands/browser/executeAsync.js +3 -6
  29. package/build/commands/browser/getCookies.d.ts +2 -2
  30. package/build/commands/browser/getCookies.js +3 -6
  31. package/build/commands/browser/getPuppeteer.d.ts +1 -1
  32. package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
  33. package/build/commands/browser/getPuppeteer.js +14 -21
  34. package/build/commands/browser/getWindowSize.js +3 -6
  35. package/build/commands/browser/keys.d.ts +20 -10
  36. package/build/commands/browser/keys.d.ts.map +1 -1
  37. package/build/commands/browser/keys.js +29 -24
  38. package/build/commands/browser/mock.d.ts +5 -4
  39. package/build/commands/browser/mock.d.ts.map +1 -1
  40. package/build/commands/browser/mock.js +16 -22
  41. package/build/commands/browser/mockClearAll.js +5 -11
  42. package/build/commands/browser/mockRestoreAll.js +5 -11
  43. package/build/commands/browser/newWindow.js +5 -11
  44. package/build/commands/browser/pause.js +1 -4
  45. package/build/commands/browser/react$$.d.ts.map +1 -1
  46. package/build/commands/browser/react$$.js +16 -17
  47. package/build/commands/browser/react$.d.ts.map +1 -1
  48. package/build/commands/browser/react$.js +13 -14
  49. package/build/commands/browser/reloadSession.js +5 -12
  50. package/build/commands/browser/savePDF.d.ts +14 -14
  51. package/build/commands/browser/savePDF.js +21 -27
  52. package/build/commands/browser/saveRecordingScreen.js +6 -12
  53. package/build/commands/browser/saveScreenshot.js +6 -12
  54. package/build/commands/browser/scroll.d.ts +25 -0
  55. package/build/commands/browser/scroll.d.ts.map +1 -0
  56. package/build/commands/browser/scroll.js +41 -0
  57. package/build/commands/browser/setCookies.d.ts +1 -1
  58. package/build/commands/browser/setCookies.d.ts.map +1 -1
  59. package/build/commands/browser/setCookies.js +5 -7
  60. package/build/commands/browser/setTimeout.js +1 -4
  61. package/build/commands/browser/setWindowSize.js +3 -6
  62. package/build/commands/browser/switchWindow.js +1 -4
  63. package/build/commands/browser/throttle.js +3 -6
  64. package/build/commands/browser/touchAction.d.ts +1 -1
  65. package/build/commands/browser/touchAction.d.ts.map +1 -1
  66. package/build/commands/browser/touchAction.js +3 -6
  67. package/build/commands/browser/uploadFile.d.ts +1 -1
  68. package/build/commands/browser/uploadFile.d.ts.map +1 -1
  69. package/build/commands/browser/uploadFile.js +10 -15
  70. package/build/commands/browser/url.js +3 -6
  71. package/build/commands/browser/waitUntil.d.ts +1 -2
  72. package/build/commands/browser/waitUntil.d.ts.map +1 -1
  73. package/build/commands/browser/waitUntil.js +4 -11
  74. package/build/commands/browser.d.ts +37 -69
  75. package/build/commands/browser.d.ts.map +1 -1
  76. package/build/commands/browser.js +37 -44
  77. package/build/commands/constant.d.ts +1 -1
  78. package/build/commands/constant.d.ts.map +1 -1
  79. package/build/commands/constant.js +6 -12
  80. package/build/commands/element/$$.d.ts +1 -1
  81. package/build/commands/element/$$.d.ts.map +1 -1
  82. package/build/commands/element/$$.js +2 -7
  83. package/build/commands/element/$.d.ts +1 -1
  84. package/build/commands/element/$.d.ts.map +1 -1
  85. package/build/commands/element/$.js +2 -7
  86. package/build/commands/element/addValue.d.ts +10 -14
  87. package/build/commands/element/addValue.d.ts.map +1 -1
  88. package/build/commands/element/addValue.js +23 -27
  89. package/build/commands/element/clearValue.d.ts +1 -1
  90. package/build/commands/element/clearValue.js +2 -5
  91. package/build/commands/element/click.d.ts +1 -1
  92. package/build/commands/element/click.d.ts.map +1 -1
  93. package/build/commands/element/click.js +19 -34
  94. package/build/commands/element/custom$$.js +9 -11
  95. package/build/commands/element/custom$.js +8 -10
  96. package/build/commands/element/doubleClick.d.ts.map +1 -1
  97. package/build/commands/element/doubleClick.js +11 -17
  98. package/build/commands/element/dragAndDrop.d.ts.map +1 -1
  99. package/build/commands/element/dragAndDrop.js +13 -19
  100. package/build/commands/element/getAttribute.js +1 -4
  101. package/build/commands/element/getCSSProperty.d.ts +1 -1
  102. package/build/commands/element/getCSSProperty.d.ts.map +1 -1
  103. package/build/commands/element/getCSSProperty.js +7 -13
  104. package/build/commands/element/getComputedLabel.js +1 -4
  105. package/build/commands/element/getComputedRole.js +1 -4
  106. package/build/commands/element/getHTML.js +7 -13
  107. package/build/commands/element/getLocation.js +3 -5
  108. package/build/commands/element/getProperty.d.ts +5 -5
  109. package/build/commands/element/getProperty.d.ts.map +1 -1
  110. package/build/commands/element/getProperty.js +5 -11
  111. package/build/commands/element/getSize.js +3 -5
  112. package/build/commands/element/getTagName.js +1 -4
  113. package/build/commands/element/getText.js +1 -4
  114. package/build/commands/element/getValue.js +1 -4
  115. package/build/commands/element/isClickable.d.ts.map +1 -1
  116. package/build/commands/element/isClickable.js +10 -13
  117. package/build/commands/element/isDisplayed.js +9 -16
  118. package/build/commands/element/isDisplayedInViewport.js +7 -13
  119. package/build/commands/element/isEnabled.js +1 -4
  120. package/build/commands/element/isEqual.d.ts.map +1 -1
  121. package/build/commands/element/isEqual.js +9 -9
  122. package/build/commands/element/isExisting.js +1 -4
  123. package/build/commands/element/isFocused.js +7 -13
  124. package/build/commands/element/isSelected.js +1 -4
  125. package/build/commands/element/moveTo.d.ts.map +1 -1
  126. package/build/commands/element/moveTo.js +8 -13
  127. package/build/commands/element/nextElement.js +2 -5
  128. package/build/commands/element/parentElement.js +2 -5
  129. package/build/commands/element/previousElement.js +2 -5
  130. package/build/commands/element/react$$.d.ts.map +1 -1
  131. package/build/commands/element/react$$.js +16 -16
  132. package/build/commands/element/react$.d.ts.map +1 -1
  133. package/build/commands/element/react$.js +15 -14
  134. package/build/commands/element/saveScreenshot.js +6 -12
  135. package/build/commands/element/scrollIntoView.d.ts +4 -2
  136. package/build/commands/element/scrollIntoView.d.ts.map +1 -1
  137. package/build/commands/element/scrollIntoView.js +33 -12
  138. package/build/commands/element/selectByAttribute.js +3 -6
  139. package/build/commands/element/selectByIndex.js +3 -6
  140. package/build/commands/element/selectByVisibleText.js +3 -6
  141. package/build/commands/element/setValue.d.ts +13 -14
  142. package/build/commands/element/setValue.d.ts.map +1 -1
  143. package/build/commands/element/setValue.js +14 -17
  144. package/build/commands/element/shadow$$.d.ts +1 -1
  145. package/build/commands/element/shadow$$.d.ts.map +1 -1
  146. package/build/commands/element/shadow$$.js +3 -6
  147. package/build/commands/element/shadow$.js +3 -6
  148. package/build/commands/element/touchAction.js +3 -6
  149. package/build/commands/element/waitForClickable.js +1 -4
  150. package/build/commands/element/waitForDisplayed.js +1 -4
  151. package/build/commands/element/waitForEnabled.js +1 -4
  152. package/build/commands/element/waitForExist.js +1 -4
  153. package/build/commands/element/waitUntil.d.ts +2 -3
  154. package/build/commands/element/waitUntil.d.ts.map +1 -1
  155. package/build/commands/element/waitUntil.js +3 -9
  156. package/build/commands/element.d.ts +49 -99
  157. package/build/commands/element.d.ts.map +1 -1
  158. package/build/commands/element.js +49 -63
  159. package/build/constants.d.ts +67 -0
  160. package/build/constants.d.ts.map +1 -1
  161. package/build/constants.js +105 -12
  162. package/build/index.d.ts +65 -6
  163. package/build/index.d.ts.map +1 -1
  164. package/build/index.js +48 -86
  165. package/build/middlewares.d.ts +1 -1
  166. package/build/middlewares.js +11 -19
  167. package/build/multiremote.js +18 -24
  168. package/build/protocol-stub.d.ts.map +1 -1
  169. package/build/protocol-stub.js +4 -6
  170. package/build/scripts/getHTML.js +1 -4
  171. package/build/scripts/getProperty.d.ts +5 -5
  172. package/build/scripts/getProperty.d.ts.map +1 -1
  173. package/build/scripts/getProperty.js +1 -4
  174. package/build/scripts/isElementClickable.js +1 -4
  175. package/build/scripts/isElementDisplayed.js +2 -5
  176. package/build/scripts/isElementInViewport.js +1 -4
  177. package/build/scripts/isFocused.js +1 -4
  178. package/build/scripts/newWindow.js +1 -4
  179. package/build/scripts/resq.js +3 -9
  180. package/build/scripts/shadowFnFactory.js +2 -6
  181. package/build/types.d.ts +5 -9
  182. package/build/types.d.ts.map +1 -1
  183. package/build/types.js +1 -2
  184. package/build/utils/SevereServiceError.js +1 -4
  185. package/build/utils/Timer.d.ts.map +1 -1
  186. package/build/utils/Timer.js +13 -29
  187. package/build/utils/actions/base.d.ts +32 -0
  188. package/build/utils/actions/base.d.ts.map +1 -0
  189. package/build/utils/actions/base.js +66 -0
  190. package/build/utils/actions/index.d.ts +6 -0
  191. package/build/utils/actions/index.d.ts.map +1 -0
  192. package/build/utils/actions/index.js +5 -0
  193. package/build/utils/actions/key.d.ts +15 -0
  194. package/build/utils/actions/key.d.ts.map +1 -0
  195. package/build/utils/actions/key.js +22 -0
  196. package/build/utils/actions/pointer.d.ts +62 -0
  197. package/build/utils/actions/pointer.d.ts.map +1 -0
  198. package/build/utils/actions/pointer.js +76 -0
  199. package/build/utils/actions/wheel.d.ts +36 -0
  200. package/build/utils/actions/wheel.d.ts.map +1 -0
  201. package/build/utils/actions/wheel.js +20 -0
  202. package/build/utils/detectBackend.d.ts +1 -1
  203. package/build/utils/detectBackend.d.ts.map +1 -1
  204. package/build/utils/detectBackend.js +3 -7
  205. package/build/utils/findStrategy.d.ts.map +1 -1
  206. package/build/utils/findStrategy.js +50 -19
  207. package/build/utils/getElementObject.d.ts +1 -1
  208. package/build/utils/getElementObject.d.ts.map +1 -1
  209. package/build/utils/getElementObject.js +51 -32
  210. package/build/utils/implicitWait.js +3 -9
  211. package/build/utils/index.d.ts +8 -7
  212. package/build/utils/index.d.ts.map +1 -1
  213. package/build/utils/index.js +125 -148
  214. package/build/utils/interception/devtools.d.ts +1 -1
  215. package/build/utils/interception/devtools.d.ts.map +1 -1
  216. package/build/utils/interception/devtools.js +17 -36
  217. package/build/utils/interception/index.d.ts +2 -2
  218. package/build/utils/interception/index.d.ts.map +1 -1
  219. package/build/utils/interception/index.js +10 -13
  220. package/build/utils/interception/types.d.ts +1 -1
  221. package/build/utils/interception/types.d.ts.map +1 -1
  222. package/build/utils/interception/types.js +1 -2
  223. package/build/utils/interception/webdriver.d.ts +1 -1
  224. package/build/utils/interception/webdriver.d.ts.map +1 -1
  225. package/build/utils/interception/webdriver.js +6 -11
  226. package/build/utils/refetchElement.js +3 -9
  227. package/package.json +27 -17
  228. package/async.d.ts +0 -24
  229. package/sync.d.ts +0 -24
@@ -1,6 +1,4 @@
1
- "use strict";
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.
@@ -27,8 +25,8 @@ const utils_1 = require("../../utils");
27
25
  });
28
26
  * </example>
29
27
  *
30
- * @param {String|Function} script The script to execute.
31
- * @param {*=} arguments script arguments
28
+ * @param {String|Function} script The script to execute.
29
+ * @param {*=} arguments script arguments
32
30
  *
33
31
  * @return {*} The script result.
34
32
  *
@@ -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, (0, utils_1.verifyArgsAndStripIfElement)(args));
51
+ return this.executeScript(script, verifyArgsAndStripIfElement(args));
54
52
  }
55
- exports.default = execute;
@@ -1,6 +1,4 @@
1
- "use strict";
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, (0, utils_1.verifyArgsAndStripIfElement)(args));
59
+ return this.executeAsyncScript(script, verifyArgsAndStripIfElement(args));
62
60
  }
63
- exports.default = executeAsync;
@@ -25,8 +25,8 @@
25
25
  * </example>
26
26
  *
27
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
28
+ * @param {String[]|String} names names of requested cookies (if omitted, all cookies will be returned)
29
+ * @return {WebDriverCookie[]} requested cookies if existing
30
30
  * @uses webdriver/getAllCookies
31
31
  *
32
32
  */
@@ -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)
@@ -27,12 +25,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
27
25
  * </example>
28
26
  *
29
27
  * @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
28
+ * @param {String[]|String} names names of requested cookies (if omitted, all cookies will be returned)
29
+ * @return {WebDriverCookie[]} requested cookies if existing
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/api/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":"AAGA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iDAAiD,CAAA;AAM7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAA8B,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,6BAiFpE"}
1
+ {"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iDAAiD,CAAA;AAO7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAA8B,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,6BAiFpE"}
@@ -1,12 +1,7 @@
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 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 ((_a = this.puppeteer) === null || _a === void 0 ? void 0 : _a.isConnected()) {
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 puppeteer_core_1.default.connect({
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 = ((_b = this.requestedCapabilities) === null || _b === void 0 ? void 0 : _b.alwaysMatch) || this.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 puppeteer_core_1.default.connect({
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 puppeteer_core_1.default.connect({
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 (((_c = caps.browserName) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'firefox') {
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 = (_d = reqCaps['moz:firefoxOptions']) === null || _d === void 0 ? void 0 : _d.args;
96
+ const ffArgs = reqCaps['moz:firefoxOptions']?.args;
103
97
  const rdPort = ffOptions && ffOptions.debuggerAddress
104
98
  ? ffOptions.debuggerAddress
105
- : (_e = ffArgs === null || ffArgs === void 0 ? void 0 : ffArgs[ffArgs.findIndex((arg) => arg === constants_1.FF_REMOTE_DEBUG_ARG) + 1]) !== null && _e !== void 0 ? _e : null;
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 puppeteer_core_1.default.connect({
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;
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../utils");
1
+ import { getBrowserObject } from '../../utils/index.js';
4
2
  /**
5
3
  *
6
4
  * Returns browser window size.
@@ -19,12 +17,11 @@ const utils_1 = require("../../utils");
19
17
  * @type window
20
18
  *
21
19
  */
22
- async function getWindowSize() {
23
- const browser = (0, utils_1.getBrowserObject)(this);
20
+ export default async function getWindowSize() {
21
+ const browser = getBrowserObject(this);
24
22
  if (!browser.isW3C) {
25
23
  return browser._getWindowSize();
26
24
  }
27
25
  const { width, height } = await browser.getWindowRect();
28
26
  return { width, height };
29
27
  }
30
- exports.default = getWindowSize;
@@ -1,22 +1,32 @@
1
1
  /**
2
2
  *
3
- * Send a sequence of key strokes to the active element. You can also use characters like
4
- * "Left arrow" or "Back space". WebdriverIO will take care of translating them into unicode
5
- * characters. You’ll find all supported characters [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
6
- * To do that, the value has to correspond to a key from the table.
3
+ * Send a sequence of key strokes to the "active" element. You can make an input element active by just clicking
4
+ * on it. To use characters like "Left arrow" or "Back space", import the `Key` object from the WebdriverIO package.
7
5
  *
8
- * Modifier like Ctrl, Shift, Alt and Meta will stay pressed so you need to trigger them again to release them.
9
- * Modifiying a click however requires you to use the WebDriver Actions API through the [performActions](https://webdriver.io/docs/api/webdriver#performactions) method.
6
+ * Modifier like `Control`, `Shift`, `Alt` and `Command` will stay pressed so you need to trigger them again to release
7
+ * them. Modifiying a click however requires you to use the WebDriver Actions API through the
8
+ * [performActions](https://webdriver.io/docs/api/webdriver#performactions) method.
9
+ *
10
+ * :::info
11
+ *
12
+ * Control keys differ based on the operating system the browser is running on, e.g. MacOS: `Command` and Windows: `Control`.
13
+ * WebdriverIO provides a cross browser modifier control key called `Ctrl` (see example below).
14
+ *
15
+ * :::
10
16
  *
11
17
  * <example>
12
18
  :keys.js
19
+ import { Key } from 'webdriverio'
20
+
13
21
  it('copies text out of active element', async () => {
22
+ await $('#username').setValue('anonymous')
23
+
14
24
  // copies text from an input element
15
- const input = await $('#username')
16
- await input.setValue('anonymous')
25
+ await browser.keys([Key.Ctrl, 'a', 'c])
17
26
 
18
- await browser.keys(['Meta', 'a'])
19
- await browser.keys(['Meta', 'c'])
27
+ // inserts text from clipboard into input element
28
+ await $('#username').click() // make input active element
29
+ await browser.keys([Key.Ctrl, 'v'])
20
30
  });
21
31
  * </example>
22
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/keys.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CACxB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,iBAoC3B"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/keys.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CACxB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,iBAiC3B"}
@@ -1,25 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../utils");
1
+ import { checkUnicode } from '../../utils/index.js';
4
2
  /**
5
3
  *
6
- * Send a sequence of key strokes to the active element. You can also use characters like
7
- * "Left arrow" or "Back space". WebdriverIO will take care of translating them into unicode
8
- * characters. You’ll find all supported characters [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
9
- * To do that, the value has to correspond to a key from the table.
4
+ * Send a sequence of key strokes to the "active" element. You can make an input element active by just clicking
5
+ * on it. To use characters like "Left arrow" or "Back space", import the `Key` object from the WebdriverIO package.
10
6
  *
11
- * Modifier like Ctrl, Shift, Alt and Meta will stay pressed so you need to trigger them again to release them.
12
- * Modifiying a click however requires you to use the WebDriver Actions API through the [performActions](https://webdriver.io/docs/api/webdriver#performactions) method.
7
+ * Modifier like `Control`, `Shift`, `Alt` and `Command` will stay pressed so you need to trigger them again to release
8
+ * them. Modifiying a click however requires you to use the WebDriver Actions API through the
9
+ * [performActions](https://webdriver.io/docs/api/webdriver#performactions) method.
10
+ *
11
+ * :::info
12
+ *
13
+ * Control keys differ based on the operating system the browser is running on, e.g. MacOS: `Command` and Windows: `Control`.
14
+ * WebdriverIO provides a cross browser modifier control key called `Ctrl` (see example below).
15
+ *
16
+ * :::
13
17
  *
14
18
  * <example>
15
19
  :keys.js
20
+ import { Key } from 'webdriverio'
21
+
16
22
  it('copies text out of active element', async () => {
23
+ await $('#username').setValue('anonymous')
24
+
17
25
  // copies text from an input element
18
- const input = await $('#username')
19
- await input.setValue('anonymous')
26
+ await browser.keys([Key.Ctrl, 'a', 'c])
20
27
 
21
- await browser.keys(['Meta', 'a'])
22
- await browser.keys(['Meta', 'c'])
28
+ // inserts text from clipboard into input element
29
+ await $('#username').click() // make input active element
30
+ await browser.keys([Key.Ctrl, 'v'])
23
31
  });
24
32
  * </example>
25
33
  *
@@ -27,18 +35,19 @@ const utils_1 = require("../../utils");
27
35
  * @see https://w3c.github.io/webdriver/#dispatching-actions
28
36
  *
29
37
  */
30
- function keys(value) {
38
+ export default function keys(value) {
31
39
  let keySequence = [];
40
+ const platformName = this.capabilities.platformName;
32
41
  /**
33
42
  * replace key with corresponding unicode character
34
43
  */
35
44
  if (typeof value === 'string') {
36
- keySequence = (0, utils_1.checkUnicode)(value, this.isDevTools);
45
+ keySequence = checkUnicode(value, this.isDevTools, platformName);
37
46
  }
38
47
  else if (Array.isArray(value)) {
39
48
  const charArray = value;
40
49
  for (const charSet of charArray) {
41
- keySequence = keySequence.concat((0, utils_1.checkUnicode)(charSet, this.isDevTools));
50
+ keySequence = keySequence.concat(checkUnicode(charSet, this.isDevTools, platformName));
42
51
  }
43
52
  }
44
53
  else {
@@ -53,12 +62,8 @@ function keys(value) {
53
62
  /**
54
63
  * W3C way of handle it key actions
55
64
  */
56
- const keyDownActions = keySequence.map((value) => ({ type: 'keyDown', value }));
57
- const keyUpActions = keySequence.map((value) => ({ type: 'keyUp', value }));
58
- return this.performActions([{
59
- type: 'key',
60
- id: 'keyboard',
61
- actions: [...keyDownActions, ...keyUpActions]
62
- }]).then(() => this.releaseActions());
65
+ const keyAction = this.action('key');
66
+ keySequence.forEach((value) => keyAction.down(value));
67
+ keySequence.forEach((value) => keyAction.up(value));
68
+ return keyAction.perform();
63
69
  }
64
- exports.default = keys;
@@ -1,4 +1,4 @@
1
- import type Interception from '../../utils/interception/index';
1
+ import type Interception from '../../utils/interception/index.js';
2
2
  import type { Mock } from '../../types';
3
3
  import type { MockFilterOptions } from '../../utils/interception/types';
4
4
  export declare const SESSION_MOCKS: Record<string, Set<Interception>>;
@@ -18,9 +18,10 @@ export declare const SESSION_MOCKS: Record<string, Set<Interception>>;
18
18
  *
19
19
  * :::info
20
20
  *
21
- * Note that using the `mock` command requires support for Chrome DevTools protocol and e.g.
22
- * can not be used when running automated tests in the cloud. Find out more in the
23
- * [Automation Protocols](/docs/automationProtocols) section.
21
+ * Note that using the `mock` command requires support for Chrome DevTools protocol.
22
+ * That support is given if you run tests locally in Chromium based browser or if
23
+ * you use a Selenium Grid v4 or higher. This command can __not__ be used when running
24
+ * automated tests in the cloud. Find out more in the [Automation Protocols](/docs/automationProtocols) section.
24
25
  *
25
26
  * :::
26
27
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAA;AAI9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAM,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGG;AACH,wBAA8B,IAAI,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,aAAa,CAAC,EAAE,iBAAiB,iBA6DpC"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mCAAmC,CAAA;AAIjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAM,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,wBAA8B,IAAI,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,aAAa,CAAC,EAAE,iBAAiB,iBA6DpC"}
@@ -1,13 +1,7 @@
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
- exports.SESSION_MOCKS = void 0;
7
- const devtools_1 = __importDefault(require("../../utils/interception/devtools"));
8
- const webdriver_1 = __importDefault(require("../../utils/interception/webdriver"));
9
- const utils_1 = require("../../utils");
10
- exports.SESSION_MOCKS = {};
1
+ import DevtoolsNetworkInterception from '../../utils/interception/devtools.js';
2
+ import WebDriverNetworkInterception from '../../utils/interception/webdriver.js';
3
+ import { getBrowserObject } from '../../utils/index.js';
4
+ export const SESSION_MOCKS = {};
11
5
  /**
12
6
  * Mock the response of a request. You can define a mock based on a matching
13
7
  * glob and corresponding header and status code. Calling the mock method
@@ -24,9 +18,10 @@ exports.SESSION_MOCKS = {};
24
18
  *
25
19
  * :::info
26
20
  *
27
- * Note that using the `mock` command requires support for Chrome DevTools protocol and e.g.
28
- * can not be used when running automated tests in the cloud. Find out more in the
29
- * [Automation Protocols](/docs/automationProtocols) section.
21
+ * Note that using the `mock` command requires support for Chrome DevTools protocol.
22
+ * That support is given if you run tests locally in Chromium based browser or if
23
+ * you use a Selenium Grid v4 or higher. This command can __not__ be used when running
24
+ * automated tests in the cloud. Find out more in the [Automation Protocols](/docs/automationProtocols) section.
30
25
  *
31
26
  * :::
32
27
  *
@@ -113,23 +108,23 @@ exports.SESSION_MOCKS = {};
113
108
  * @type utility
114
109
  *
115
110
  */
116
- async function mock(url, filterOptions) {
117
- const NetworkInterception = this.isSauce ? webdriver_1.default : devtools_1.default;
111
+ export default async function mock(url, filterOptions) {
112
+ const NetworkInterception = this.isSauce ? WebDriverNetworkInterception : DevtoolsNetworkInterception;
118
113
  if (!this.isSauce) {
119
114
  await this.getPuppeteer();
120
115
  }
121
116
  if (!this.puppeteer) {
122
117
  throw new Error('No Puppeteer connection could be established which is required to use this command');
123
118
  }
124
- const browser = (0, utils_1.getBrowserObject)(this);
119
+ const browser = getBrowserObject(this);
125
120
  const handle = await browser.getWindowHandle();
126
- if (!exports.SESSION_MOCKS[handle]) {
127
- exports.SESSION_MOCKS[handle] = new Set();
121
+ if (!SESSION_MOCKS[handle]) {
122
+ SESSION_MOCKS[handle] = new Set();
128
123
  }
129
124
  /**
130
125
  * enable network Mocking if not already
131
126
  */
132
- if (exports.SESSION_MOCKS[handle].size === 0 && !this.isSauce) {
127
+ if (SESSION_MOCKS[handle].size === 0 && !this.isSauce) {
133
128
  const pages = await this.puppeteer.pages();
134
129
  /**
135
130
  * get active page
@@ -152,13 +147,12 @@ async function mock(url, filterOptions) {
152
147
  patterns: [{ requestStage: 'Request' }, { requestStage: 'Response' }]
153
148
  });
154
149
  client.on('Fetch.requestPaused', NetworkInterception
155
- .handleRequestInterception(client, exports.SESSION_MOCKS[handle]));
150
+ .handleRequestInterception(client, SESSION_MOCKS[handle]));
156
151
  }
157
152
  const networkInterception = new NetworkInterception(url, filterOptions, browser);
158
- exports.SESSION_MOCKS[handle].add(networkInterception);
153
+ SESSION_MOCKS[handle].add(networkInterception);
159
154
  if (this.isSauce) {
160
155
  await networkInterception.init();
161
156
  }
162
157
  return networkInterception;
163
158
  }
164
- exports.default = mock;
@@ -1,11 +1,6 @@
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 logger_1 = __importDefault(require("@wdio/logger"));
7
- const mock_1 = require("./mock");
8
- const log = (0, logger_1.default)('webdriverio:mockClearAll');
1
+ import logger from '@wdio/logger';
2
+ import { SESSION_MOCKS } from './mock.js';
3
+ const log = logger('webdriverio:mockClearAll');
9
4
  /**
10
5
  * Resets all information stored in all registered mocks of the session.
11
6
  *
@@ -32,12 +27,11 @@ const log = (0, logger_1.default)('webdriverio:mockClearAll');
32
27
  *
33
28
  * @alias browser.mockClearAll
34
29
  */
35
- async function mockClearAll() {
36
- for (const [handle, mocks] of Object.entries(mock_1.SESSION_MOCKS)) {
30
+ export default async function mockClearAll() {
31
+ for (const [handle, mocks] of Object.entries(SESSION_MOCKS)) {
37
32
  log.trace(`Clearing mocks for ${handle}`);
38
33
  for (const mock of mocks) {
39
34
  mock.clear();
40
35
  }
41
36
  }
42
37
  }
43
- exports.default = mockClearAll;
@@ -1,11 +1,6 @@
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 logger_1 = __importDefault(require("@wdio/logger"));
7
- const mock_1 = require("./mock");
8
- const log = (0, logger_1.default)('webdriverio:mockRestoreAll');
1
+ import logger from '@wdio/logger';
2
+ import { SESSION_MOCKS } from './mock.js';
3
+ const log = logger('webdriverio:mockRestoreAll');
9
4
  /**
10
5
  * Restores all mock information and behavior stored in all registered
11
6
  * mocks of the session.
@@ -30,12 +25,11 @@ const log = (0, logger_1.default)('webdriverio:mockRestoreAll');
30
25
  *
31
26
  * @alias browser.mockRestoreAll
32
27
  */
33
- async function mockRestoreAll() {
34
- for (const [handle, mocks] of Object.entries(mock_1.SESSION_MOCKS)) {
28
+ export default async function mockRestoreAll() {
29
+ for (const [handle, mocks] of Object.entries(SESSION_MOCKS)) {
35
30
  log.trace(`Clearing mocks for ${handle}`);
36
31
  for (const mock of mocks) {
37
32
  mock.restore();
38
33
  }
39
34
  }
40
35
  }
41
- exports.default = mockRestoreAll;
@@ -1,10 +1,5 @@
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 utils_1 = require("@wdio/utils");
7
- const newWindow_1 = __importDefault(require("../../scripts/newWindow"));
1
+ import { sleep } from '@wdio/utils';
2
+ import newWindowHelper from '../../scripts/newWindow.js';
8
3
  const WAIT_FOR_NEW_HANDLE_TIMEOUT = 3000;
9
4
  /**
10
5
  *
@@ -44,7 +39,7 @@ const WAIT_FOR_NEW_HANDLE_TIMEOUT = 3000;
44
39
  * @alias browser.newWindow
45
40
  * @type window
46
41
  */
47
- async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
42
+ export default async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
48
43
  /**
49
44
  * parameter check
50
45
  */
@@ -58,7 +53,7 @@ async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
58
53
  throw new Error('newWindow command is not supported on mobile platforms');
59
54
  }
60
55
  const tabsBefore = await this.getWindowHandles();
61
- await this.execute(newWindow_1.default, url, windowName, windowFeatures);
56
+ await this.execute(newWindowHelper, url, windowName, windowFeatures);
62
57
  /**
63
58
  * if tests are run in DevTools there might be a delay until
64
59
  * a new window handle got registered, this little procedure
@@ -71,7 +66,7 @@ async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
71
66
  if (tabsAfter.length > tabsBefore.length) {
72
67
  break;
73
68
  }
74
- await (0, utils_1.sleep)(100);
69
+ await sleep(100);
75
70
  }
76
71
  const newTab = tabsAfter.pop();
77
72
  if (!newTab) {
@@ -80,4 +75,3 @@ async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
80
75
  await this.switchToWindow(newTab);
81
76
  return newTab;
82
77
  }
83
- exports.default = newWindow;
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  /**
4
2
  *
5
3
  * Pauses execution for a specific amount of time. It is recommended to not use this command to wait for an
@@ -21,7 +19,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
19
  * @type utility
22
20
  *
23
21
  */
24
- function pause(milliseconds = 1000) {
22
+ export default function pause(milliseconds = 1000) {
25
23
  return new Promise((resolve) => setTimeout(resolve, milliseconds));
26
24
  }
27
- exports.default = pause;
@@ -1 +1 @@
1
- {"version":3,"file":"react$$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/react$$.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,KAAU,EAAE,KAAU,EAAE,GAAE,oBAAyB,yBAUxD"}
1
+ {"version":3,"file":"react$$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/react$$.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,KAAU,EAAE,KAAU,EAAE,GAAE,oBAAyB,yBAexD"}