webdriverio 7.17.0 → 7.17.3

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 (358) hide show
  1. package/build/commands/browser/$$.d.ts +50 -0
  2. package/build/commands/browser/$$.d.ts.map +1 -0
  3. package/build/commands/browser/$$.js +57 -0
  4. package/build/commands/browser/$.d.ts +77 -0
  5. package/build/commands/browser/$.d.ts.map +1 -0
  6. package/build/commands/browser/$.js +91 -0
  7. package/build/commands/browser/addCommand.d.ts +37 -0
  8. package/build/commands/browser/addCommand.d.ts.map +1 -0
  9. package/build/commands/browser/addCommand.js +37 -0
  10. package/build/commands/browser/call.d.ts +42 -0
  11. package/build/commands/browser/call.d.ts.map +1 -0
  12. package/build/commands/browser/call.js +49 -0
  13. package/build/commands/browser/custom$$.d.ts +26 -0
  14. package/build/commands/browser/custom$$.d.ts.map +1 -0
  15. package/build/commands/browser/custom$$.js +47 -0
  16. package/build/commands/browser/custom$.d.ts +25 -0
  17. package/build/commands/browser/custom$.d.ts.map +1 -0
  18. package/build/commands/browser/custom$.js +47 -0
  19. package/build/commands/browser/debug.d.ts +32 -0
  20. package/build/commands/browser/debug.d.ts.map +1 -0
  21. package/build/commands/browser/debug.js +108 -0
  22. package/build/commands/browser/deleteCookies.d.ts +45 -0
  23. package/build/commands/browser/deleteCookies.d.ts.map +1 -0
  24. package/build/commands/browser/deleteCookies.js +56 -0
  25. package/build/commands/browser/execute.d.ts +37 -0
  26. package/build/commands/browser/execute.d.ts.map +1 -0
  27. package/build/commands/browser/execute.js +55 -0
  28. package/build/commands/browser/executeAsync.d.ts +45 -0
  29. package/build/commands/browser/executeAsync.d.ts.map +1 -0
  30. package/build/commands/browser/executeAsync.js +63 -0
  31. package/build/commands/browser/getCookies.d.ts +34 -0
  32. package/build/commands/browser/getCookies.d.ts.map +1 -0
  33. package/build/commands/browser/getCookies.js +46 -0
  34. package/build/commands/browser/getPuppeteer.d.ts +38 -0
  35. package/build/commands/browser/getPuppeteer.d.ts.map +1 -0
  36. package/build/commands/browser/getPuppeteer.js +119 -0
  37. package/build/commands/browser/getWindowSize.d.ts +25 -0
  38. package/build/commands/browser/getWindowSize.d.ts.map +1 -0
  39. package/build/commands/browser/getWindowSize.js +30 -0
  40. package/build/commands/browser/keys.d.ts +28 -0
  41. package/build/commands/browser/keys.d.ts.map +1 -0
  42. package/build/commands/browser/keys.js +64 -0
  43. package/build/commands/browser/mock.d.ts +111 -0
  44. package/build/commands/browser/mock.d.ts.map +1 -0
  45. package/build/commands/browser/mock.js +164 -0
  46. package/build/commands/browser/mockClearAll.d.ts +28 -0
  47. package/build/commands/browser/mockClearAll.d.ts.map +1 -0
  48. package/build/commands/browser/mockClearAll.js +43 -0
  49. package/build/commands/browser/mockRestoreAll.d.ts +26 -0
  50. package/build/commands/browser/mockRestoreAll.d.ts.map +1 -0
  51. package/build/commands/browser/mockRestoreAll.js +41 -0
  52. package/build/commands/browser/newWindow.d.ts +41 -0
  53. package/build/commands/browser/newWindow.d.ts.map +1 -0
  54. package/build/commands/browser/newWindow.js +83 -0
  55. package/build/commands/browser/overwriteCommand.d.ts +32 -0
  56. package/build/commands/browser/overwriteCommand.d.ts.map +1 -0
  57. package/build/commands/browser/overwriteCommand.js +32 -0
  58. package/build/commands/browser/pause.d.ts +23 -0
  59. package/build/commands/browser/pause.d.ts.map +1 -0
  60. package/build/commands/browser/pause.js +27 -0
  61. package/build/commands/browser/react$$.d.ts +36 -0
  62. package/build/commands/browser/react$$.d.ts.map +1 -0
  63. package/build/commands/browser/react$$.js +51 -0
  64. package/build/commands/browser/react$.d.ts +46 -0
  65. package/build/commands/browser/react$.d.ts.map +1 -0
  66. package/build/commands/browser/react$.js +59 -0
  67. package/build/commands/browser/reloadSession.d.ts +23 -0
  68. package/build/commands/browser/reloadSession.d.ts.map +1 -0
  69. package/build/commands/browser/reloadSession.js +58 -0
  70. package/build/commands/browser/savePDF.d.ts +46 -0
  71. package/build/commands/browser/savePDF.d.ts.map +1 -0
  72. package/build/commands/browser/savePDF.js +51 -0
  73. package/build/commands/browser/saveRecordingScreen.d.ts +28 -0
  74. package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -0
  75. package/build/commands/browser/saveRecordingScreen.js +47 -0
  76. package/build/commands/browser/saveScreenshot.d.ts +22 -0
  77. package/build/commands/browser/saveScreenshot.d.ts.map +1 -0
  78. package/build/commands/browser/saveScreenshot.js +41 -0
  79. package/build/commands/browser/setCookies.d.ts +57 -0
  80. package/build/commands/browser/setCookies.d.ts.map +1 -0
  81. package/build/commands/browser/setCookies.js +66 -0
  82. package/build/commands/browser/setTimeout.d.ts +31 -0
  83. package/build/commands/browser/setTimeout.d.ts.map +1 -0
  84. package/build/commands/browser/setTimeout.js +61 -0
  85. package/build/commands/browser/setWindowSize.d.ts +20 -0
  86. package/build/commands/browser/setWindowSize.d.ts.map +1 -0
  87. package/build/commands/browser/setWindowSize.js +43 -0
  88. package/build/commands/browser/switchWindow.d.ts +30 -0
  89. package/build/commands/browser/switchWindow.d.ts.map +1 -0
  90. package/build/commands/browser/switchWindow.js +73 -0
  91. package/build/commands/browser/throttle.d.ts +3 -0
  92. package/build/commands/browser/throttle.d.ts.map +1 -0
  93. package/build/commands/browser/throttle.js +144 -0
  94. package/build/commands/browser/touchAction.d.ts +61 -0
  95. package/build/commands/browser/touchAction.d.ts.map +1 -0
  96. package/build/commands/browser/touchAction.js +65 -0
  97. package/build/commands/browser/uploadFile.d.ts +32 -0
  98. package/build/commands/browser/uploadFile.d.ts.map +1 -0
  99. package/build/commands/browser/uploadFile.js +63 -0
  100. package/build/commands/browser/url.d.ts +38 -0
  101. package/build/commands/browser/url.d.ts.map +1 -0
  102. package/build/commands/browser/url.js +49 -0
  103. package/build/commands/browser/waitUntil.d.ts +44 -0
  104. package/build/commands/browser/waitUntil.d.ts.map +1 -0
  105. package/build/commands/browser/waitUntil.js +73 -0
  106. package/build/commands/browser.d.ts +70 -0
  107. package/build/commands/browser.d.ts.map +1 -0
  108. package/build/commands/browser.js +44 -0
  109. package/build/commands/constant.d.ts +19 -0
  110. package/build/commands/constant.d.ts.map +1 -0
  111. package/build/commands/constant.js +91 -0
  112. package/build/commands/element/$$.d.ts +46 -0
  113. package/build/commands/element/$$.d.ts.map +1 -0
  114. package/build/commands/element/$$.js +50 -0
  115. package/build/commands/element/$.d.ts +72 -0
  116. package/build/commands/element/$.d.ts.map +1 -0
  117. package/build/commands/element/$.js +76 -0
  118. package/build/commands/element/addValue.d.ts +33 -0
  119. package/build/commands/element/addValue.d.ts.map +1 -0
  120. package/build/commands/element/addValue.js +48 -0
  121. package/build/commands/element/clearValue.d.ts +28 -0
  122. package/build/commands/element/clearValue.d.ts.map +1 -0
  123. package/build/commands/element/clearValue.js +32 -0
  124. package/build/commands/element/click.d.ts +73 -0
  125. package/build/commands/element/click.d.ts.map +1 -0
  126. package/build/commands/element/click.js +134 -0
  127. package/build/commands/element/custom$$.d.ts +28 -0
  128. package/build/commands/element/custom$$.d.ts.map +1 -0
  129. package/build/commands/element/custom$$.js +57 -0
  130. package/build/commands/element/custom$.d.ts +27 -0
  131. package/build/commands/element/custom$.d.ts.map +1 -0
  132. package/build/commands/element/custom$.js +57 -0
  133. package/build/commands/element/doubleClick.d.ts +25 -0
  134. package/build/commands/element/doubleClick.d.ts.map +1 -0
  135. package/build/commands/element/doubleClick.js +51 -0
  136. package/build/commands/element/dragAndDrop.d.ts +41 -0
  137. package/build/commands/element/dragAndDrop.d.ts.map +1 -0
  138. package/build/commands/element/dragAndDrop.js +98 -0
  139. package/build/commands/element/getAttribute.d.ts +28 -0
  140. package/build/commands/element/getAttribute.d.ts.map +1 -0
  141. package/build/commands/element/getAttribute.js +32 -0
  142. package/build/commands/element/getCSSProperty.d.ts +71 -0
  143. package/build/commands/element/getCSSProperty.d.ts.map +1 -0
  144. package/build/commands/element/getCSSProperty.js +108 -0
  145. package/build/commands/element/getComputedLabel.d.ts +20 -0
  146. package/build/commands/element/getComputedLabel.d.ts.map +1 -0
  147. package/build/commands/element/getComputedLabel.js +24 -0
  148. package/build/commands/element/getComputedRole.d.ts +20 -0
  149. package/build/commands/element/getComputedRole.d.ts.map +1 -0
  150. package/build/commands/element/getComputedRole.js +24 -0
  151. package/build/commands/element/getHTML.d.ts +32 -0
  152. package/build/commands/element/getHTML.d.ts.map +1 -0
  153. package/build/commands/element/getHTML.js +46 -0
  154. package/build/commands/element/getLocation.d.ts +6 -0
  155. package/build/commands/element/getLocation.d.ts.map +1 -0
  156. package/build/commands/element/getLocation.js +46 -0
  157. package/build/commands/element/getProperty.d.ts +53 -0
  158. package/build/commands/element/getProperty.d.ts.map +1 -0
  159. package/build/commands/element/getProperty.js +31 -0
  160. package/build/commands/element/getSize.d.ts +6 -0
  161. package/build/commands/element/getSize.d.ts.map +1 -0
  162. package/build/commands/element/getSize.js +47 -0
  163. package/build/commands/element/getTagName.d.ts +25 -0
  164. package/build/commands/element/getTagName.d.ts.map +1 -0
  165. package/build/commands/element/getTagName.js +29 -0
  166. package/build/commands/element/getText.d.ts +42 -0
  167. package/build/commands/element/getText.d.ts.map +1 -0
  168. package/build/commands/element/getText.js +46 -0
  169. package/build/commands/element/getValue.d.ts +25 -0
  170. package/build/commands/element/getValue.d.ts.map +1 -0
  171. package/build/commands/element/getValue.js +33 -0
  172. package/build/commands/element/isClickable.d.ts +40 -0
  173. package/build/commands/element/isClickable.d.ts.map +1 -0
  174. package/build/commands/element/isClickable.js +57 -0
  175. package/build/commands/element/isDisplayed.d.ts +50 -0
  176. package/build/commands/element/isDisplayed.d.ts.map +1 -0
  177. package/build/commands/element/isDisplayed.js +85 -0
  178. package/build/commands/element/isDisplayedInViewport.d.ts +38 -0
  179. package/build/commands/element/isDisplayedInViewport.d.ts.map +1 -0
  180. package/build/commands/element/isDisplayedInViewport.js +55 -0
  181. package/build/commands/element/isEnabled.d.ts +34 -0
  182. package/build/commands/element/isEnabled.d.ts.map +1 -0
  183. package/build/commands/element/isEnabled.js +38 -0
  184. package/build/commands/element/isEqual.d.ts +24 -0
  185. package/build/commands/element/isEqual.d.ts.map +1 -0
  186. package/build/commands/element/isEqual.js +52 -0
  187. package/build/commands/element/isExisting.d.ts +49 -0
  188. package/build/commands/element/isExisting.d.ts.map +1 -0
  189. package/build/commands/element/isExisting.js +65 -0
  190. package/build/commands/element/isFocused.d.ts +28 -0
  191. package/build/commands/element/isFocused.d.ts.map +1 -0
  192. package/build/commands/element/isFocused.js +42 -0
  193. package/build/commands/element/isSelected.d.ts +31 -0
  194. package/build/commands/element/isSelected.d.ts.map +1 -0
  195. package/build/commands/element/isSelected.js +35 -0
  196. package/build/commands/element/moveTo.d.ts +21 -0
  197. package/build/commands/element/moveTo.d.ts.map +1 -0
  198. package/build/commands/element/moveTo.js +39 -0
  199. package/build/commands/element/nextElement.d.ts +25 -0
  200. package/build/commands/element/nextElement.d.ts.map +1 -0
  201. package/build/commands/element/nextElement.js +31 -0
  202. package/build/commands/element/parentElement.d.ts +25 -0
  203. package/build/commands/element/parentElement.d.ts.map +1 -0
  204. package/build/commands/element/parentElement.js +31 -0
  205. package/build/commands/element/previousElement.d.ts +25 -0
  206. package/build/commands/element/previousElement.d.ts.map +1 -0
  207. package/build/commands/element/previousElement.js +31 -0
  208. package/build/commands/element/react$$.d.ts +36 -0
  209. package/build/commands/element/react$$.d.ts.map +1 -0
  210. package/build/commands/element/react$$.js +51 -0
  211. package/build/commands/element/react$.d.ts +46 -0
  212. package/build/commands/element/react$.d.ts.map +1 -0
  213. package/build/commands/element/react$.js +59 -0
  214. package/build/commands/element/saveScreenshot.d.ts +21 -0
  215. package/build/commands/element/saveScreenshot.d.ts.map +1 -0
  216. package/build/commands/element/saveScreenshot.js +40 -0
  217. package/build/commands/element/scrollIntoView.d.ts +21 -0
  218. package/build/commands/element/scrollIntoView.d.ts.map +1 -0
  219. package/build/commands/element/scrollIntoView.js +31 -0
  220. package/build/commands/element/selectByAttribute.d.ts +37 -0
  221. package/build/commands/element/selectByAttribute.d.ts.map +1 -0
  222. package/build/commands/element/selectByAttribute.js +59 -0
  223. package/build/commands/element/selectByIndex.d.ts +31 -0
  224. package/build/commands/element/selectByIndex.d.ts.map +1 -0
  225. package/build/commands/element/selectByIndex.js +55 -0
  226. package/build/commands/element/selectByVisibleText.d.ts +31 -0
  227. package/build/commands/element/selectByVisibleText.d.ts.map +1 -0
  228. package/build/commands/element/selectByVisibleText.js +66 -0
  229. package/build/commands/element/setValue.d.ts +29 -0
  230. package/build/commands/element/setValue.d.ts.map +1 -0
  231. package/build/commands/element/setValue.js +33 -0
  232. package/build/commands/element/shadow$$.d.ts +22 -0
  233. package/build/commands/element/shadow$$.d.ts.map +1 -0
  234. package/build/commands/element/shadow$$.js +27 -0
  235. package/build/commands/element/shadow$.d.ts +22 -0
  236. package/build/commands/element/shadow$.d.ts.map +1 -0
  237. package/build/commands/element/shadow$.js +27 -0
  238. package/build/commands/element/touchAction.d.ts +54 -0
  239. package/build/commands/element/touchAction.d.ts.map +1 -0
  240. package/build/commands/element/touchAction.js +58 -0
  241. package/build/commands/element/waitForClickable.d.ts +34 -0
  242. package/build/commands/element/waitForClickable.d.ts.map +1 -0
  243. package/build/commands/element/waitForClickable.js +37 -0
  244. package/build/commands/element/waitForDisplayed.d.ts +44 -0
  245. package/build/commands/element/waitForDisplayed.d.ts.map +1 -0
  246. package/build/commands/element/waitForDisplayed.js +47 -0
  247. package/build/commands/element/waitForEnabled.d.ts +46 -0
  248. package/build/commands/element/waitForEnabled.d.ts.map +1 -0
  249. package/build/commands/element/waitForEnabled.js +55 -0
  250. package/build/commands/element/waitForExist.d.ts +46 -0
  251. package/build/commands/element/waitForExist.d.ts.map +1 -0
  252. package/build/commands/element/waitForExist.js +49 -0
  253. package/build/commands/element/waitUntil.d.ts +49 -0
  254. package/build/commands/element/waitUntil.d.ts.map +1 -0
  255. package/build/commands/element/waitUntil.js +53 -0
  256. package/build/commands/element.d.ts +100 -0
  257. package/build/commands/element.d.ts.map +1 -0
  258. package/build/commands/element.js +63 -0
  259. package/build/commands/mock/abort.d.ts +19 -0
  260. package/build/commands/mock/abort.d.ts.map +1 -0
  261. package/build/commands/mock/abort.js +20 -0
  262. package/build/commands/mock/abortOnce.d.ts +27 -0
  263. package/build/commands/mock/abortOnce.d.ts.map +1 -0
  264. package/build/commands/mock/abortOnce.js +28 -0
  265. package/build/commands/mock/clear.d.ts +18 -0
  266. package/build/commands/mock/clear.d.ts.map +1 -0
  267. package/build/commands/mock/clear.js +19 -0
  268. package/build/commands/mock/respond.d.ts +54 -0
  269. package/build/commands/mock/respond.d.ts.map +1 -0
  270. package/build/commands/mock/respond.js +55 -0
  271. package/build/commands/mock/respondOnce.d.ts +55 -0
  272. package/build/commands/mock/respondOnce.d.ts.map +1 -0
  273. package/build/commands/mock/respondOnce.js +56 -0
  274. package/build/commands/mock/restore.d.ts +18 -0
  275. package/build/commands/mock/restore.d.ts.map +1 -0
  276. package/build/commands/mock/restore.js +19 -0
  277. package/build/constants.d.ts +14 -0
  278. package/build/constants.d.ts.map +1 -0
  279. package/build/constants.js +286 -0
  280. package/build/index.d.ts +45 -0
  281. package/build/index.d.ts.map +1 -0
  282. package/build/index.js +175 -0
  283. package/build/middlewares.d.ts +12 -0
  284. package/build/middlewares.d.ts.map +1 -0
  285. package/build/middlewares.js +65 -0
  286. package/build/multiremote.d.ts +71 -0
  287. package/build/multiremote.d.ts.map +1 -0
  288. package/build/multiremote.js +160 -0
  289. package/build/protocol-stub.d.ts +16 -0
  290. package/build/protocol-stub.d.ts.map +1 -0
  291. package/build/protocol-stub.js +77 -0
  292. package/build/scripts/getHTML.d.ts +9 -0
  293. package/build/scripts/getHTML.d.ts.map +1 -0
  294. package/build/scripts/getHTML.js +13 -0
  295. package/build/scripts/getProperty.d.ts +43 -0
  296. package/build/scripts/getProperty.d.ts.map +1 -0
  297. package/build/scripts/getProperty.js +12 -0
  298. package/build/scripts/isElementClickable.d.ts +7 -0
  299. package/build/scripts/isElementClickable.d.ts.map +1 -0
  300. package/build/scripts/isElementClickable.js +121 -0
  301. package/build/scripts/isElementDisplayed.d.ts +7 -0
  302. package/build/scripts/isElementDisplayed.d.ts.map +1 -0
  303. package/build/scripts/isElementDisplayed.js +216 -0
  304. package/build/scripts/isElementInViewport.d.ts +10 -0
  305. package/build/scripts/isElementInViewport.d.ts.map +1 -0
  306. package/build/scripts/isElementInViewport.js +22 -0
  307. package/build/scripts/isFocused.d.ts +7 -0
  308. package/build/scripts/isFocused.d.ts.map +1 -0
  309. package/build/scripts/isFocused.js +11 -0
  310. package/build/scripts/newWindow.d.ts +10 -0
  311. package/build/scripts/newWindow.d.ts.map +1 -0
  312. package/build/scripts/newWindow.js +14 -0
  313. package/build/scripts/resq.d.ts +6 -0
  314. package/build/scripts/resq.d.ts.map +1 -0
  315. package/build/scripts/resq.js +58 -0
  316. package/build/scripts/shadowFnFactory.d.ts +2 -0
  317. package/build/scripts/shadowFnFactory.d.ts.map +1 -0
  318. package/build/scripts/shadowFnFactory.js +17 -0
  319. package/build/types.d.ts +402 -0
  320. package/build/types.d.ts.map +1 -0
  321. package/build/types.js +2 -0
  322. package/build/utils/SevereServiceError.d.ts +7 -0
  323. package/build/utils/SevereServiceError.d.ts.map +1 -0
  324. package/build/utils/SevereServiceError.js +12 -0
  325. package/build/utils/Timer.d.ts +33 -0
  326. package/build/utils/Timer.d.ts.map +1 -0
  327. package/build/utils/Timer.js +126 -0
  328. package/build/utils/detectBackend.d.ts +23 -0
  329. package/build/utils/detectBackend.d.ts.map +1 -0
  330. package/build/utils/detectBackend.js +119 -0
  331. package/build/utils/findStrategy.d.ts +10 -0
  332. package/build/utils/findStrategy.d.ts.map +1 -0
  333. package/build/utils/findStrategy.js +267 -0
  334. package/build/utils/getElementObject.d.ts +17 -0
  335. package/build/utils/getElementObject.d.ts.map +1 -0
  336. package/build/utils/getElementObject.js +107 -0
  337. package/build/utils/implicitWait.d.ts +7 -0
  338. package/build/utils/implicitWait.d.ts.map +1 -0
  339. package/build/utils/implicitWait.js +39 -0
  340. package/build/utils/index.d.ts +102 -0
  341. package/build/utils/index.d.ts.map +1 -0
  342. package/build/utils/index.js +543 -0
  343. package/build/utils/interception/devtools.d.ts +61 -0
  344. package/build/utils/interception/devtools.d.ts.map +1 -0
  345. package/build/utils/interception/devtools.js +247 -0
  346. package/build/utils/interception/index.d.ts +26 -0
  347. package/build/utils/interception/index.d.ts.map +1 -0
  348. package/build/utils/interception/index.js +49 -0
  349. package/build/utils/interception/types.d.ts +94 -0
  350. package/build/utils/interception/types.d.ts.map +1 -0
  351. package/build/utils/interception/types.js +2 -0
  352. package/build/utils/interception/webdriver.d.ts +48 -0
  353. package/build/utils/interception/webdriver.d.ts.map +1 -0
  354. package/build/utils/interception/webdriver.js +75 -0
  355. package/build/utils/refetchElement.d.ts +6 -0
  356. package/build/utils/refetchElement.d.ts.map +1 -0
  357. package/build/utils/refetchElement.js +32 -0
  358. package/package.json +10 -10
@@ -0,0 +1,42 @@
1
+ /**
2
+ *
3
+ * Get the text content from a DOM-element. Make sure the element
4
+ * you want to request the text from [is interactable](http://www.w3.org/TR/webdriver/#interactable)
5
+ * otherwise you will get an empty string as return value. If the element is disabled or not
6
+ * visible and you still want to receive the text content use [getHTML](https://webdriver.io/docs/api/element/getHTML)
7
+ * as a workaround.
8
+ *
9
+ * <example>
10
+ :index.html
11
+ <div id="elem">
12
+ Lorem ipsum <strong>dolor</strong> sit amet,<br />
13
+ consetetur sadipscing elitr
14
+ </div>
15
+ <span style="display: none">I am invisible</span>
16
+ :getText.js
17
+ it('should demonstrate the getText function', async () => {
18
+ const elem = await $('#elem');
19
+ console.log(await elem.getText());
20
+ // outputs the following:
21
+ // "Lorem ipsum dolor sit amet,consetetur sadipscing elitr"
22
+
23
+ const span = await $('span');
24
+ console.log(await span.getText());
25
+ // outputs "" (empty string) since element is not interactable
26
+ });
27
+ it('get content from table cell', async () => {
28
+ await browser.url('http://the-internet.herokuapp.com/tables');
29
+ const rows = await $$('#table1 tr');
30
+ const columns = await rows[1].$$('td'); // get columns of 2nd row
31
+ console.log(await columns[2].getText()); // get text of 3rd column
32
+ });
33
+ * </example>
34
+ *
35
+ * @alias element.getText
36
+ * @return {String} content of selected element (all HTML tags are removed)
37
+ * @uses protocol/elements, protocol/elementIdText
38
+ * @type property
39
+ *
40
+ */
41
+ export default function getText(this: WebdriverIO.Element): Promise<string>;
42
+ //# sourceMappingURL=getText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getText.d.ts","sourceRoot":"","sources":["../../../src/commands/element/getText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,mBAEzD"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ *
5
+ * Get the text content from a DOM-element. Make sure the element
6
+ * you want to request the text from [is interactable](http://www.w3.org/TR/webdriver/#interactable)
7
+ * otherwise you will get an empty string as return value. If the element is disabled or not
8
+ * visible and you still want to receive the text content use [getHTML](https://webdriver.io/docs/api/element/getHTML)
9
+ * as a workaround.
10
+ *
11
+ * <example>
12
+ :index.html
13
+ <div id="elem">
14
+ Lorem ipsum <strong>dolor</strong> sit amet,<br />
15
+ consetetur sadipscing elitr
16
+ </div>
17
+ <span style="display: none">I am invisible</span>
18
+ :getText.js
19
+ it('should demonstrate the getText function', async () => {
20
+ const elem = await $('#elem');
21
+ console.log(await elem.getText());
22
+ // outputs the following:
23
+ // "Lorem ipsum dolor sit amet,consetetur sadipscing elitr"
24
+
25
+ const span = await $('span');
26
+ console.log(await span.getText());
27
+ // outputs "" (empty string) since element is not interactable
28
+ });
29
+ it('get content from table cell', async () => {
30
+ await browser.url('http://the-internet.herokuapp.com/tables');
31
+ const rows = await $$('#table1 tr');
32
+ const columns = await rows[1].$$('td'); // get columns of 2nd row
33
+ console.log(await columns[2].getText()); // get text of 3rd column
34
+ });
35
+ * </example>
36
+ *
37
+ * @alias element.getText
38
+ * @return {String} content of selected element (all HTML tags are removed)
39
+ * @uses protocol/elements, protocol/elementIdText
40
+ * @type property
41
+ *
42
+ */
43
+ function getText() {
44
+ return this.getElementText(this.elementId);
45
+ }
46
+ exports.default = getText;
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * Get the value of a `<textarea>`, `<select>` or text `<input>` found by given selector.
4
+ * If multiple elements are found via the given selector, an array of values is returned instead.
5
+ * For input with checkbox or radio type use isSelected.
6
+ *
7
+ * <example>
8
+ :index.html
9
+ <input type="text" value="John Doe" id="username">
10
+ :getValue.js
11
+ it('should demonstrate the getValue command', async () => {
12
+ const inputUser = await $('#username');
13
+ const value = await inputUser.getValue();
14
+ console.log(value); // outputs: "John Doe"
15
+ });
16
+ * </example>
17
+ *
18
+ * @alias element.getValue
19
+ * @return {String} requested element(s) value
20
+ * @uses protocol/elements, protocol/elementIdProperty
21
+ * @type property
22
+ *
23
+ */
24
+ export default function getValue(this: WebdriverIO.Element): Promise<string>;
25
+ //# sourceMappingURL=getValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getValue.d.ts","sourceRoot":"","sources":["../../../src/commands/element/getValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,mBAO1D"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ *
5
+ * Get the value of a `<textarea>`, `<select>` or text `<input>` found by given selector.
6
+ * If multiple elements are found via the given selector, an array of values is returned instead.
7
+ * For input with checkbox or radio type use isSelected.
8
+ *
9
+ * <example>
10
+ :index.html
11
+ <input type="text" value="John Doe" id="username">
12
+ :getValue.js
13
+ it('should demonstrate the getValue command', async () => {
14
+ const inputUser = await $('#username');
15
+ const value = await inputUser.getValue();
16
+ console.log(value); // outputs: "John Doe"
17
+ });
18
+ * </example>
19
+ *
20
+ * @alias element.getValue
21
+ * @return {String} requested element(s) value
22
+ * @uses protocol/elements, protocol/elementIdProperty
23
+ * @type property
24
+ *
25
+ */
26
+ function getValue() {
27
+ // `!this.isMobile` added to workaround https://github.com/appium/appium/issues/12218
28
+ if (this.isW3C && !this.isMobile) {
29
+ return this.getElementProperty(this.elementId, 'value');
30
+ }
31
+ return this.getElementAttribute(this.elementId, 'value');
32
+ }
33
+ exports.default = getValue;
@@ -0,0 +1,40 @@
1
+ /**
2
+ *
3
+ * Return true if the selected DOM-element:
4
+ *
5
+ * - exists
6
+ * - is visible
7
+ * - is within viewport (if not try scroll to it)
8
+ * - its center is not overlapped with another element
9
+ * - is not disabled
10
+ *
11
+ * otherwise return false.
12
+ *
13
+ * :::info
14
+ *
15
+ * Please note that `isClickable` works only in web browser and in mobile webviews,
16
+ * it doesn't work in mobile app native context. Also, As opposed to other element
17
+ * commands WebdriverIO will not wait for the element to exist to execute this command.
18
+ *
19
+ * :::
20
+ *
21
+ * <example>
22
+ :isClickable.js
23
+ it('should detect if an element is clickable', async () => {
24
+ const el = await $('#el')
25
+ let clickable = await el.isClickable();
26
+ console.log(clickable); // outputs: true or false
27
+
28
+ // wait for element to be clickable
29
+ await browser.waitUntil(() => el.isClickable())
30
+ });
31
+ * </example>
32
+ *
33
+ * @alias element.isClickable
34
+ * @return {Boolean} true if element is clickable
35
+ * @uses protocol/selectorExecute, protocol/timeoutsAsyncScript
36
+ * @type state
37
+ *
38
+ */
39
+ export default function isClickable(this: WebdriverIO.Element): Promise<boolean>;
40
+ //# sourceMappingURL=isClickable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isClickable.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isClickable.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAA8B,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAUnE"}
@@ -0,0 +1,57 @@
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 constants_1 = require("../../constants");
7
+ const utils_1 = require("../../utils");
8
+ const isElementClickable_1 = __importDefault(require("../../scripts/isElementClickable"));
9
+ /**
10
+ *
11
+ * Return true if the selected DOM-element:
12
+ *
13
+ * - exists
14
+ * - is visible
15
+ * - is within viewport (if not try scroll to it)
16
+ * - its center is not overlapped with another element
17
+ * - is not disabled
18
+ *
19
+ * otherwise return false.
20
+ *
21
+ * :::info
22
+ *
23
+ * Please note that `isClickable` works only in web browser and in mobile webviews,
24
+ * it doesn't work in mobile app native context. Also, As opposed to other element
25
+ * commands WebdriverIO will not wait for the element to exist to execute this command.
26
+ *
27
+ * :::
28
+ *
29
+ * <example>
30
+ :isClickable.js
31
+ it('should detect if an element is clickable', async () => {
32
+ const el = await $('#el')
33
+ let clickable = await el.isClickable();
34
+ console.log(clickable); // outputs: true or false
35
+
36
+ // wait for element to be clickable
37
+ await browser.waitUntil(() => el.isClickable())
38
+ });
39
+ * </example>
40
+ *
41
+ * @alias element.isClickable
42
+ * @return {Boolean} true if element is clickable
43
+ * @uses protocol/selectorExecute, protocol/timeoutsAsyncScript
44
+ * @type state
45
+ *
46
+ */
47
+ async function isClickable() {
48
+ if (!await this.isDisplayed()) {
49
+ return false;
50
+ }
51
+ const browser = (0, utils_1.getBrowserObject)(this);
52
+ return browser.execute(isElementClickable_1.default, {
53
+ [constants_1.ELEMENT_KEY]: this.elementId,
54
+ ELEMENT: this.elementId // jsonwp compatible
55
+ });
56
+ }
57
+ exports.default = isClickable;
@@ -0,0 +1,50 @@
1
+ /**
2
+ *
3
+ * Return true if the selected DOM-element is displayed.
4
+ *
5
+ * :::info
6
+ *
7
+ * As opposed to other element commands WebdriverIO will not wait for the element
8
+ * to exist to execute this command.
9
+ *
10
+ * :::
11
+ *
12
+ * <example>
13
+ :index.html
14
+ <div id="notDisplayed" style="display: none"></div>
15
+ <div id="notVisible" style="visibility: hidden"></div>
16
+ <div id="notInViewport" style="position:absolute; left: 9999999"></div>
17
+ <div id="zeroOpacity" style="opacity: 0"></div>
18
+ :isDisplayed.js
19
+ it('should detect if an element is displayed', async () => {
20
+ let elem = await $('#notDisplayed');
21
+ let isDisplayed = await elem.isDisplayed();
22
+ console.log(isDisplayed); // outputs: false
23
+
24
+ elem = await $('#notVisible');
25
+
26
+ isDisplayed = await elem.isDisplayed();
27
+ console.log(isDisplayed); // outputs: false
28
+
29
+ elem = await $('#notExisting');
30
+ isDisplayed = await elem.isDisplayed();
31
+ console.log(isDisplayed); // outputs: false
32
+
33
+ elem = await $('#notInViewport');
34
+ isDisplayed = await elem.isDisplayed();
35
+ console.log(isDisplayed); // outputs: true
36
+
37
+ elem = await $('#zeroOpacity');
38
+ isDisplayed = await elem.isDisplayed();
39
+ console.log(isDisplayed); // outputs: true
40
+ });
41
+ * </example>
42
+ *
43
+ * @alias element.isDisplayed
44
+ * @return {Boolean} true if element is displayed
45
+ * @uses protocol/elements, protocol/elementIdDisplayed
46
+ * @type state
47
+ *
48
+ */
49
+ export default function isDisplayed(this: WebdriverIO.Element): Promise<boolean>;
50
+ //# sourceMappingURL=isDisplayed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isDisplayed.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAA8B,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAgCnE"}
@@ -0,0 +1,85 @@
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 constants_1 = require("../../constants");
7
+ const utils_1 = require("../../utils");
8
+ const isElementDisplayed_1 = __importDefault(require("../../scripts/isElementDisplayed"));
9
+ const noW3CEndpoint = ['microsoftedge', 'msedge', 'safari', 'chrome', 'safari technology preview'];
10
+ /**
11
+ *
12
+ * Return true if the selected DOM-element is displayed.
13
+ *
14
+ * :::info
15
+ *
16
+ * As opposed to other element commands WebdriverIO will not wait for the element
17
+ * to exist to execute this command.
18
+ *
19
+ * :::
20
+ *
21
+ * <example>
22
+ :index.html
23
+ <div id="notDisplayed" style="display: none"></div>
24
+ <div id="notVisible" style="visibility: hidden"></div>
25
+ <div id="notInViewport" style="position:absolute; left: 9999999"></div>
26
+ <div id="zeroOpacity" style="opacity: 0"></div>
27
+ :isDisplayed.js
28
+ it('should detect if an element is displayed', async () => {
29
+ let elem = await $('#notDisplayed');
30
+ let isDisplayed = await elem.isDisplayed();
31
+ console.log(isDisplayed); // outputs: false
32
+
33
+ elem = await $('#notVisible');
34
+
35
+ isDisplayed = await elem.isDisplayed();
36
+ console.log(isDisplayed); // outputs: false
37
+
38
+ elem = await $('#notExisting');
39
+ isDisplayed = await elem.isDisplayed();
40
+ console.log(isDisplayed); // outputs: false
41
+
42
+ elem = await $('#notInViewport');
43
+ isDisplayed = await elem.isDisplayed();
44
+ console.log(isDisplayed); // outputs: true
45
+
46
+ elem = await $('#zeroOpacity');
47
+ isDisplayed = await elem.isDisplayed();
48
+ console.log(isDisplayed); // outputs: true
49
+ });
50
+ * </example>
51
+ *
52
+ * @alias element.isDisplayed
53
+ * @return {Boolean} true if element is displayed
54
+ * @uses protocol/elements, protocol/elementIdDisplayed
55
+ * @type state
56
+ *
57
+ */
58
+ async function isDisplayed() {
59
+ var _a;
60
+ const browser = (0, utils_1.getBrowserObject)(this);
61
+ if (!await (0, utils_1.hasElementId)(this)) {
62
+ return false;
63
+ }
64
+ /*
65
+ * https://www.w3.org/TR/webdriver/#element-displayedness
66
+ * Certain drivers have decided to remove the endpoint as the spec
67
+ * no longer dictates it. In those instances, we pass the element through a script
68
+ * that was provided by Brian Burg, maintainer of Safaridriver.
69
+ *
70
+ * 6th of May 2019 APPIUM response (mykola-mokhnach) :
71
+ * - Appium didn't enable W3C mode for mobile drivers.
72
+ * - Safari and Chrome work in jsonwp mode and Appium just rewrites W3C requests from upstream to jsonwp if needed
73
+ */
74
+ const useAtom = (await browser.isDevTools ||
75
+ (await browser.isW3C &&
76
+ !browser.isMobile &&
77
+ noW3CEndpoint.includes((_a = browser.capabilities.browserName) === null || _a === void 0 ? void 0 : _a.toLowerCase())));
78
+ return useAtom
79
+ ? await browser.execute(isElementDisplayed_1.default, {
80
+ [constants_1.ELEMENT_KEY]: this.elementId,
81
+ ELEMENT: this.elementId // jsonwp compatible
82
+ }) :
83
+ await this.isElementDisplayed(this.elementId);
84
+ }
85
+ exports.default = isDisplayed;
@@ -0,0 +1,38 @@
1
+ /**
2
+ *
3
+ * Return true if the selected DOM-element found by given selector is partially visible and within the viewport.
4
+ *
5
+ * <example>
6
+ :index.html
7
+ <div id="notDisplayed" style="display: none"></div>
8
+ <div id="notVisible" style="visibility: hidden"></div>
9
+ <div id="notInViewport" style="position:absolute; left: 9999999"></div>
10
+ <div id="zeroOpacity" style="opacity: 0"></div>
11
+ :isDisplayedInViewport.js
12
+ :isDisplayed.js
13
+ it('should detect if an element is visible', async () => {
14
+ let isDisplayedInViewport = await $('#notDisplayed').isDisplayedInViewport();
15
+ console.log(isDisplayedInViewport); // outputs: false
16
+
17
+ isDisplayedInViewport = await $('#notVisible').isDisplayedInViewport();
18
+ console.log(isDisplayedInViewport); // outputs: false
19
+
20
+ isDisplayedInViewport = await $('#notExisting').isDisplayedInViewport();
21
+ console.log(isDisplayedInViewport); // outputs: false
22
+
23
+ isDisplayedInViewport = await $('#notInViewport').isDisplayedInViewport();
24
+ console.log(isDisplayedInViewport); // outputs: false
25
+
26
+ isDisplayedInViewport = await $('#zeroOpacity').isDisplayedInViewport();
27
+ console.log(isDisplayedInViewport); // outputs: false
28
+ });
29
+ * </example>
30
+ *
31
+ * @alias element.isDisplayedInViewport
32
+ * @return {Boolean} true if element(s)* [is|are] displayed
33
+ * @uses protocol/selectorExecute, protocol/timeoutsAsyncScript
34
+ * @type state
35
+ *
36
+ */
37
+ export default function isDisplayedInViewport(this: WebdriverIO.Element): Promise<boolean>;
38
+ //# sourceMappingURL=isDisplayedInViewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDisplayedInViewport.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isDisplayedInViewport.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAA8B,qBAAqB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAU7E"}
@@ -0,0 +1,55 @@
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 constants_1 = require("../../constants");
7
+ const utils_1 = require("../../utils");
8
+ const isElementInViewport_1 = __importDefault(require("../../scripts/isElementInViewport"));
9
+ /**
10
+ *
11
+ * Return true if the selected DOM-element found by given selector is partially visible and within the viewport.
12
+ *
13
+ * <example>
14
+ :index.html
15
+ <div id="notDisplayed" style="display: none"></div>
16
+ <div id="notVisible" style="visibility: hidden"></div>
17
+ <div id="notInViewport" style="position:absolute; left: 9999999"></div>
18
+ <div id="zeroOpacity" style="opacity: 0"></div>
19
+ :isDisplayedInViewport.js
20
+ :isDisplayed.js
21
+ it('should detect if an element is visible', async () => {
22
+ let isDisplayedInViewport = await $('#notDisplayed').isDisplayedInViewport();
23
+ console.log(isDisplayedInViewport); // outputs: false
24
+
25
+ isDisplayedInViewport = await $('#notVisible').isDisplayedInViewport();
26
+ console.log(isDisplayedInViewport); // outputs: false
27
+
28
+ isDisplayedInViewport = await $('#notExisting').isDisplayedInViewport();
29
+ console.log(isDisplayedInViewport); // outputs: false
30
+
31
+ isDisplayedInViewport = await $('#notInViewport').isDisplayedInViewport();
32
+ console.log(isDisplayedInViewport); // outputs: false
33
+
34
+ isDisplayedInViewport = await $('#zeroOpacity').isDisplayedInViewport();
35
+ console.log(isDisplayedInViewport); // outputs: false
36
+ });
37
+ * </example>
38
+ *
39
+ * @alias element.isDisplayedInViewport
40
+ * @return {Boolean} true if element(s)* [is|are] displayed
41
+ * @uses protocol/selectorExecute, protocol/timeoutsAsyncScript
42
+ * @type state
43
+ *
44
+ */
45
+ async function isDisplayedInViewport() {
46
+ if (!await this.isDisplayed()) {
47
+ return false;
48
+ }
49
+ const browser = (0, utils_1.getBrowserObject)(this);
50
+ return browser.execute(isElementInViewport_1.default, {
51
+ [constants_1.ELEMENT_KEY]: this.elementId,
52
+ ELEMENT: this.elementId // jsonwp compatible
53
+ });
54
+ }
55
+ exports.default = isDisplayedInViewport;
@@ -0,0 +1,34 @@
1
+ /**
2
+ *
3
+ * Return true or false if the selected DOM-element is enabled.
4
+ *
5
+ * <example>
6
+ :index.html
7
+ <input type="text" name="inputField" class="input1">
8
+ <input type="text" name="inputField" class="input2" disabled>
9
+ <input type="text" name="inputField" class="input3" disabled="disabled">
10
+
11
+ :isEnabled.js
12
+ it('should detect if an element is enabled', async () => {
13
+ let elem = await $('.input1')
14
+ let isEnabled = await elem.isEnabled();
15
+ console.log(isEnabled); // outputs: true
16
+
17
+ elem = await $('.input2')
18
+ isEnabled = await elem.isEnabled();
19
+ console.log(isEnabled2); // outputs: false
20
+
21
+ elem = await $('.input3')
22
+ isEnabled = await elem.isEnabled();
23
+ console.log(isEnabled3); // outputs: false
24
+ });
25
+ * </example>
26
+ *
27
+ * @alias element.isEnabled
28
+ * @return {Boolean} true if element(s)* (is|are) enabled
29
+ * @uses protocol/elements, protocol/elementIdEnabled
30
+ * @type state
31
+ *
32
+ */
33
+ export default function isEnabled(this: WebdriverIO.Element): Promise<boolean>;
34
+ //# sourceMappingURL=isEnabled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isEnabled.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isEnabled.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAE3D"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ *
5
+ * Return true or false if the selected DOM-element is enabled.
6
+ *
7
+ * <example>
8
+ :index.html
9
+ <input type="text" name="inputField" class="input1">
10
+ <input type="text" name="inputField" class="input2" disabled>
11
+ <input type="text" name="inputField" class="input3" disabled="disabled">
12
+
13
+ :isEnabled.js
14
+ it('should detect if an element is enabled', async () => {
15
+ let elem = await $('.input1')
16
+ let isEnabled = await elem.isEnabled();
17
+ console.log(isEnabled); // outputs: true
18
+
19
+ elem = await $('.input2')
20
+ isEnabled = await elem.isEnabled();
21
+ console.log(isEnabled2); // outputs: false
22
+
23
+ elem = await $('.input3')
24
+ isEnabled = await elem.isEnabled();
25
+ console.log(isEnabled3); // outputs: false
26
+ });
27
+ * </example>
28
+ *
29
+ * @alias element.isEnabled
30
+ * @return {Boolean} true if element(s)* (is|are) enabled
31
+ * @uses protocol/elements, protocol/elementIdEnabled
32
+ * @type state
33
+ *
34
+ */
35
+ function isEnabled() {
36
+ return this.isElementEnabled(this.elementId);
37
+ }
38
+ exports.default = isEnabled;
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * Return true if the selected element matches with the provided one.
4
+ *
5
+ * <example>
6
+ :isEqual.js
7
+ it('should detect if an element is clickable', async () => {
8
+ const el = await $('#el')
9
+ const sameEl = await $('#el')
10
+ const anotherEl = await $('#anotherEl')
11
+
12
+ el.isEqual(sameEl) // outputs: true
13
+
14
+ el.isEqual(anotherEl) // outputs: false
15
+ });
16
+ * </example>
17
+ *
18
+ * @alias element.isEqual
19
+ * @param {Element} el element to compare with
20
+ * @return {Boolean} true if elements are equal
21
+ *
22
+ */
23
+ export default function isEqual(this: WebdriverIO.Element, el: WebdriverIO.Element): Promise<boolean>;
24
+ //# sourceMappingURL=isEqual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isEqual.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isEqual.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EAAE,EAAE,WAAW,CAAC,OAAO,oBAwB1B"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const constants_1 = require("../../constants");
4
+ const utils_1 = require("../../utils");
5
+ const getWebElement = (el) => ({
6
+ [constants_1.ELEMENT_KEY]: el.elementId,
7
+ ELEMENT: el.elementId // jsonwp compatible
8
+ });
9
+ /**
10
+ *
11
+ * Return true if the selected element matches with the provided one.
12
+ *
13
+ * <example>
14
+ :isEqual.js
15
+ it('should detect if an element is clickable', async () => {
16
+ const el = await $('#el')
17
+ const sameEl = await $('#el')
18
+ const anotherEl = await $('#anotherEl')
19
+
20
+ el.isEqual(sameEl) // outputs: true
21
+
22
+ el.isEqual(anotherEl) // outputs: false
23
+ });
24
+ * </example>
25
+ *
26
+ * @alias element.isEqual
27
+ * @param {Element} el element to compare with
28
+ * @return {Boolean} true if elements are equal
29
+ *
30
+ */
31
+ async function isEqual(el) {
32
+ const browser = (0, utils_1.getBrowserObject)(this);
33
+ // mobile native
34
+ if (browser.isMobile) {
35
+ const context = await browser.getContext();
36
+ if (context === null || context === void 0 ? void 0 : context.toLowerCase().includes('native')) {
37
+ return this.elementId === el.elementId;
38
+ }
39
+ }
40
+ // browser or webview
41
+ let result;
42
+ try {
43
+ result = await browser.execute(
44
+ /* istanbul ignore next */
45
+ (el1, el2) => el1 === el2, getWebElement(this), getWebElement(el));
46
+ }
47
+ catch (err) {
48
+ result = false;
49
+ }
50
+ return result;
51
+ }
52
+ exports.default = isEqual;