webdriverio 9.0.0-alpha.78 → 9.0.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.
Files changed (288) hide show
  1. package/build/clock.d.ts +79 -0
  2. package/build/clock.d.ts.map +1 -0
  3. package/build/commands/browser/$.d.ts.map +1 -1
  4. package/build/commands/browser/addInitScript.d.ts +86 -0
  5. package/build/commands/browser/addInitScript.d.ts.map +1 -0
  6. package/build/commands/browser/downloadFile.d.ts +34 -0
  7. package/build/commands/browser/downloadFile.d.ts.map +1 -0
  8. package/build/commands/browser/emulate.d.ts +11 -28
  9. package/build/commands/browser/emulate.d.ts.map +1 -1
  10. package/build/commands/browser/execute.d.ts.map +1 -1
  11. package/build/commands/browser/executeAsync.d.ts.map +1 -1
  12. package/build/commands/browser/getCookies.d.ts +2 -1
  13. package/build/commands/browser/getCookies.d.ts.map +1 -1
  14. package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
  15. package/build/commands/browser/mock.d.ts +2 -2
  16. package/build/commands/browser/mock.d.ts.map +1 -1
  17. package/build/commands/browser/reloadSession.d.ts +20 -0
  18. package/build/commands/browser/reloadSession.d.ts.map +1 -1
  19. package/build/commands/browser/restore.d.ts +33 -0
  20. package/build/commands/browser/restore.d.ts.map +1 -0
  21. package/build/commands/browser/savePDF.d.ts +0 -1
  22. package/build/commands/browser/savePDF.d.ts.map +1 -1
  23. package/build/commands/browser/saveRecordingScreen.d.ts +0 -1
  24. package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -1
  25. package/build/commands/browser/saveScreenshot.d.ts +0 -1
  26. package/build/commands/browser/saveScreenshot.d.ts.map +1 -1
  27. package/build/commands/browser/setViewport.d.ts +30 -0
  28. package/build/commands/browser/setViewport.d.ts.map +1 -0
  29. package/build/commands/browser/setWindowSize.d.ts +3 -1
  30. package/build/commands/browser/setWindowSize.d.ts.map +1 -1
  31. package/build/commands/browser/url.d.ts +119 -8
  32. package/build/commands/browser/url.d.ts.map +1 -1
  33. package/build/commands/browser.d.ts +4 -0
  34. package/build/commands/browser.d.ts.map +1 -1
  35. package/build/commands/clock/restore.d.ts +20 -0
  36. package/build/commands/clock/restore.d.ts.map +1 -0
  37. package/build/commands/clock/setSystemTime.d.ts +19 -0
  38. package/build/commands/clock/setSystemTime.d.ts.map +1 -0
  39. package/build/commands/clock/tick.d.ts +18 -0
  40. package/build/commands/clock/tick.d.ts.map +1 -0
  41. package/build/commands/constant.d.ts.map +1 -1
  42. package/build/commands/dialog/accept.d.ts +14 -0
  43. package/build/commands/dialog/accept.d.ts.map +1 -0
  44. package/build/commands/dialog/defaultValue.d.ts +12 -0
  45. package/build/commands/dialog/defaultValue.d.ts.map +1 -0
  46. package/build/commands/dialog/dismiss.d.ts +12 -0
  47. package/build/commands/dialog/dismiss.d.ts.map +1 -0
  48. package/build/commands/dialog/message.d.ts +13 -0
  49. package/build/commands/dialog/message.d.ts.map +1 -0
  50. package/build/commands/dialog/type.d.ts +13 -0
  51. package/build/commands/dialog/type.d.ts.map +1 -0
  52. package/build/commands/element/$$.d.ts +9 -0
  53. package/build/commands/element/$$.d.ts.map +1 -1
  54. package/build/commands/element/$.d.ts +9 -0
  55. package/build/commands/element/$.d.ts.map +1 -1
  56. package/build/commands/element/dragAndDrop.d.ts +2 -1
  57. package/build/commands/element/dragAndDrop.d.ts.map +1 -1
  58. package/build/commands/element/execute.d.ts +1 -1
  59. package/build/commands/element/execute.d.ts.map +1 -1
  60. package/build/commands/element/executeAsync.d.ts +1 -1
  61. package/build/commands/element/executeAsync.d.ts.map +1 -1
  62. package/build/commands/element/getElement.d.ts +20 -0
  63. package/build/commands/element/getElement.d.ts.map +1 -0
  64. package/build/commands/element/getElements.d.ts +20 -0
  65. package/build/commands/element/getElements.d.ts.map +1 -0
  66. package/build/commands/element/getHTML.d.ts.map +1 -1
  67. package/build/commands/element/getSize.d.ts.map +1 -1
  68. package/build/commands/element/isExisting.d.ts.map +1 -1
  69. package/build/commands/element/nextElement.d.ts +1 -1
  70. package/build/commands/element/nextElement.d.ts.map +1 -1
  71. package/build/commands/element/parentElement.d.ts +1 -1
  72. package/build/commands/element/parentElement.d.ts.map +1 -1
  73. package/build/commands/element/previousElement.d.ts +1 -1
  74. package/build/commands/element/previousElement.d.ts.map +1 -1
  75. package/build/commands/element/saveScreenshot.d.ts +0 -1
  76. package/build/commands/element/saveScreenshot.d.ts.map +1 -1
  77. package/build/commands/element/shadow$$.d.ts +9 -1
  78. package/build/commands/element/shadow$$.d.ts.map +1 -1
  79. package/build/commands/element/shadow$.d.ts +9 -1
  80. package/build/commands/element/shadow$.d.ts.map +1 -1
  81. package/build/commands/element.d.ts +4 -0
  82. package/build/commands/element.d.ts.map +1 -1
  83. package/build/commands/mock/redirect.d.ts +22 -0
  84. package/build/commands/mock/redirect.d.ts.map +1 -0
  85. package/build/commands/mock/request.d.ts +37 -0
  86. package/build/commands/mock/request.d.ts.map +1 -0
  87. package/build/commands/mock/requestOnce.d.ts +37 -0
  88. package/build/commands/mock/requestOnce.d.ts.map +1 -0
  89. package/build/commands/mock/restore.d.ts +1 -1
  90. package/build/constants.d.ts +7 -2
  91. package/build/constants.d.ts.map +1 -1
  92. package/build/deviceDescriptorsSource.d.ts +1344 -0
  93. package/build/deviceDescriptorsSource.d.ts.map +1 -0
  94. package/build/dialog.d.ts +29 -0
  95. package/build/dialog.d.ts.map +1 -0
  96. package/build/index.cjs +103 -0
  97. package/build/index.d.cts +2 -0
  98. package/build/index.d.cts.map +1 -0
  99. package/build/index.d.ts +6 -8
  100. package/build/index.d.ts.map +1 -1
  101. package/build/index.js +7002 -122
  102. package/build/middlewares.d.ts.map +1 -1
  103. package/build/multiremote.d.ts +1 -1
  104. package/build/multiremote.d.ts.map +1 -1
  105. package/build/networkManager.d.ts +22 -0
  106. package/build/networkManager.d.ts.map +1 -0
  107. package/build/protocol-stub.d.ts +2 -2
  108. package/build/protocol-stub.d.ts.map +1 -1
  109. package/build/scripts/customElement.d.ts.map +1 -1
  110. package/build/scripts/customElement.js +22 -14
  111. package/build/scripts/elementContains.d.ts +2 -0
  112. package/build/scripts/elementContains.d.ts.map +1 -0
  113. package/build/scripts/elementContains.js +20 -0
  114. package/build/scripts/getHTML.js +6 -9
  115. package/build/scripts/getHTMLShadow.d.ts +11 -8
  116. package/build/scripts/getHTMLShadow.d.ts.map +1 -1
  117. package/build/scripts/getHTMLShadow.js +22 -43
  118. package/build/scripts/getProperty.js +6 -8
  119. package/build/scripts/isDescendant.js +6 -2
  120. package/build/scripts/isElementClickable.js +93 -114
  121. package/build/scripts/isElementDisplayed.js +158 -218
  122. package/build/scripts/isElementInViewport.js +14 -18
  123. package/build/scripts/isElementStable.js +24 -28
  124. package/build/scripts/isFocused.js +6 -7
  125. package/build/scripts/newWindow.js +6 -10
  126. package/build/scripts/resq.d.ts.map +1 -1
  127. package/build/scripts/resq.js +41 -47
  128. package/build/scripts/shadowFnFactory.js +13 -7
  129. package/build/shadowRoot.d.ts +28 -13
  130. package/build/shadowRoot.d.ts.map +1 -1
  131. package/build/types.d.ts +98 -28
  132. package/build/types.d.ts.map +1 -1
  133. package/build/utils/actions/pointer.d.ts +3 -1
  134. package/build/utils/actions/pointer.d.ts.map +1 -1
  135. package/build/utils/actions/wheel.d.ts +1 -1
  136. package/build/utils/actions/wheel.d.ts.map +1 -1
  137. package/build/utils/bidi/constants.d.ts +66 -0
  138. package/build/utils/bidi/constants.d.ts.map +1 -0
  139. package/build/utils/bidi/index.d.ts +4 -0
  140. package/build/utils/bidi/index.d.ts.map +1 -0
  141. package/build/utils/bidi/value.d.ts +131 -0
  142. package/build/utils/bidi/value.d.ts.map +1 -0
  143. package/build/utils/detectBackend.d.ts +1 -1
  144. package/build/utils/detectBackend.d.ts.map +1 -1
  145. package/build/utils/driver.d.ts +5 -6
  146. package/build/utils/driver.d.ts.map +1 -1
  147. package/build/utils/getElementObject.d.ts +3 -3
  148. package/build/utils/getElementObject.d.ts.map +1 -1
  149. package/build/utils/index.d.ts +5 -11
  150. package/build/utils/index.d.ts.map +1 -1
  151. package/build/utils/interception/index.d.ts +19 -12
  152. package/build/utils/interception/index.d.ts.map +1 -1
  153. package/build/utils/interception/types.d.ts +0 -3
  154. package/build/utils/interception/types.d.ts.map +1 -1
  155. package/build/utils/interception/utils.d.ts +3 -8
  156. package/build/utils/interception/utils.d.ts.map +1 -1
  157. package/package.json +25 -20
  158. package/third_party/fake-timers.js +1846 -0
  159. package/build/cjs/index.d.ts +0 -2
  160. package/build/cjs/index.d.ts.map +0 -1
  161. package/build/cjs/index.js +0 -111
  162. package/build/cjs/package.json +0 -5
  163. package/build/commands/browser/$$.js +0 -99
  164. package/build/commands/browser/$.js +0 -100
  165. package/build/commands/browser/action.js +0 -13
  166. package/build/commands/browser/actions.js +0 -30
  167. package/build/commands/browser/addCommand.js +0 -37
  168. package/build/commands/browser/call.js +0 -48
  169. package/build/commands/browser/custom$$.js +0 -46
  170. package/build/commands/browser/custom$.js +0 -49
  171. package/build/commands/browser/debug.js +0 -102
  172. package/build/commands/browser/deleteCookies.js +0 -20
  173. package/build/commands/browser/emulate.js +0 -98
  174. package/build/commands/browser/execute.js +0 -52
  175. package/build/commands/browser/executeAsync.js +0 -60
  176. package/build/commands/browser/getCookies.js +0 -43
  177. package/build/commands/browser/getPuppeteer.js +0 -130
  178. package/build/commands/browser/getWindowSize.js +0 -24
  179. package/build/commands/browser/keys.js +0 -55
  180. package/build/commands/browser/mock.js +0 -122
  181. package/build/commands/browser/mockClearAll.js +0 -37
  182. package/build/commands/browser/mockRestoreAll.js +0 -35
  183. package/build/commands/browser/newWindow.js +0 -83
  184. package/build/commands/browser/overwriteCommand.js +0 -32
  185. package/build/commands/browser/pause.js +0 -24
  186. package/build/commands/browser/react$$.js +0 -51
  187. package/build/commands/browser/react$.js +0 -59
  188. package/build/commands/browser/reloadSession.js +0 -64
  189. package/build/commands/browser/savePDF.js +0 -45
  190. package/build/commands/browser/saveRecordingScreen.js +0 -41
  191. package/build/commands/browser/saveScreenshot.js +0 -50
  192. package/build/commands/browser/scroll.js +0 -41
  193. package/build/commands/browser/setCookies.js +0 -64
  194. package/build/commands/browser/setTimeout.js +0 -54
  195. package/build/commands/browser/setWindowSize.js +0 -37
  196. package/build/commands/browser/switchWindow.js +0 -70
  197. package/build/commands/browser/throttle.js +0 -11
  198. package/build/commands/browser/throttleCPU.js +0 -41
  199. package/build/commands/browser/throttleNetwork.js +0 -145
  200. package/build/commands/browser/touchAction.js +0 -75
  201. package/build/commands/browser/uploadFile.js +0 -58
  202. package/build/commands/browser/url.js +0 -55
  203. package/build/commands/browser/waitUntil.js +0 -45
  204. package/build/commands/browser.js +0 -39
  205. package/build/commands/constant.js +0 -88
  206. package/build/commands/element/$$.js +0 -45
  207. package/build/commands/element/$.js +0 -60
  208. package/build/commands/element/addValue.js +0 -40
  209. package/build/commands/element/clearValue.js +0 -29
  210. package/build/commands/element/click.js +0 -162
  211. package/build/commands/element/custom$$.js +0 -57
  212. package/build/commands/element/custom$.js +0 -59
  213. package/build/commands/element/doubleClick.js +0 -38
  214. package/build/commands/element/dragAndDrop.js +0 -79
  215. package/build/commands/element/execute.js +0 -53
  216. package/build/commands/element/executeAsync.js +0 -63
  217. package/build/commands/element/getAttribute.js +0 -29
  218. package/build/commands/element/getCSSProperty.js +0 -140
  219. package/build/commands/element/getComputedLabel.js +0 -21
  220. package/build/commands/element/getComputedRole.js +0 -21
  221. package/build/commands/element/getHTML.js +0 -168
  222. package/build/commands/element/getLocation.js +0 -38
  223. package/build/commands/element/getProperty.js +0 -19
  224. package/build/commands/element/getSize.js +0 -38
  225. package/build/commands/element/getTagName.js +0 -26
  226. package/build/commands/element/getText.js +0 -43
  227. package/build/commands/element/getValue.js +0 -29
  228. package/build/commands/element/isClickable.js +0 -59
  229. package/build/commands/element/isDisplayed.js +0 -115
  230. package/build/commands/element/isEnabled.js +0 -35
  231. package/build/commands/element/isEqual.js +0 -56
  232. package/build/commands/element/isExisting.js +0 -66
  233. package/build/commands/element/isFocused.js +0 -36
  234. package/build/commands/element/isSelected.js +0 -32
  235. package/build/commands/element/isStable.js +0 -62
  236. package/build/commands/element/moveTo.js +0 -49
  237. package/build/commands/element/nextElement.js +0 -28
  238. package/build/commands/element/parentElement.js +0 -28
  239. package/build/commands/element/previousElement.js +0 -28
  240. package/build/commands/element/react$$.js +0 -53
  241. package/build/commands/element/react$.js +0 -61
  242. package/build/commands/element/saveScreenshot.js +0 -34
  243. package/build/commands/element/scrollIntoView.js +0 -96
  244. package/build/commands/element/selectByAttribute.js +0 -56
  245. package/build/commands/element/selectByIndex.js +0 -52
  246. package/build/commands/element/selectByVisibleText.js +0 -63
  247. package/build/commands/element/setValue.js +0 -30
  248. package/build/commands/element/shadow$$.js +0 -43
  249. package/build/commands/element/shadow$.js +0 -41
  250. package/build/commands/element/touchAction.js +0 -68
  251. package/build/commands/element/waitForClickable.js +0 -34
  252. package/build/commands/element/waitForDisplayed.js +0 -27
  253. package/build/commands/element/waitForEnabled.js +0 -52
  254. package/build/commands/element/waitForExist.js +0 -46
  255. package/build/commands/element/waitForStable.js +0 -86
  256. package/build/commands/element/waitUntil.js +0 -28
  257. package/build/commands/element.js +0 -51
  258. package/build/commands/mock/abort.js +0 -20
  259. package/build/commands/mock/abortOnce.js +0 -28
  260. package/build/commands/mock/clear.js +0 -19
  261. package/build/commands/mock/respond.js +0 -55
  262. package/build/commands/mock/respondOnce.js +0 -56
  263. package/build/commands/mock/restore.js +0 -20
  264. package/build/constants.js +0 -150
  265. package/build/middlewares.js +0 -62
  266. package/build/multiremote.js +0 -168
  267. package/build/protocol-stub.js +0 -58
  268. package/build/shadowRoot.js +0 -126
  269. package/build/types.js +0 -1
  270. package/build/utils/SevereServiceError.js +0 -9
  271. package/build/utils/Timer.js +0 -110
  272. package/build/utils/actions/base.js +0 -66
  273. package/build/utils/actions/index.js +0 -5
  274. package/build/utils/actions/key.js +0 -42
  275. package/build/utils/actions/pointer.js +0 -92
  276. package/build/utils/actions/wheel.js +0 -20
  277. package/build/utils/detectBackend.js +0 -116
  278. package/build/utils/driver.js +0 -30
  279. package/build/utils/findStrategy.js +0 -327
  280. package/build/utils/getElementObject.js +0 -146
  281. package/build/utils/implicitWait.js +0 -33
  282. package/build/utils/index.js +0 -653
  283. package/build/utils/interception/index.js +0 -320
  284. package/build/utils/interception/types.js +0 -1
  285. package/build/utils/interception/utils.js +0 -87
  286. package/build/utils/refetchElement.js +0 -30
  287. package/build/utils/thirdParty/querySelectorShadowDom.js +0 -270
  288. /package/{LICENSE-MIT → LICENSE} +0 -0
@@ -0,0 +1,79 @@
1
+ import type { FakeTimerInstallOpts, InstalledClock, install } from '@sinonjs/fake-timers';
2
+ declare global {
3
+ interface Window {
4
+ __clock: InstalledClock;
5
+ __wdio_sinon: {
6
+ install: typeof install;
7
+ };
8
+ }
9
+ }
10
+ export declare class ClockManager {
11
+ #private;
12
+ constructor(browser: WebdriverIO.Browser);
13
+ /**
14
+ * Install fake timers on the browser. If you call the `emulate` command, WebdriverIO will automatically install
15
+ * the fake timers for you. You can use this method to re-install the fake timers if you have called `restore`.
16
+ *
17
+ * @param options {FakeTimerInstallOpts} Options to pass to the fake clock
18
+ * @returns {Promise<void>}
19
+ */
20
+ install(options?: FakeTimerInstallOpts): Promise<void>;
21
+ /**
22
+ * Restore all overridden native functions. This is automatically called between tests, so should not
23
+ * generally be needed.
24
+ *
25
+ * ```ts
26
+ * it('should restore the clock', async () => {
27
+ * console.log(new Date()) // returns e.g. 1722560447102
28
+ *
29
+ * const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
30
+ * console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000
31
+ *
32
+ * await clock.restore()
33
+ * console.log(await browser.execute(() => new Date().getTime())) // returns 1722560447102
34
+ * })
35
+ * ```
36
+ *
37
+ * @returns {Promise<void>}
38
+ */
39
+ restore(): Promise<void>;
40
+ /**
41
+ * Move the clock the specified number of `milliseconds`. Any timers within the affected range of time will be called.
42
+ * @param ms {number} The number of milliseconds to move the clock.
43
+ *
44
+ * ```ts
45
+ * it('should move the clock', async () => {
46
+ * console.log(new Date()) // returns e.g. 1722560447102
47
+ *
48
+ * const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
49
+ * console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000
50
+ *
51
+ * await clock.tick(1000)
52
+ * console.log(await browser.execute(() => new Date().getTime())) // returns 1618383601000
53
+ * })
54
+ * ```
55
+ *
56
+ * @param {number} ms The number of milliseconds to move the clock.
57
+ * @returns {Promise<void>}
58
+ */
59
+ tick(ms: number): Promise<void>;
60
+ /**
61
+ * Change the system time to the new now. Now can be a timestamp, date object, or not passed in which defaults
62
+ * to 0. No timers will be called, nor will the time left before they trigger change.
63
+ *
64
+ * ```ts
65
+ * it('should set the system time', async () => {
66
+ * const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
67
+ * console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000
68
+ *
69
+ * await clock.setSystemTime(new Date(2011, 3, 15))
70
+ * console.log(await browser.execute(() => new Date().getTime())) // returns 1302850800000
71
+ * })
72
+ * ```
73
+ *
74
+ * @param date {Date|number} The new date to set the system time to.
75
+ * @returns {Promise<void>}
76
+ */
77
+ setSystemTime(date: number | Date): Promise<void>;
78
+ }
79
+ //# sourceMappingURL=clock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAIzF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,OAAO,EAAE,cAAc,CAAA;QACvB,YAAY,EAAE;YACV,OAAO,EAAE,OAAO,OAAO,CAAA;SAC1B,CAAA;KACJ;CACJ;AAUD,qBAAa,YAAY;;gBAKT,OAAO,EAAE,WAAW,CAAC,OAAO;IAIxC;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,CAAC,EAAE,oBAAoB;IAkD5C;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO;IAKb;;;;;;;;;;;;;;;;;;OAkBG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM;IAIrB;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAI1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/$.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,CAAC,CACnB,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,GACnB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAuC9B"}
1
+ {"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/$.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,CAAC,CACnB,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,GACnB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CA6B9B"}
@@ -0,0 +1,86 @@
1
+ export interface InitScript<Payload = undefined> {
2
+ remove: () => Promise<void>;
3
+ on: (event: 'data', listener: (data: Payload) => void) => void;
4
+ }
5
+ /**
6
+ * Callback to emit data from the browser back to the Node.js environment. In order to receive the
7
+ * data returned by the callback function you have to listen to the `data` event, e.g.
8
+ *
9
+ * ```js
10
+ * const script = await browser.addInitScript((emit) => {
11
+ * emit('hello')
12
+ * })
13
+ * script.on('data', (data) => {
14
+ * console.log(data) // prints: hello
15
+ * })
16
+ * ```
17
+ *
18
+ * @param {any} data The data to emit.
19
+ */
20
+ type InitScriptCallback<Payload> = (data: Payload) => void;
21
+ type InitScriptFunction<Payload> = ((emit: InitScriptCallback<Payload>) => void | Promise<void>);
22
+ type InitScriptFunctionArg1<Payload, Arg1> = ((arg1: Arg1, emit: InitScriptCallback<Payload>) => void | Promise<void>);
23
+ type InitScriptFunctionArg2<Payload, Arg1, Arg2> = ((arg1: Arg1, arg2: Arg2, emit: InitScriptCallback<Payload>) => void | Promise<void>);
24
+ type InitScriptFunctionArg3<Payload, Arg1, Arg2, Arg3> = ((arg1: Arg1, arg2: Arg2, arg3: Arg3, emit: InitScriptCallback<Payload>) => void | Promise<void>);
25
+ type InitScriptFunctionArg4<Payload, Arg1, Arg2, Arg3, Arg4> = ((arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, emit: InitScriptCallback<Payload>) => void | Promise<void>);
26
+ type InitScriptFunctionArg5<Payload, Arg1, Arg2, Arg3, Arg4, Arg5> = ((arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, arg5: Arg5, emit: InitScriptCallback<Payload>) => void | Promise<void>);
27
+ /**
28
+ * Adds a script which would be evaluated in one of the following scenarios:
29
+ *
30
+ * - Whenever the page is navigated.
31
+ * - Whenever the child frame is attached or navigated. In this case, the script is evaluated in
32
+ * the context of the newly attached frame.
33
+ *
34
+ * The script is evaluated after the document was created but before any of its scripts were run.
35
+ * In order to remove the initialization script from the page again, call the function that got
36
+ * returned by this function.
37
+ *
38
+ * This is useful to amend the JavaScript environment, e.g. to seed Math.random.
39
+ *
40
+ * <example>
41
+ :addInitScript.js
42
+ const script = await browser.addInitScript((seed) => {
43
+ Math.random = () => seed
44
+ }, 42)
45
+
46
+ await browser.url('https://webdriver.io')
47
+ console.log(await browser.execute(() => Math.random())) // returns 42
48
+
49
+ await reset()
50
+ await browser.url('https://webdriver.io')
51
+ console.log(await browser.execute(() => Math.random())) // returns a random number
52
+ * </example>
53
+ *
54
+ * Furthermore you can also use the `emit` function to send data back to the Node.js environment.
55
+ * This is useful if you want to observe certain events in the browser environment, e.g.:
56
+ *
57
+ * <example>
58
+ :addInitScriptWithEmit.js
59
+ const script = await browser.addInitScript((emit) => {
60
+ const observer = new MutationObserver((mutations) => {
61
+ for (const mutation of mutations) {
62
+ emit(mutation.target.nodeName)
63
+ }
64
+ })
65
+ observer.observe(document, { childList: true, subtree: true })
66
+ })
67
+
68
+ script.on('data', (data) => {
69
+ console.log(data) // prints: BODY, DIV, P, ...
70
+ })
71
+ * </example>
72
+ *
73
+ * @alias browser.addInitScript
74
+ * @param {Function} script function to be injected as initialization script
75
+ * @param {number|string|boolean} args parameters for the script
76
+ * @type utility
77
+ *
78
+ */
79
+ export declare function addInitScript<Payload>(this: WebdriverIO.Browser, script: string | InitScriptFunction<Payload>): Promise<InitScript<Payload>>;
80
+ export declare function addInitScript<Payload, Arg1>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg1<Payload, Arg1>, arg1: Arg1): Promise<InitScript<Payload>>;
81
+ export declare function addInitScript<Payload, Arg1, Arg2>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg2<Payload, Arg1, Arg2>, arg1: Arg1, arg2: Arg2): Promise<InitScript<Payload>>;
82
+ export declare function addInitScript<Payload, Arg1, Arg2, Arg3>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg3<Payload, Arg1, Arg2, Arg3>, arg1: Arg1, arg2: Arg2, arg3: Arg3): Promise<InitScript<Payload>>;
83
+ export declare function addInitScript<Payload, Arg1, Arg2, Arg3, Arg4>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg4<Payload, Arg1, Arg2, Arg3, Arg4>, arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4): Promise<InitScript<Payload>>;
84
+ export declare function addInitScript<Payload, Arg1, Arg2, Arg3, Arg4, Arg5>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg5<Payload, Arg1, Arg2, Arg3, Arg4, Arg5>, arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, arg5: Arg5): Promise<InitScript<Payload>>;
85
+ export {};
86
+ //# sourceMappingURL=addInitScript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addInitScript.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/addInitScript.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ *
3
+ * Download a file from the remote computer running Selenium node to local file system
4
+ * by using the [`downloadFile`](https://webdriver.io/docs/api/selenium#downloadFile) command.
5
+ *
6
+ * :::info
7
+ * Note that this command is only supported if you use a
8
+ * [Selenium Grid](https://www.selenium.dev/documentation/en/grid/) with Chrome, Edge or Firefox
9
+ * and have the `se:downloadsEnabled` flag set in the capabilities.
10
+ * :::
11
+ *
12
+ * <example>
13
+ :downloadFile.js
14
+ it('should download a file', async () => {
15
+ await browser.url('https://www.selenium.dev/selenium/web/downloads/download.html')
16
+ await $('#file-1').click()
17
+ await browser.waitUntil(async function () {
18
+ return (await browser.getDownloadableFiles()).names.includes('file_1.txt')
19
+ }, {timeout: 5000})
20
+ const files = await browser.getDownloadableFiles()
21
+ const downloaded = await browser.downloadFile(files.names[0], process.cwd())
22
+ await browser.deleteDownloadableFiles()
23
+ })
24
+ * </example>
25
+ *
26
+ * @alias browser.downloadFile
27
+ * @param {string} fileName remote path to file
28
+ * @param {string} targetDirectory target location on local computer
29
+ * @type utility
30
+ * @uses protocol/download
31
+ *
32
+ */
33
+ export declare function downloadFile(this: WebdriverIO.Browser, fileName: string, targetDirectory: string): Promise<object>;
34
+ //# sourceMappingURL=downloadFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/downloadFile.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACxB,OAAO,CAAC,MAAM,CAAC,CAgDjB"}
@@ -1,30 +1,13 @@
1
- type SupportedScopes = 'geolocation' | 'userAgent' | 'colorScheme' | 'onLine';
2
- interface EmulationOptions {
3
- geolocation: Partial<GeolocationCoordinates>;
4
- userAgent: string;
5
- colorScheme: 'light' | 'dark';
6
- onLine: boolean;
7
- }
8
- /**
9
- * WebdriverIO allows you to emulate Web APIs using the `emulate` command. These Web APIs can then
10
- * behave exactly as you specify it.
11
- *
12
- * Read more on this in the [Emulation](/docs/emulation) guidelines.
13
- *
14
- * :::info
15
- *
16
- * This feature requires WebDriver Bidi support for the browser. While recent versions of Chrome, Edge
17
- * and Firefox have such support, Safari __does not__. For updates follow [wpt.fyi](https://wpt.fyi/results/webdriver/tests/bidi/script/add_preload_script/add_preload_script.py?label=experimental&label=master&aligned).
18
- * Furthermore if you use a cloud vendor for spawning browsers, make sure your vendor also supports WebDriver Bidi.
19
- *
20
- * :::
21
- *
22
- * @param {string} scope feature of the browser you like to emulate, can be either `geolocation`, `userAgent`, `colorScheme` or `onLine`
23
- * @param {EmulationOptions} options emulation option for specific scope
24
- * @example https://github.com/webdriverio/example-recipes/blob/9bff2baf8a0678c6886f8591d9fc8dea201895d3/emulate/example.js#L4-L18
25
- * @example https://github.com/webdriverio/example-recipes/blob/9bff2baf8a0678c6886f8591d9fc8dea201895d3/emulate/example.js#L20-L36
26
- * @returns `void`
27
- */
28
- export declare function emulate<Scope extends SupportedScopes>(this: WebdriverIO.Browser, scope: Scope, options: EmulationOptions[Scope]): Promise<void>;
1
+ import type { FakeTimerInstallOpts } from '@sinonjs/fake-timers';
2
+ import { ClockManager } from '../../clock.js';
3
+ import { type DeviceName } from '../../deviceDescriptorsSource.js';
4
+ type RestoreFunction = () => Promise<any>;
5
+ type ColorScheme = 'light' | 'dark';
6
+ export declare function emulate(scope: 'clock', options?: FakeTimerInstallOpts): Promise<ClockManager>;
7
+ export declare function emulate(scope: 'geolocation', geolocation: Partial<GeolocationCoordinates>): Promise<RestoreFunction>;
8
+ export declare function emulate(scope: 'userAgent', userAgent: string): Promise<RestoreFunction>;
9
+ export declare function emulate(scope: 'device', userAgent: DeviceName): Promise<RestoreFunction>;
10
+ export declare function emulate(scope: 'colorScheme', colorScheme: ColorScheme): Promise<RestoreFunction>;
11
+ export declare function emulate(scope: 'onLine', state: boolean): Promise<RestoreFunction>;
29
12
  export {};
30
13
  //# sourceMappingURL=emulate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emulate.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/emulate.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAA;AAE7E,UAAU,gBAAgB;IACtB,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,OAAO,GAAG,MAAM,CAAA;IAC7B,MAAM,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,OAAO,CAAC,KAAK,SAAS,eAAe,EACvD,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAuFnC"}
1
+ {"version":3,"file":"emulate.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/emulate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAI3F,KAAK,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;AACzC,KAAK,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAqBnC,wBAAsB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AACpG,wBAAsB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAC3H,wBAAsB,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAC9F,wBAAsB,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAC/F,wBAAsB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AACvG,wBAAsB,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/execute.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EAC7D,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,EAChF,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,cAAc,KAAK,WAAW,CAAC,EAChE,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/execute.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,OAAO,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EACnE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,EAChF,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,cAAc,KAAK,WAAW,CAAC,EAChE,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CA8BtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"executeAsync.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/executeAsync.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EAClE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,MAAM,EACF,MAAM,GACN,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,EACjG,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
1
+ {"version":3,"file":"executeAsync.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/executeAsync.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EACxE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,MAAM,EACF,MAAM,GACN,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,EACjG,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CA8BtB"}
@@ -1,3 +1,4 @@
1
+ import type { Cookie } from '@wdio/protocols';
1
2
  /**
2
3
  *
3
4
  * Retrieve a [cookie](https://w3c.github.io/webdriver/webdriver-spec.html#cookies)
@@ -30,5 +31,5 @@
30
31
  * @uses webdriver/getAllCookies
31
32
  *
32
33
  */
33
- export declare function getCookies(this: WebdriverIO.Browser, names?: string | string[]): Promise<import("@wdio/protocols").Cookie[]>;
34
+ export declare function getCookies(this: WebdriverIO.Browser, names?: string | string[]): Promise<Cookie[]>;
34
35
  //# sourceMappingURL=getCookies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getCookies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,UAAU,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,+CAc5B"}
1
+ {"version":3,"file":"getCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getCookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,UAAU,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAanB"}
@@ -1 +1 @@
1
- {"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,6BAyG5D"}
1
+ {"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwGxF"}
@@ -1,4 +1,4 @@
1
- import type { MockOptions } from '../../utils/interception/types.js';
1
+ import type { MockFilterOptions } from '../../utils/interception/types.js';
2
2
  import WebDriverInterception from '../../utils/interception/index.js';
3
3
  export declare const SESSION_MOCKS: Record<string, Set<WebDriverInterception>>;
4
4
  /**
@@ -107,5 +107,5 @@ export declare const SESSION_MOCKS: Record<string, Set<WebDriverInterception>>;
107
107
  * @type utility
108
108
  *
109
109
  */
110
- export declare function mock(this: WebdriverIO.Browser, url: string, filterOptions?: MockOptions): Promise<WebdriverIO.Mock>;
110
+ export declare function mock(this: WebdriverIO.Browser, url: string, filterOptions?: MockFilterOptions): Promise<WebdriverIO.Mock>;
111
111
  //# sourceMappingURL=mock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,qBAAqB,MAAM,mCAAmC,CAAA;AAErE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAM,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,wBAAsB,IAAI,CACtB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,aAAa,CAAC,EAAE,WAAW,GAC5B,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAa3B"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAA;AAErE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAM,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,wBAAsB,IAAI,CACtB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,aAAa,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAa3B"}
@@ -6,6 +6,14 @@
6
6
  * Be careful though, this command affects your test time tremendously since spawning
7
7
  * new Selenium sessions is very time consuming especially when using cloud services.
8
8
  *
9
+ * Connection parameters such as hostname, port, protocol, etc. can be added along side
10
+ * browserName when you want to connect to a different remote service. This is useful
11
+ * in a situation, for example, where you start a test in native app and need to verify
12
+ * data in web app.
13
+ *
14
+ * If you start from remote service, you can pass in 0.0.0.0 for hostname if you want
15
+ * to switch to local drivers.
16
+ *
9
17
  * <example>
10
18
  :reloadSync.js
11
19
  it('should reload my session with current capabilities', async () => {
@@ -21,6 +29,18 @@
21
29
  })
22
30
  console.log(browser.capabilities.browserName) // outputs: firefox
23
31
  })
32
+
33
+ it('should reload my session with new remote', async () => {
34
+ console.log(browser.capabilities.browserName) // outputs: chrome
35
+ await browser.reloadSession({
36
+ protocol: 'https',
37
+ host: '0.0.0.1',
38
+ port: 4444,
39
+ path: '/wd/hub',
40
+ browserName: 'firefox'
41
+ })
42
+ console.log(browser.capabilities.browserName) // outputs: firefox
43
+ })
24
44
  * </example>
25
45
  *
26
46
  * @alias browser.reloadSession
@@ -1 +1 @@
1
- {"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,WAAW,CAAC,YAAY,mBAoCzG"}
1
+ {"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,WAAW,CAAC,YAAY,mBAoCzG"}
@@ -0,0 +1,33 @@
1
+ import type { SupportedScopes } from '../../types.js';
2
+ /**
3
+ *
4
+ * This command restores specific or all emulated behaviors that were set using the `emulate` command.
5
+ *
6
+ * <example>
7
+ :restore.js
8
+ before(async () => {
9
+ await browser.emulate('geolocation', { latitude: 52.52, longitude: 13.405 })
10
+ await browser.emulate('userAgent', 'foobar')
11
+ await browser.emulate('colorScheme', 'dark')
12
+ await browser.emulate('onLine', false)
13
+ })
14
+
15
+ it('should restore all emulated behavior', async () => {
16
+ await browser.url('https://webdriver.io')
17
+ // test within an emulated environment...
18
+ })
19
+
20
+ after(async () => {
21
+ // restore all emulated behavior
22
+ await browser.restore()
23
+ // or only restore specific emulated behavior
24
+ // await browser.restore(['geolocation', 'userAgent'])
25
+ })
26
+ * </example>
27
+ *
28
+ * @alias browser.restore
29
+ * @type utility
30
+ *
31
+ */
32
+ export declare function restore(this: WebdriverIO.Browser, scopes?: SupportedScopes | SupportedScopes[]): Promise<void>;
33
+ //# sourceMappingURL=restore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/restore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,iBAc/C"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  type PDFPrintOptions = {
3
2
  orientation?: string;
4
3
  scale?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"savePDF.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/savePDF.ts"],"names":[],"mappings":";AAGA,KAAK,eAAe,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,mBAmB5B"}
1
+ {"version":3,"file":"savePDF.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/savePDF.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,mBAmB5B"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  /**
3
2
  *
4
3
  * Save a video started by [`startRecordingScreen`](/docs/api/appium#startrecordingscreen) command to file.
@@ -1 +1 @@
1
- {"version":3,"file":"saveRecordingScreen.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveRecordingScreen.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAiBnB"}
1
+ {"version":3,"file":"saveRecordingScreen.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveRecordingScreen.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAiBnB"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  /**
3
2
  *
4
3
  * Save a screenshot of the current browsing context to a PNG file on your OS. Be aware that
@@ -1 +1 @@
1
- {"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAwBnB"}
1
+ {"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAwBnB"}
@@ -0,0 +1,30 @@
1
+ export interface SetViewportOptions {
2
+ width: number;
3
+ height: number;
4
+ devicePixelRatio?: number;
5
+ }
6
+ /**
7
+ * Resizes the browser viewport within the browser. As oppose to `setWindowSize`,
8
+ * this command changes the viewport size, not the window size.
9
+ *
10
+ * <example>
11
+ * :setWindowSize.js
12
+ it('should set viewport to emulate iPhone 15', async () => {
13
+ await browser.setWindowSize({
14
+ width: 393,
15
+ height: 659,
16
+ deviceScaleFactor: 3
17
+ });
18
+ });
19
+ * </example>
20
+ *
21
+ * @alias browser.setWindowSize
22
+ * @param {SetViewportOptions} options command arguments
23
+ * @param {number} options.width viewport width in pixels
24
+ * @param {number} options.height viewport height in pixels
25
+ * @param {number} options.devicePixelRatio pixel ratio of the viewport
26
+ * @return {Promise<void>}
27
+ * @type window
28
+ */
29
+ export declare function setViewport(this: WebdriverIO.Browser, options: SetViewportOptions): Promise<void>;
30
+ //# sourceMappingURL=setViewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setViewport.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setViewport.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,kBAAkB,iBA+B9B"}
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  *
3
- * Resizes browser window outer size according to provided width and height.
3
+ * Resizes browser window outer size according to provided width and height. Based on your operating
4
+ * system some browser windows might now allow you so have a smaller width than `500px`. If you want
5
+ * to mimic the viewport of e.g. an iPhone you should consider using the `setViewport` command.
4
6
  *
5
7
  * <example>
6
8
  * :setWindowSize.js
@@ -1 +1 @@
1
- {"version":3,"file":"setWindowSize.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setWindowSize.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,iBAmBjB"}
1
+ {"version":3,"file":"setWindowSize.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setWindowSize.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,iBAmBjB"}