selenium-webdriver 3.5.0 → 4.0.0-alpha.4

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 (366) hide show
  1. package/CHANGES.md +246 -0
  2. package/LICENSE +1 -1
  3. package/NOTICE +1 -1
  4. package/README.md +40 -40
  5. package/chrome.js +118 -134
  6. package/edge.js +43 -117
  7. package/example/chrome_android.js +8 -9
  8. package/example/chrome_mobile_emulation.js +8 -9
  9. package/example/firefox_channels.js +23 -19
  10. package/example/google_search.js +3 -3
  11. package/example/google_search_test.js +38 -27
  12. package/example/{chrome_headless.js → headless.js} +15 -7
  13. package/example/logging.js +40 -7
  14. package/firefox.js +789 -0
  15. package/http/index.js +62 -9
  16. package/http/util.js +11 -6
  17. package/ie.js +83 -97
  18. package/index.js +198 -114
  19. package/io/exec.js +29 -15
  20. package/io/index.js +1 -1
  21. package/io/zip.js +1 -1
  22. package/lib/actions.js +68 -63
  23. package/lib/atoms/get-attribute.js +86 -0
  24. package/lib/atoms/is-displayed.js +76 -76
  25. package/lib/by.js +7 -4
  26. package/lib/capabilities.js +310 -210
  27. package/lib/command.js +27 -51
  28. package/lib/error.js +100 -41
  29. package/lib/http.js +161 -120
  30. package/lib/input.js +1044 -8
  31. package/lib/logging.js +1 -5
  32. package/lib/promise.js +222 -3331
  33. package/lib/proxy.js +134 -39
  34. package/lib/session.js +2 -2
  35. package/lib/symbols.js +0 -0
  36. package/lib/until.js +1 -1
  37. package/lib/webdriver.js +717 -953
  38. package/net/index.js +21 -25
  39. package/net/portprober.js +51 -68
  40. package/package.json +17 -12
  41. package/proxy.js +0 -0
  42. package/remote/index.js +63 -44
  43. package/safari.js +41 -128
  44. package/testing/index.js +386 -315
  45. package/.npmignore +0 -2
  46. package/example/async_await_test.js +0 -68
  47. package/example/google_search_generator.js +0 -50
  48. package/example/parallel_flows.js +0 -54
  49. package/firefox/binary.js +0 -344
  50. package/firefox/extension.js +0 -224
  51. package/firefox/index.js +0 -626
  52. package/firefox/profile.js +0 -394
  53. package/lib/README +0 -5
  54. package/lib/atoms/getAttribute.js +0 -9
  55. package/lib/devmode.js +0 -34
  56. package/lib/events.js +0 -210
  57. package/lib/firefox/webdriver.json +0 -70
  58. package/lib/test/build.js +0 -151
  59. package/lib/test/data/ClickTest_testClicksASurroundingStrongTag.html +0 -11
  60. package/lib/test/data/Page.aspx +0 -17
  61. package/lib/test/data/Page.aspx.cs +0 -22
  62. package/lib/test/data/Redirect.aspx +0 -11
  63. package/lib/test/data/Redirect.aspx.cs +0 -9
  64. package/lib/test/data/Settings.StyleCop +0 -759
  65. package/lib/test/data/Web.Config +0 -59
  66. package/lib/test/data/actualXhtmlPage.xhtml +0 -14
  67. package/lib/test/data/ajaxy_page.html +0 -81
  68. package/lib/test/data/alerts.html +0 -85
  69. package/lib/test/data/banner.gif +0 -0
  70. package/lib/test/data/beach.jpg +0 -0
  71. package/lib/test/data/blank.html +0 -1
  72. package/lib/test/data/bodyTypingTest.html +0 -41
  73. package/lib/test/data/booleanAttributes.html +0 -19
  74. package/lib/test/data/child/childPage.html +0 -8
  75. package/lib/test/data/child/grandchild/grandchildPage.html +0 -8
  76. package/lib/test/data/clickEventPage.html +0 -26
  77. package/lib/test/data/click_frames.html +0 -10
  78. package/lib/test/data/click_jacker.html +0 -38
  79. package/lib/test/data/click_out_of_bounds.html +0 -23
  80. package/lib/test/data/click_out_of_bounds_overflow.html +0 -85
  81. package/lib/test/data/click_rtl.html +0 -19
  82. package/lib/test/data/click_source.html +0 -18
  83. package/lib/test/data/click_tests/click_iframe.html +0 -6
  84. package/lib/test/data/click_tests/click_in_iframe.html +0 -8
  85. package/lib/test/data/click_tests/disabled_element.html +0 -12
  86. package/lib/test/data/click_tests/disappearing_element.html +0 -62
  87. package/lib/test/data/click_tests/google_map.html +0 -15
  88. package/lib/test/data/click_tests/google_map.png +0 -0
  89. package/lib/test/data/click_tests/html5_submit_buttons.html +0 -16
  90. package/lib/test/data/click_tests/issue5237.html +0 -9
  91. package/lib/test/data/click_tests/issue5237_frame.html +0 -1
  92. package/lib/test/data/click_tests/issue5237_target.html +0 -10
  93. package/lib/test/data/click_tests/link_that_wraps.html +0 -11
  94. package/lib/test/data/click_tests/mapped_page1.html +0 -9
  95. package/lib/test/data/click_tests/mapped_page2.html +0 -9
  96. package/lib/test/data/click_tests/mapped_page3.html +0 -9
  97. package/lib/test/data/click_tests/overlapping_elements.html +0 -70
  98. package/lib/test/data/click_tests/partially_overlapping_elements.html +0 -124
  99. package/lib/test/data/click_tests/span_that_wraps.html +0 -11
  100. package/lib/test/data/click_tests/submitted_page.html +0 -9
  101. package/lib/test/data/click_tests/wrapped_overlapping_elements.html +0 -13
  102. package/lib/test/data/click_too_big.html +0 -10
  103. package/lib/test/data/click_too_big_in_frame.html +0 -11
  104. package/lib/test/data/clicks.html +0 -35
  105. package/lib/test/data/closeable_window.html +0 -8
  106. package/lib/test/data/cn-test.html +0 -156
  107. package/lib/test/data/colorPage.html +0 -20
  108. package/lib/test/data/cookies.html +0 -30
  109. package/lib/test/data/coordinates_tests/element_in_frame.html +0 -9
  110. package/lib/test/data/coordinates_tests/element_in_nested_frame.html +0 -9
  111. package/lib/test/data/coordinates_tests/page_with_element_out_of_view.html +0 -11
  112. package/lib/test/data/coordinates_tests/page_with_empty_element.html +0 -10
  113. package/lib/test/data/coordinates_tests/page_with_fixed_element.html +0 -12
  114. package/lib/test/data/coordinates_tests/page_with_hidden_element.html +0 -10
  115. package/lib/test/data/coordinates_tests/page_with_invisible_element.html +0 -10
  116. package/lib/test/data/coordinates_tests/page_with_transparent_element.html +0 -10
  117. package/lib/test/data/coordinates_tests/simple_page.html +0 -10
  118. package/lib/test/data/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  119. package/lib/test/data/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  120. package/lib/test/data/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  121. package/lib/test/data/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  122. package/lib/test/data/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  123. package/lib/test/data/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  124. package/lib/test/data/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  125. package/lib/test/data/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  126. package/lib/test/data/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  127. package/lib/test/data/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  128. package/lib/test/data/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  129. package/lib/test/data/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  130. package/lib/test/data/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  131. package/lib/test/data/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  132. package/lib/test/data/css/ui-lightness/jquery-ui-1.8.10.custom.css +0 -573
  133. package/lib/test/data/cssTransform.html +0 -61
  134. package/lib/test/data/cssTransform2.html +0 -20
  135. package/lib/test/data/document_write_in_onload.html +0 -13
  136. package/lib/test/data/dragAndDropInsideScrolledDiv.html +0 -67
  137. package/lib/test/data/dragAndDropTest.html +0 -102
  138. package/lib/test/data/dragDropOverflow.html +0 -104
  139. package/lib/test/data/draggableLists.html +0 -67
  140. package/lib/test/data/droppableItems.html +0 -65
  141. package/lib/test/data/dynamic.html +0 -39
  142. package/lib/test/data/dynamicallyModifiedPage.html +0 -42
  143. package/lib/test/data/errors.html +0 -15
  144. package/lib/test/data/firefox/jetpack-sample.xpi +0 -0
  145. package/lib/test/data/firefox/sample.xpi +0 -0
  146. package/lib/test/data/firefox/webextension.xpi +0 -0
  147. package/lib/test/data/fixedFooterNoScroll.html +0 -13
  148. package/lib/test/data/fixedFooterNoScrollQuirksMode.html +0 -12
  149. package/lib/test/data/formPage.html +0 -175
  150. package/lib/test/data/formSelectionPage.html +0 -46
  151. package/lib/test/data/form_handling_js_submit.html +0 -30
  152. package/lib/test/data/framePage3.html +0 -7
  153. package/lib/test/data/frameScrollChild.html +0 -26
  154. package/lib/test/data/frameScrollPage.html +0 -14
  155. package/lib/test/data/frameScrollParent.html +0 -11
  156. package/lib/test/data/frameWithAnimals.html +0 -11
  157. package/lib/test/data/frame_switching_tests/bug4876.html +0 -9
  158. package/lib/test/data/frame_switching_tests/bug4876_iframe.html +0 -9
  159. package/lib/test/data/frame_switching_tests/deletingFrame.html +0 -29
  160. package/lib/test/data/frame_switching_tests/deletingFrame_iframe.html +0 -8
  161. package/lib/test/data/frame_switching_tests/deletingFrame_iframe2.html +0 -7
  162. package/lib/test/data/frameset.html +0 -14
  163. package/lib/test/data/framesetPage2.html +0 -7
  164. package/lib/test/data/framesetPage3.html +0 -4
  165. package/lib/test/data/globalscope.html +0 -15
  166. package/lib/test/data/hidden.html +0 -5
  167. package/lib/test/data/hidden_partially.html +0 -45
  168. package/lib/test/data/html5/blue.jpg +0 -0
  169. package/lib/test/data/html5/database.js +0 -84
  170. package/lib/test/data/html5/geolocation.js +0 -18
  171. package/lib/test/data/html5/green.jpg +0 -0
  172. package/lib/test/data/html5/red.jpg +0 -0
  173. package/lib/test/data/html5/status.html +0 -1
  174. package/lib/test/data/html5/test.appcache +0 -11
  175. package/lib/test/data/html5/yellow.jpg +0 -0
  176. package/lib/test/data/html5Page.html +0 -32
  177. package/lib/test/data/icon.gif +0 -0
  178. package/lib/test/data/idElements.html +0 -2
  179. package/lib/test/data/iframeAtBottom.html +0 -15
  180. package/lib/test/data/iframeWithAlert.html +0 -1
  181. package/lib/test/data/iframeWithIframe.html +0 -1
  182. package/lib/test/data/iframes.html +0 -11
  183. package/lib/test/data/injectableContent.html +0 -22
  184. package/lib/test/data/javascriptEnhancedForm.html +0 -30
  185. package/lib/test/data/javascriptPage.html +0 -285
  186. package/lib/test/data/jquery-1.3.2.js +0 -4376
  187. package/lib/test/data/js/jquery-1.4.4.min.js +0 -167
  188. package/lib/test/data/js/jquery-ui-1.8.10.custom.min.js +0 -782
  189. package/lib/test/data/js/skins/lightgray/content.inline.min.css +0 -1
  190. package/lib/test/data/js/skins/lightgray/content.min.css +0 -1
  191. package/lib/test/data/js/skins/lightgray/fonts/readme.md +0 -1
  192. package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.dev.svg +0 -175
  193. package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.eot +0 -0
  194. package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.svg +0 -62
  195. package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  196. package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.woff +0 -0
  197. package/lib/test/data/js/skins/lightgray/fonts/tinymce.dev.svg +0 -153
  198. package/lib/test/data/js/skins/lightgray/fonts/tinymce.eot +0 -0
  199. package/lib/test/data/js/skins/lightgray/fonts/tinymce.svg +0 -63
  200. package/lib/test/data/js/skins/lightgray/fonts/tinymce.ttf +0 -0
  201. package/lib/test/data/js/skins/lightgray/fonts/tinymce.woff +0 -0
  202. package/lib/test/data/js/skins/lightgray/img/anchor.gif +0 -0
  203. package/lib/test/data/js/skins/lightgray/img/loader.gif +0 -0
  204. package/lib/test/data/js/skins/lightgray/img/object.gif +0 -0
  205. package/lib/test/data/js/skins/lightgray/img/trans.gif +0 -0
  206. package/lib/test/data/js/skins/lightgray/skin.ie7.min.css +0 -1
  207. package/lib/test/data/js/skins/lightgray/skin.min.css +0 -1
  208. package/lib/test/data/js/themes/modern/theme.min.js +0 -1
  209. package/lib/test/data/js/tinymce.min.js +0 -10
  210. package/lib/test/data/key_logger.html +0 -34
  211. package/lib/test/data/key_tests/remove_on_keypress.html +0 -36
  212. package/lib/test/data/keyboard_shortcut.html +0 -36
  213. package/lib/test/data/linked_image.html +0 -16
  214. package/lib/test/data/locators_tests/boolean_attribute_selected.html +0 -13
  215. package/lib/test/data/locators_tests/boolean_attribute_selected_html4.html +0 -13
  216. package/lib/test/data/longContentPage.html +0 -55
  217. package/lib/test/data/macbeth.html +0 -5255
  218. package/lib/test/data/map.png +0 -0
  219. package/lib/test/data/map_visibility.html +0 -8
  220. package/lib/test/data/markerTransparent.png +0 -0
  221. package/lib/test/data/messages.html +0 -15
  222. package/lib/test/data/meta-redirect.html +0 -11
  223. package/lib/test/data/missedJsReference.html +0 -11
  224. package/lib/test/data/modal_dialogs/modal_1.html +0 -21
  225. package/lib/test/data/modal_dialogs/modal_2.html +0 -21
  226. package/lib/test/data/modal_dialogs/modal_3.html +0 -15
  227. package/lib/test/data/modal_dialogs/modalindex.html +0 -21
  228. package/lib/test/data/mouseOver.html +0 -17
  229. package/lib/test/data/mousePositionTracker.html +0 -33
  230. package/lib/test/data/nestedElements.html +0 -164
  231. package/lib/test/data/overflow/x_auto_y_auto.html +0 -30
  232. package/lib/test/data/overflow/x_auto_y_hidden.html +0 -30
  233. package/lib/test/data/overflow/x_auto_y_scroll.html +0 -30
  234. package/lib/test/data/overflow/x_hidden_y_auto.html +0 -30
  235. package/lib/test/data/overflow/x_hidden_y_hidden.html +0 -30
  236. package/lib/test/data/overflow/x_hidden_y_scroll.html +0 -30
  237. package/lib/test/data/overflow/x_scroll_y_auto.html +0 -30
  238. package/lib/test/data/overflow/x_scroll_y_hidden.html +0 -30
  239. package/lib/test/data/overflow/x_scroll_y_scroll.html +0 -30
  240. package/lib/test/data/overflow-body.html +0 -15
  241. package/lib/test/data/pageWithOnBeforeUnloadMessage.html +0 -20
  242. package/lib/test/data/pageWithOnLoad.html +0 -6
  243. package/lib/test/data/pageWithOnUnload.html +0 -6
  244. package/lib/test/data/page_with_link_to_slow_loading_page.html +0 -6
  245. package/lib/test/data/plain.txt +0 -1
  246. package/lib/test/data/proxy/page1.html +0 -20
  247. package/lib/test/data/proxy/page2.html +0 -24
  248. package/lib/test/data/proxy/page3.html +0 -5
  249. package/lib/test/data/readOnlyPage.html +0 -24
  250. package/lib/test/data/rectangles.html +0 -40
  251. package/lib/test/data/resultPage.html +0 -25
  252. package/lib/test/data/rich_text.html +0 -161
  253. package/lib/test/data/safari/frames_benchmark.html +0 -31
  254. package/lib/test/data/screen/screen.css +0 -19
  255. package/lib/test/data/screen/screen.html +0 -72
  256. package/lib/test/data/screen/screen.js +0 -7
  257. package/lib/test/data/screen/screen_frame1.html +0 -72
  258. package/lib/test/data/screen/screen_frame2.html +0 -72
  259. package/lib/test/data/screen/screen_frames.html +0 -11
  260. package/lib/test/data/screen/screen_iframes.html +0 -12
  261. package/lib/test/data/screen/screen_too_long.html +0 -68
  262. package/lib/test/data/screen/screen_x_long.html +0 -72
  263. package/lib/test/data/screen/screen_x_too_long.html +0 -72
  264. package/lib/test/data/screen/screen_y_long.html +0 -72
  265. package/lib/test/data/screen/screen_y_too_long.html +0 -72
  266. package/lib/test/data/scroll.html +0 -27
  267. package/lib/test/data/scroll2.html +0 -21
  268. package/lib/test/data/scroll3.html +0 -8
  269. package/lib/test/data/scroll4.html +0 -7
  270. package/lib/test/data/scroll5.html +0 -18
  271. package/lib/test/data/scrolling_tests/frame_with_height_above_200.html +0 -26
  272. package/lib/test/data/scrolling_tests/frame_with_height_above_2000.html +0 -26
  273. package/lib/test/data/scrolling_tests/frame_with_nested_scrolling_frame.html +0 -11
  274. package/lib/test/data/scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html +0 -12
  275. package/lib/test/data/scrolling_tests/frame_with_small_height.html +0 -10
  276. package/lib/test/data/scrolling_tests/page_with_double_overflow_auto.html +0 -19
  277. package/lib/test/data/scrolling_tests/page_with_frame_out_of_view.html +0 -12
  278. package/lib/test/data/scrolling_tests/page_with_nested_scrolling_frames.html +0 -11
  279. package/lib/test/data/scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html +0 -12
  280. package/lib/test/data/scrolling_tests/page_with_non_scrolling_frame.html +0 -11
  281. package/lib/test/data/scrolling_tests/page_with_scrolling_frame.html +0 -11
  282. package/lib/test/data/scrolling_tests/page_with_scrolling_frame_out_of_view.html +0 -12
  283. package/lib/test/data/scrolling_tests/page_with_tall_frame.html +0 -11
  284. package/lib/test/data/scrolling_tests/page_with_y_overflow_auto.html +0 -14
  285. package/lib/test/data/scrolling_tests/target_page.html +0 -9
  286. package/lib/test/data/selectPage.html +0 -58
  287. package/lib/test/data/selectableItems.html +0 -65
  288. package/lib/test/data/sessionCookie.html +0 -21
  289. package/lib/test/data/sessionCookieDest.html +0 -34
  290. package/lib/test/data/simple.xml +0 -5
  291. package/lib/test/data/simpleTest.html +0 -98
  292. package/lib/test/data/single_text_input.html +0 -12
  293. package/lib/test/data/slowLoadingAlert.html +0 -10
  294. package/lib/test/data/slowLoadingResourcePage.html +0 -12
  295. package/lib/test/data/slow_loading_iframes.html +0 -14
  296. package/lib/test/data/styledPage.html +0 -28
  297. package/lib/test/data/svgPiechart.xhtml +0 -81
  298. package/lib/test/data/svgTest.svg +0 -4
  299. package/lib/test/data/tables.html +0 -36
  300. package/lib/test/data/tinymce.html +0 -10
  301. package/lib/test/data/transformable.xml +0 -11
  302. package/lib/test/data/transformable.xsl +0 -37
  303. package/lib/test/data/transparentUpload.html +0 -70
  304. package/lib/test/data/underscore.html +0 -9
  305. package/lib/test/data/unicode_ltr.html +0 -8
  306. package/lib/test/data/upload.html +0 -45
  307. package/lib/test/data/userDefinedProperty.html +0 -8
  308. package/lib/test/data/veryLargeCanvas.html +0 -81
  309. package/lib/test/data/visibility-css.html +0 -21
  310. package/lib/test/data/win32frameset.html +0 -8
  311. package/lib/test/data/window_switching_tests/page_with_frame.html +0 -12
  312. package/lib/test/data/window_switching_tests/simple_page.html +0 -9
  313. package/lib/test/data/xhtmlFormPage.xhtml +0 -17
  314. package/lib/test/data/xhtmlTest.html +0 -76
  315. package/lib/test/fileserver.js +0 -321
  316. package/lib/test/httpserver.js +0 -120
  317. package/lib/test/index.js +0 -270
  318. package/lib/test/promise.js +0 -79
  319. package/lib/test/resources.js +0 -44
  320. package/opera.js +0 -405
  321. package/phantomjs.js +0 -282
  322. package/test/actions_test.js +0 -52
  323. package/test/chrome/options_test.js +0 -227
  324. package/test/chrome/service_test.js +0 -45
  325. package/test/cookie_test.js +0 -214
  326. package/test/element_finding_test.js +0 -426
  327. package/test/execute_script_test.js +0 -350
  328. package/test/fingerprint_test.js +0 -62
  329. package/test/firefox/extension_test.js +0 -120
  330. package/test/firefox/firefox_test.js +0 -261
  331. package/test/firefox/profile_test.js +0 -140
  332. package/test/http/http_test.js +0 -223
  333. package/test/http/util_test.js +0 -178
  334. package/test/io/io_test.js +0 -360
  335. package/test/io/zip_test.js +0 -128
  336. package/test/lib/by_test.js +0 -160
  337. package/test/lib/capabilities_test.js +0 -111
  338. package/test/lib/error_test.js +0 -305
  339. package/test/lib/events_test.js +0 -177
  340. package/test/lib/http_test.js +0 -696
  341. package/test/lib/logging_test.js +0 -272
  342. package/test/lib/promise_aplus_test.js +0 -78
  343. package/test/lib/promise_error_test.js +0 -884
  344. package/test/lib/promise_flow_test.js +0 -2288
  345. package/test/lib/promise_generator_test.js +0 -310
  346. package/test/lib/promise_test.js +0 -1109
  347. package/test/lib/testutil.js +0 -90
  348. package/test/lib/until_test.js +0 -478
  349. package/test/lib/webdriver_test.js +0 -2311
  350. package/test/logging_test.js +0 -167
  351. package/test/net/index_test.js +0 -60
  352. package/test/net/portprober_test.js +0 -128
  353. package/test/page_loading_test.js +0 -166
  354. package/test/phantomjs/execute_phantomjs_test.js +0 -59
  355. package/test/proxy_test.js +0 -180
  356. package/test/rect_test.js +0 -60
  357. package/test/remote_test.js +0 -117
  358. package/test/safari_test.js +0 -108
  359. package/test/session_test.js +0 -99
  360. package/test/stale_element_test.js +0 -63
  361. package/test/tag_name_test.js +0 -36
  362. package/test/testing/assert_test.js +0 -373
  363. package/test/testing/index_test.js +0 -224
  364. package/test/upload_test.js +0 -86
  365. package/test/window_test.js +0 -161
  366. package/testing/assert.js +0 -378
@@ -1,160 +0,0 @@
1
- // Licensed to the Software Freedom Conservancy (SFC) under one
2
- // or more contributor license agreements. See the NOTICE file
3
- // distributed with this work for additional information
4
- // regarding copyright ownership. The SFC licenses this file
5
- // to you under the Apache License, Version 2.0 (the
6
- // "License"); you may not use this file except in compliance
7
- // with the License. You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the License is distributed on an
13
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- // KIND, either express or implied. See the License for the
15
- // specific language governing permissions and limitations
16
- // under the License.
17
-
18
- 'use strict';
19
-
20
- var assert = require('assert');
21
- var by = require('../../lib/by');
22
-
23
- describe('by', function() {
24
- describe('By', function() {
25
- describe('className', function() {
26
- it('delegates to By.css', function() {
27
- let locator = by.By.className('foo');
28
- assert.equal('css selector', locator.using);
29
- assert.equal('.foo', locator.value);
30
- });
31
-
32
- it('escapes class name', function() {
33
- let locator = by.By.className('foo#bar');
34
- assert.equal('css selector', locator.using);
35
- assert.equal('.foo\\#bar', locator.value);
36
- });
37
-
38
- it('translates compound class names', function() {
39
- let locator = by.By.className('a b');
40
- assert.equal('css selector', locator.using);
41
- assert.equal('.a.b', locator.value);
42
-
43
- locator = by.By.className(' x y z-1 "g" ');
44
- assert.equal('css selector', locator.using);
45
- assert.equal('.x.y.z-1.\\"g\\"', locator.value);
46
- });
47
- });
48
-
49
- describe('id', function() {
50
- it('delegates to By.css', function() {
51
- let locator = by.By.id('foo');
52
- assert.equal('css selector', locator.using);
53
- assert.equal('*[id="foo"]', locator.value);
54
- });
55
-
56
- it('escapes the ID', function() {
57
- let locator = by.By.id('foo#bar');
58
- assert.equal('css selector', locator.using);
59
- assert.equal('*[id="foo\\#bar"]', locator.value);
60
- });
61
- });
62
-
63
- describe('name', function() {
64
- it('delegates to By.css', function() {
65
- let locator = by.By.name('foo')
66
- assert.equal('css selector', locator.using);
67
- assert.equal('*[name="foo"]', locator.value);
68
- });
69
-
70
- it('escapes the name', function() {
71
- let locator = by.By.name('foo"bar"')
72
- assert.equal('css selector', locator.using);
73
- assert.equal('*[name="foo\\"bar\\""]', locator.value);
74
- });
75
-
76
- it('escapes the name when it starts with a number', function() {
77
- let locator = by.By.name('123foo"bar"')
78
- assert.equal('css selector', locator.using);
79
- assert.equal('*[name="\\31 23foo\\"bar\\""]', locator.value);
80
- });
81
-
82
- it('escapes the name when it starts with a negative number', function() {
83
- let locator = by.By.name('-123foo"bar"')
84
- assert.equal('css selector', locator.using);
85
- assert.equal('*[name="-\\31 23foo\\"bar\\""]', locator.value);
86
- });
87
- });
88
- });
89
-
90
- describe('checkedLocator', function() {
91
- it('accepts a By instance', function() {
92
- let original = by.By.name('foo');
93
- let locator = by.checkedLocator(original);
94
- assert.strictEqual(locator, original);
95
- });
96
-
97
- it('accepts custom locator functions', function() {
98
- let original = function() {};
99
- let locator = by.checkedLocator(original);
100
- assert.strictEqual(locator, original);
101
- });
102
-
103
- // See https://github.com/SeleniumHQ/selenium/issues/3056
104
- it('accepts By-like objects', function() {
105
- let fakeBy = {using: 'id', value: 'foo'};
106
- let locator = by.checkedLocator(fakeBy);
107
- assert.strictEqual(locator.constructor, by.By);
108
- assert.equal(locator.using, 'id');
109
- assert.equal(locator.value, 'foo');
110
- });
111
-
112
- it('accepts class name', function() {
113
- let locator = by.checkedLocator({className: 'foo'});
114
- assert.equal('css selector', locator.using);
115
- assert.equal('.foo', locator.value);
116
- });
117
-
118
- it('accepts css', function() {
119
- let locator = by.checkedLocator({css: 'a > b'});
120
- assert.equal('css selector', locator.using);
121
- assert.equal('a > b', locator.value);
122
- });
123
-
124
- it('accepts id', function() {
125
- let locator = by.checkedLocator({id: 'foobar'});
126
- assert.equal('css selector', locator.using);
127
- assert.equal('*[id="foobar"]', locator.value);
128
- });
129
-
130
- it('accepts linkText', function() {
131
- let locator = by.checkedLocator({linkText: 'hello'});
132
- assert.equal('link text', locator.using);
133
- assert.equal('hello', locator.value);
134
- });
135
-
136
- it('accepts name', function() {
137
- let locator = by.checkedLocator({name: 'foobar'});
138
- assert.equal('css selector', locator.using);
139
- assert.equal('*[name="foobar"]', locator.value);
140
- });
141
-
142
- it('accepts partialLinkText', function() {
143
- let locator = by.checkedLocator({partialLinkText: 'hello'});
144
- assert.equal('partial link text', locator.using);
145
- assert.equal('hello', locator.value);
146
- });
147
-
148
- it('accepts tagName', function() {
149
- let locator = by.checkedLocator({tagName: 'div'});
150
- assert.equal('css selector', locator.using);
151
- assert.equal('div', locator.value);
152
- });
153
-
154
- it('accepts xpath', function() {
155
- let locator = by.checkedLocator({xpath: '//div[1]'});
156
- assert.equal('xpath', locator.using);
157
- assert.equal('//div[1]', locator.value);
158
- });
159
- });
160
- });
@@ -1,111 +0,0 @@
1
- // Licensed to the Software Freedom Conservancy (SFC) under one
2
- // or more contributor license agreements. See the NOTICE file
3
- // distributed with this work for additional information
4
- // regarding copyright ownership. The SFC licenses this file
5
- // to you under the Apache License, Version 2.0 (the
6
- // "License"); you may not use this file except in compliance
7
- // with the License. You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the License is distributed on an
13
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- // KIND, either express or implied. See the License for the
15
- // specific language governing permissions and limitations
16
- // under the License.
17
-
18
- 'use strict';
19
-
20
- const Capabilities = require('../../lib/capabilities').Capabilities;
21
- const Symbols = require('../../lib/symbols');
22
-
23
- const assert = require('assert');
24
-
25
- describe('Capabilities', function() {
26
- it('can set and unset a capability', function() {
27
- let caps = new Capabilities();
28
- assert.equal(undefined, caps.get('foo'));
29
- assert.ok(!caps.has('foo'));
30
-
31
- caps.set('foo', 'bar');
32
- assert.equal('bar', caps.get('foo'));
33
- assert.ok(caps.has('foo'));
34
-
35
- caps.set('foo', null);
36
- assert.equal(null, caps.get('foo'));
37
- assert.ok(caps.has('foo'));
38
- });
39
-
40
- it('requires string capability keys', function() {
41
- let caps = new Capabilities();
42
- assert.throws(() => caps.set({}, 'hi'));
43
- });
44
-
45
- it('can merge capabilities', function() {
46
- let caps1 = new Capabilities()
47
- .set('foo', 'bar')
48
- .set('color', 'red');
49
-
50
- let caps2 = new Capabilities()
51
- .set('color', 'green');
52
-
53
- assert.equal('bar', caps1.get('foo'));
54
- assert.equal('red', caps1.get('color'));
55
- assert.equal('green', caps2.get('color'));
56
- assert.equal(undefined, caps2.get('foo'));
57
-
58
- caps2.merge(caps1);
59
- assert.equal('bar', caps1.get('foo'));
60
- assert.equal('red', caps1.get('color'));
61
- assert.equal('red', caps2.get('color'));
62
- assert.equal('bar', caps2.get('foo'));
63
- });
64
-
65
- it('can be initialized from a hash object', function() {
66
- let caps = new Capabilities({'one': 123, 'abc': 'def'});
67
- assert.equal(123, caps.get('one'));
68
- assert.equal('def', caps.get('abc'));
69
- });
70
-
71
- it('can be initialized from a map', function() {
72
- let m = new Map([['one', 123], ['abc', 'def']]);
73
-
74
- let caps = new Capabilities(m);
75
- assert.equal(123, caps.get('one'));
76
- assert.equal('def', caps.get('abc'));
77
- });
78
-
79
- describe('serialize', function() {
80
- it('works for simple capabilities', function() {
81
- let m = new Map([['one', 123], ['abc', 'def']]);
82
- let caps = new Capabilities(m);
83
- assert.deepEqual({one: 123, abc: 'def'}, caps[Symbols.serialize]());
84
- });
85
-
86
- it('does not omit capabilities set to a false-like value', function() {
87
- let caps = new Capabilities;
88
- caps.set('bool', false);
89
- caps.set('number', 0);
90
- caps.set('string', '');
91
-
92
- assert.deepEqual(
93
- {bool: false, number: 0, string: ''},
94
- caps[Symbols.serialize]());
95
- });
96
-
97
- it('omits capabilities with a null value', function() {
98
- let caps = new Capabilities;
99
- caps.set('foo', null);
100
- caps.set('bar', 123);
101
- assert.deepEqual({bar: 123}, caps[Symbols.serialize]());
102
- });
103
-
104
- it('omits capabilities with an undefined value', function() {
105
- let caps = new Capabilities;
106
- caps.set('foo', undefined);
107
- caps.set('bar', 123);
108
- assert.deepEqual({bar: 123}, caps[Symbols.serialize]());
109
- });
110
- });
111
- });
@@ -1,305 +0,0 @@
1
- // Licensed to the Software Freedom Conservancy (SFC) under one
2
- // or more contributor license agreements. See the NOTICE file
3
- // distributed with this work for additional information
4
- // regarding copyright ownership. The SFC licenses this file
5
- // to you under the Apache License, Version 2.0 (the
6
- // "License"); you may not use this file except in compliance
7
- // with the License. You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the License is distributed on an
13
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- // KIND, either express or implied. See the License for the
15
- // specific language governing permissions and limitations
16
- // under the License.
17
-
18
- 'use strict';
19
-
20
- describe('error', function() {
21
- let assert = require('assert');
22
- let error = require('../../lib/error');
23
-
24
- describe('checkResponse', function() {
25
- it('defaults to WebDriverError if type is unrecognized', function() {
26
- assert.throws(
27
- () => error.checkResponse({error: 'foo', message: 'hi there'}),
28
- (e) => {
29
- assert.equal(e.constructor, error.WebDriverError);
30
- return true;
31
- });
32
- });
33
-
34
- it('does not throw if error property is not a string', function() {
35
- let resp = {error: 123, message: 'abc123'};
36
- let out = error.checkResponse(resp);
37
- assert.strictEqual(out, resp);
38
- });
39
-
40
- test('unknown error', error.WebDriverError);
41
- test('element not selectable', error.ElementNotSelectableError);
42
- test('element not visible', error.ElementNotVisibleError);
43
- test('invalid argument', error.InvalidArgumentError);
44
- test('invalid cookie domain', error.InvalidCookieDomainError);
45
- test('invalid element coordinates', error.InvalidElementCoordinatesError);
46
- test('invalid element state', error.InvalidElementStateError);
47
- test('invalid selector', error.InvalidSelectorError);
48
- test('invalid session id', error.NoSuchSessionError);
49
- test('javascript error', error.JavascriptError);
50
- test('move target out of bounds', error.MoveTargetOutOfBoundsError);
51
- test('no such alert', error.NoSuchAlertError);
52
- test('no such element', error.NoSuchElementError);
53
- test('no such frame', error.NoSuchFrameError);
54
- test('no such window', error.NoSuchWindowError);
55
- test('script timeout', error.ScriptTimeoutError);
56
- test('session not created', error.SessionNotCreatedError);
57
- test('stale element reference', error.StaleElementReferenceError);
58
- test('timeout', error.TimeoutError);
59
- test('unable to set cookie', error.UnableToSetCookieError);
60
- test('unable to capture screen', error.UnableToCaptureScreenError);
61
- test('unexpected alert open', error.UnexpectedAlertOpenError);
62
- test('unknown command', error.UnknownCommandError);
63
- test('unknown method', error.UnknownMethodError);
64
- test('unsupported operation', error.UnsupportedOperationError);
65
-
66
- function test(status, expectedType) {
67
- it(`"${status}" => ${expectedType.name}`, function() {
68
- assert.throws(
69
- () => error.checkResponse({error: status, message: 'oops'}),
70
- (e) => {
71
- assert.equal(expectedType, e.constructor);
72
- assert.equal(e.message, 'oops');
73
- return true;
74
- });
75
- });
76
- }
77
- });
78
-
79
- describe('encodeError', function() {
80
- describe('defaults to an unknown error', function() {
81
- it('for a generic error value', function() {
82
- runTest('hi', 'unknown error', 'hi');
83
- runTest(1, 'unknown error', '1');
84
- runTest({}, 'unknown error', '[object Object]');
85
- });
86
-
87
- it('for a generic Error object', function() {
88
- runTest(Error('oops'), 'unknown error', 'oops');
89
- runTest(TypeError('bad value'), 'unknown error', 'bad value');
90
- });
91
- });
92
-
93
- test(error.WebDriverError, 'unknown error');
94
- test(error.ElementNotSelectableError, 'element not selectable');
95
- test(error.ElementNotVisibleError, 'element not visible');
96
- test(error.InvalidArgumentError, 'invalid argument');
97
- test(error.InvalidCookieDomainError, 'invalid cookie domain');
98
- test(error.InvalidElementStateError, 'invalid element state');
99
- test(error.InvalidSelectorError, 'invalid selector');
100
- test(error.NoSuchSessionError, 'invalid session id');
101
- test(error.JavascriptError, 'javascript error');
102
- test(error.MoveTargetOutOfBoundsError, 'move target out of bounds');
103
- test(error.NoSuchAlertError, 'no such alert');
104
- test(error.NoSuchElementError, 'no such element');
105
- test(error.NoSuchFrameError, 'no such frame');
106
- test(error.NoSuchWindowError, 'no such window');
107
- test(error.ScriptTimeoutError, 'script timeout');
108
- test(error.SessionNotCreatedError, 'session not created');
109
- test(error.StaleElementReferenceError, 'stale element reference');
110
- test(error.TimeoutError, 'timeout');
111
- test(error.UnableToSetCookieError, 'unable to set cookie');
112
- test(error.UnableToCaptureScreenError, 'unable to capture screen');
113
- test(error.UnexpectedAlertOpenError, 'unexpected alert open');
114
- test(error.UnknownCommandError, 'unknown command');
115
- test(error.UnknownMethodError, 'unknown method');
116
- test(error.UnsupportedOperationError, 'unsupported operation');
117
-
118
- function test(ctor, code) {
119
- it(`${ctor.name} => "${code}"`, () => {
120
- runTest(new ctor('oops'), code, 'oops');
121
- });
122
- }
123
-
124
- function runTest(err, code, message) {
125
- let obj = error.encodeError(err);
126
- assert.strictEqual(obj['error'], code);
127
- assert.strictEqual(obj['message'], message);
128
- }
129
- });
130
-
131
- describe('throwDecodedError', function() {
132
- it('defaults to WebDriverError if type is unrecognized', function() {
133
- assert.throws(
134
- () => error.throwDecodedError({error: 'foo', message: 'hi there'}),
135
- (e) => {
136
- assert.equal(e.constructor, error.WebDriverError);
137
- return true;
138
- });
139
- });
140
-
141
- it('throws generic error if encoded data is not valid', function() {
142
- assert.throws(
143
- () => error.throwDecodedError({error: 123, message: 'abc123'}),
144
- (e) => {
145
- assert.strictEqual(e.constructor, error.WebDriverError);
146
- return true;
147
- });
148
-
149
- assert.throws(
150
- () => error.throwDecodedError('null'),
151
- (e) => {
152
- assert.strictEqual(e.constructor, error.WebDriverError);
153
- return true;
154
- });
155
-
156
- assert.throws(
157
- () => error.throwDecodedError(''),
158
- (e) => {
159
- assert.strictEqual(e.constructor, error.WebDriverError);
160
- return true;
161
- });
162
- });
163
-
164
- test('unknown error', error.WebDriverError);
165
- test('element not selectable', error.ElementNotSelectableError);
166
- test('element not visible', error.ElementNotVisibleError);
167
- test('invalid argument', error.InvalidArgumentError);
168
- test('invalid cookie domain', error.InvalidCookieDomainError);
169
- test('invalid element coordinates', error.InvalidElementCoordinatesError);
170
- test('invalid element state', error.InvalidElementStateError);
171
- test('invalid selector', error.InvalidSelectorError);
172
- test('invalid session id', error.NoSuchSessionError);
173
- test('javascript error', error.JavascriptError);
174
- test('move target out of bounds', error.MoveTargetOutOfBoundsError);
175
- test('no such alert', error.NoSuchAlertError);
176
- test('no such element', error.NoSuchElementError);
177
- test('no such frame', error.NoSuchFrameError);
178
- test('no such window', error.NoSuchWindowError);
179
- test('script timeout', error.ScriptTimeoutError);
180
- test('session not created', error.SessionNotCreatedError);
181
- test('stale element reference', error.StaleElementReferenceError);
182
- test('timeout', error.TimeoutError);
183
- test('unable to set cookie', error.UnableToSetCookieError);
184
- test('unable to capture screen', error.UnableToCaptureScreenError);
185
- test('unexpected alert open', error.UnexpectedAlertOpenError);
186
- test('unknown command', error.UnknownCommandError);
187
- test('unknown method', error.UnknownMethodError);
188
- test('unsupported operation', error.UnsupportedOperationError);
189
-
190
- it('leaves remoteStacktrace empty if not in encoding', function() {
191
- assert.throws(
192
- () => error.throwDecodedError({
193
- error: 'session not created',
194
- message: 'oops'
195
- }),
196
- (e) => {
197
- assert.strictEqual(e.constructor, error.SessionNotCreatedError);
198
- assert.strictEqual(e.message, 'oops');
199
- assert.strictEqual(e.remoteStacktrace, '');
200
- return true;
201
- });
202
- });
203
-
204
- function test(status, expectedType) {
205
- it(`"${status}" => ${expectedType.name}`, function() {
206
- assert.throws(
207
- () => error.throwDecodedError({
208
- error: status,
209
- message: 'oops',
210
- stacktrace: 'some-stacktrace'
211
- }),
212
- (e) => {
213
- assert.strictEqual(e.constructor, expectedType);
214
- assert.strictEqual(e.message, 'oops');
215
- assert.strictEqual(e.remoteStacktrace, 'some-stacktrace');
216
- return true;
217
- });
218
- });
219
- }
220
- });
221
-
222
- describe('checkLegacyResponse', function() {
223
- it('does not throw for success', function() {
224
- let resp = {status: error.ErrorCode.SUCCESS};
225
- assert.strictEqual(resp, error.checkLegacyResponse(resp));
226
- });
227
-
228
- test('NO_SUCH_ELEMENT', error.NoSuchElementError);
229
- test('NO_SUCH_FRAME', error.NoSuchFrameError);
230
- test('UNKNOWN_COMMAND', error.UnsupportedOperationError);
231
- test('UNSUPPORTED_OPERATION', error.UnsupportedOperationError);
232
- test('STALE_ELEMENT_REFERENCE', error.StaleElementReferenceError);
233
- test('ELEMENT_NOT_VISIBLE', error.ElementNotVisibleError);
234
- test('INVALID_ELEMENT_STATE', error.InvalidElementStateError);
235
- test('UNKNOWN_ERROR', error.WebDriverError);
236
- test('ELEMENT_NOT_SELECTABLE', error.ElementNotSelectableError);
237
- test('JAVASCRIPT_ERROR', error.JavascriptError);
238
- test('XPATH_LOOKUP_ERROR', error.InvalidSelectorError);
239
- test('TIMEOUT', error.TimeoutError);
240
- test('NO_SUCH_WINDOW', error.NoSuchWindowError);
241
- test('INVALID_COOKIE_DOMAIN', error.InvalidCookieDomainError);
242
- test('UNABLE_TO_SET_COOKIE', error.UnableToSetCookieError);
243
- test('UNEXPECTED_ALERT_OPEN', error.UnexpectedAlertOpenError);
244
- test('NO_SUCH_ALERT', error.NoSuchAlertError);
245
- test('SCRIPT_TIMEOUT', error.ScriptTimeoutError);
246
- test('INVALID_ELEMENT_COORDINATES', error.InvalidElementCoordinatesError);
247
- test('INVALID_SELECTOR_ERROR', error.InvalidSelectorError);
248
- test('SESSION_NOT_CREATED', error.SessionNotCreatedError);
249
- test('MOVE_TARGET_OUT_OF_BOUNDS', error.MoveTargetOutOfBoundsError);
250
- test('INVALID_XPATH_SELECTOR', error.InvalidSelectorError);
251
- test('INVALID_XPATH_SELECTOR_RETURN_TYPE', error.InvalidSelectorError);
252
- test('METHOD_NOT_ALLOWED', error.UnsupportedOperationError);
253
-
254
- describe('UnexpectedAlertOpenError', function() {
255
- it('includes alert text from the response object', function() {
256
- let response = {
257
- status: error.ErrorCode.UNEXPECTED_ALERT_OPEN,
258
- value: {
259
- message: 'hi',
260
- alert: {text: 'alert text here'}
261
- }
262
- };
263
- assert.throws(
264
- () => error.checkLegacyResponse(response),
265
- (e) => {
266
- assert.equal(error.UnexpectedAlertOpenError, e.constructor);
267
- assert.equal(e.message, 'hi');
268
- assert.equal(e.getAlertText(), 'alert text here');
269
- return true;
270
- });
271
- });
272
-
273
- it('uses an empty string if alert text omitted', function() {
274
- let response = {
275
- status: error.ErrorCode.UNEXPECTED_ALERT_OPEN,
276
- value: {
277
- message: 'hi'
278
- }
279
- };
280
- assert.throws(
281
- () => error.checkLegacyResponse(response),
282
- (e) => {
283
- assert.equal(error.UnexpectedAlertOpenError, e.constructor);
284
- assert.equal(e.message, 'hi');
285
- assert.equal(e.getAlertText(), '');
286
- return true;
287
- });
288
- });
289
- });
290
-
291
- function test(codeKey, expectedType) {
292
- it(`${codeKey} => ${expectedType.name}`, function() {
293
- let code = error.ErrorCode[codeKey];
294
- let resp = {status: code, value: {message: 'hi'}};
295
- assert.throws(
296
- () => error.checkLegacyResponse(resp),
297
- (e) => {
298
- assert.equal(expectedType, e.constructor);
299
- assert.equal(e.message, 'hi');
300
- return true;
301
- });
302
- });
303
- }
304
- });
305
- });