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
package/index.js CHANGED
@@ -22,27 +22,23 @@
22
22
 
23
23
  'use strict';
24
24
 
25
- const chrome = require('./chrome');
26
- const edge = require('./edge');
27
- const firefox = require('./firefox');
28
25
  const _http = require('./http');
29
- const ie = require('./ie');
30
- const actions = require('./lib/actions');
31
26
  const by = require('./lib/by');
32
27
  const capabilities = require('./lib/capabilities');
28
+ const chrome = require('./chrome');
33
29
  const command = require('./lib/command');
30
+ const edge = require('./edge');
34
31
  const error = require('./lib/error');
35
- const events = require('./lib/events');
32
+ const firefox = require('./firefox');
33
+ const ie = require('./ie');
36
34
  const input = require('./lib/input');
37
35
  const logging = require('./lib/logging');
38
36
  const promise = require('./lib/promise');
37
+ const remote = require('./remote');
38
+ const safari = require('./safari');
39
39
  const session = require('./lib/session');
40
40
  const until = require('./lib/until');
41
41
  const webdriver = require('./lib/webdriver');
42
- const opera = require('./opera');
43
- const phantomjs = require('./phantomjs');
44
- const remote = require('./remote');
45
- const safari = require('./safari');
46
42
 
47
43
  const Browser = capabilities.Browser;
48
44
  const Capabilities = capabilities.Capabilities;
@@ -107,7 +103,7 @@ function ensureFileDetectorsAreEnabled(ctor) {
107
103
  * every issued command will fail.
108
104
  *
109
105
  * @extends {webdriver.IWebDriver}
110
- * @extends {promise.CancellableThenable<!webdriver.IWebDriver>}
106
+ * @extends {IThenable<!webdriver.IWebDriver>}
111
107
  * @interface
112
108
  */
113
109
  class ThenableWebDriver {
@@ -147,24 +143,13 @@ function createDriver(ctor, ...args) {
147
143
  return new ctor(session, ...rest);
148
144
  });
149
145
 
150
- /**
151
- * @param {(string|Error)=} opt_reason
152
- * @override
153
- */
154
- this.cancel = function(opt_reason) {
155
- if (promise.CancellableThenable.isImplementation(pd)) {
156
- /** @type {!promise.CancellableThenable} */(pd).cancel(opt_reason);
157
- }
158
- };
159
-
160
146
  /** @override */
161
147
  this.then = pd.then.bind(pd);
162
148
 
163
149
  /** @override */
164
- this.catch = pd.then.bind(pd);
150
+ this.catch = pd.catch.bind(pd);
165
151
  }
166
152
  };
167
- promise.CancellableThenable.addImplementation(thenableWebDriverProxy);
168
153
  THENABLE_DRIVERS.set(ctor, thenableWebDriverProxy);
169
154
  }
170
155
  return thenableWebDriverProxy.createSession(...args);
@@ -215,9 +200,6 @@ class Builder {
215
200
  /** @private @const */
216
201
  this.log_ = logging.getLogger('webdriver.Builder');
217
202
 
218
- /** @private {promise.ControlFlow} */
219
- this.flow_ = null;
220
-
221
203
  /** @private {string} */
222
204
  this.url_ = '';
223
205
 
@@ -230,14 +212,20 @@ class Builder {
230
212
  /** @private {chrome.Options} */
231
213
  this.chromeOptions_ = null;
232
214
 
215
+ /** @private {chrome.ServiceBuilder} */
216
+ this.chromeService_ = null;
217
+
233
218
  /** @private {firefox.Options} */
234
219
  this.firefoxOptions_ = null;
235
220
 
236
- /** @private {opera.Options} */
237
- this.operaOptions_ = null;
221
+ /** @private {firefox.ServiceBuilder} */
222
+ this.firefoxService_ = null;
238
223
 
239
224
  /** @private {ie.Options} */
240
225
  this.ieOptions_ = null;
226
+
227
+ /** @private {ie.ServiceBuilder} */
228
+ this.ieService_ = null;
241
229
 
242
230
  /** @private {safari.Options} */
243
231
  this.safariOptions_ = null;
@@ -245,6 +233,9 @@ class Builder {
245
233
  /** @private {edge.Options} */
246
234
  this.edgeOptions_ = null;
247
235
 
236
+ /** @private {remote.DriverService.Builder} */
237
+ this.edgeService_ = null;
238
+
248
239
  /** @private {boolean} */
249
240
  this.ignoreEnv_ = false;
250
241
 
@@ -358,18 +349,22 @@ class Builder {
358
349
  * environment variable. If set, this environment variable should be of the
359
350
  * form `browser[:[version][:platform]]`.
360
351
  *
361
- * @param {(string|Browser)} name The name of the target browser;
352
+ * @param {(string|!Browser)} name The name of the target browser;
362
353
  * common defaults are available on the {@link webdriver.Browser} enum.
363
354
  * @param {string=} opt_version A desired version; may be omitted if any
364
355
  * version should be used.
365
- * @param {string=} opt_platform The desired platform; may be omitted if any
366
- * version may be used.
356
+ * @param {(string|!capabilities.Platform)=} opt_platform
357
+ * The desired platform; may be omitted if any platform may be used.
367
358
  * @return {!Builder} A self reference.
368
359
  */
369
360
  forBrowser(name, opt_version, opt_platform) {
370
- this.capabilities_.set(Capability.BROWSER_NAME, name);
371
- this.capabilities_.set(Capability.VERSION, opt_version || null);
372
- this.capabilities_.set(Capability.PLATFORM, opt_platform || null);
361
+ this.capabilities_.setBrowserName(name);
362
+ if (opt_version) {
363
+ this.capabilities_.setBrowserVersion(opt_version);
364
+ }
365
+ if (opt_platform) {
366
+ this.capabilities_.setPlatform(opt_platform);
367
+ }
373
368
  return this;
374
369
  }
375
370
 
@@ -378,7 +373,7 @@ class Builder {
378
373
  * Any calls to {@link #withCapabilities} after this function will
379
374
  * overwrite these settings.
380
375
  *
381
- * @param {!capabilities.ProxyConfig} config The configuration to use.
376
+ * @param {!./lib/proxy.Config} config The configuration to use.
382
377
  * @return {!Builder} A self reference.
383
378
  */
384
379
  setProxy(config) {
@@ -398,33 +393,13 @@ class Builder {
398
393
  return this;
399
394
  }
400
395
 
401
- /**
402
- * Sets whether native events should be used.
403
- * @param {boolean} enabled Whether to enable native events.
404
- * @return {!Builder} A self reference.
405
- */
406
- setEnableNativeEvents(enabled) {
407
- this.capabilities_.setEnableNativeEvents(enabled);
408
- return this;
409
- }
410
-
411
- /**
412
- * Sets how elements should be scrolled into view for interaction.
413
- * @param {number} behavior The desired scroll behavior: either 0 to align
414
- * with the top of the viewport or 1 to align with the bottom.
415
- * @return {!Builder} A self reference.
416
- */
417
- setScrollBehavior(behavior) {
418
- this.capabilities_.setScrollBehavior(behavior);
419
- return this;
420
- }
421
-
422
396
  /**
423
397
  * Sets the default action to take with an unexpected alert before returning
424
398
  * an error.
425
- * @param {string} behavior The desired behavior; should be "accept",
426
- * "dismiss", or "ignore". Defaults to "dismiss".
399
+ *
400
+ * @param {?capabilities.UserPromptHandler} behavior The desired behavior.
427
401
  * @return {!Builder} A self reference.
402
+ * @see capabilities.Capabilities#setAlertBehavior
428
403
  */
429
404
  setAlertBehavior(behavior) {
430
405
  this.capabilities_.setAlertBehavior(behavior);
@@ -445,6 +420,29 @@ class Builder {
445
420
  return this;
446
421
  }
447
422
 
423
+ /**
424
+ * @return {chrome.Options} the Chrome specific options currently configured
425
+ * for this builder.
426
+ */
427
+ getChromeOptions() {
428
+ return this.chromeOptions_;
429
+ }
430
+
431
+ /**
432
+ * Sets the service builder to use for managing the chromedriver child process
433
+ * when creating new Chrome sessions.
434
+ *
435
+ * @param {chrome.ServiceBuilder} service the service to use.
436
+ * @return {!Builder} A self reference.
437
+ */
438
+ setChromeService(service) {
439
+ if (service && !(service instanceof chrome.ServiceBuilder)) {
440
+ throw TypeError('not a chrome.ServiceBuilder object');
441
+ }
442
+ this.chromeService_ = service;
443
+ return this;
444
+ }
445
+
448
446
  /**
449
447
  * Sets Firefox specific {@linkplain firefox.Options options} for drivers
450
448
  * created by this builder. Any logging or proxy settings defined on the given
@@ -468,16 +466,17 @@ class Builder {
468
466
  }
469
467
 
470
468
  /**
471
- * Sets Opera specific {@linkplain opera.Options options} for drivers created
472
- * by this builder. Any logging or proxy settings defined on the given options
473
- * will take precedence over those set through {@link #setLoggingPrefs} and
474
- * {@link #setProxy}, respectively.
469
+ * Sets the {@link firefox.ServiceBuilder} to use to manage the geckodriver
470
+ * child process when creating Firefox sessions locally.
475
471
  *
476
- * @param {!opera.Options} options The OperaDriver options to use.
477
- * @return {!Builder} A self reference.
472
+ * @param {firefox.ServiceBuilder} service the service to use.
473
+ * @return {!Builder} a self reference.
478
474
  */
479
- setOperaOptions(options) {
480
- this.operaOptions_ = options;
475
+ setFirefoxService(service) {
476
+ if (service && !(service instanceof firefox.ServiceBuilder)) {
477
+ throw TypeError('not a firefox.ServiceBuilder object');
478
+ }
479
+ this.firefoxService_ = service;
481
480
  return this;
482
481
  }
483
482
 
@@ -494,6 +493,18 @@ class Builder {
494
493
  return this;
495
494
  }
496
495
 
496
+ /**
497
+ * Sets the {@link ie.ServiceBuilder} to use to manage the geckodriver
498
+ * child process when creating IE sessions locally.
499
+ *
500
+ * @param {ie.ServiceBuilder} service the service to use.
501
+ * @return {!Builder} a self reference.
502
+ */
503
+ setIeService(service) {
504
+ this.ieService_ = service;
505
+ return this;
506
+ }
507
+
497
508
  /**
498
509
  * Set {@linkplain edge.Options options} specific to Microsoft's Edge browser
499
510
  * for drivers created by this builder. Any proxy settings defined on the
@@ -508,6 +519,21 @@ class Builder {
508
519
  return this;
509
520
  }
510
521
 
522
+ /**
523
+ * Sets the {@link edge.ServiceBuilder} to use to manage the
524
+ * MicrosoftEdgeDriver child process when creating sessions locally.
525
+ *
526
+ * @param {edge.ServiceBuilder} service the service to use.
527
+ * @return {!Builder} a self reference.
528
+ */
529
+ setEdgeService(service) {
530
+ if (service && !(service instanceof edge.ServiceBuilder)) {
531
+ throw TypeError('not a edge.ServiceBuilder object');
532
+ }
533
+ this.edgeService_ = service;
534
+ return this;
535
+ }
536
+
511
537
  /**
512
538
  * Sets Safari specific {@linkplain safari.Options options} for drivers
513
539
  * created by this builder. Any logging settings defined on the given options
@@ -529,19 +555,6 @@ class Builder {
529
555
  return this.safariOptions_;
530
556
  }
531
557
 
532
- /**
533
- * Sets the control flow that created drivers should execute actions in. If
534
- * the flow is never set, or is set to {@code null}, it will use the active
535
- * flow at the time {@link #build()} is called.
536
- * @param {promise.ControlFlow} flow The control flow to use, or
537
- * {@code null} to
538
- * @return {!Builder} A self reference.
539
- */
540
- setControlFlow(flow) {
541
- this.flow_ = flow;
542
- return this;
543
- }
544
-
545
558
  /**
546
559
  * Creates a new WebDriver client based on this builder's current
547
560
  * configuration.
@@ -564,9 +577,10 @@ class Builder {
564
577
  if (!this.ignoreEnv_ && process.env.SELENIUM_BROWSER) {
565
578
  this.log_.fine(`SELENIUM_BROWSER=${process.env.SELENIUM_BROWSER}`);
566
579
  browser = process.env.SELENIUM_BROWSER.split(/:/, 3);
567
- capabilities.set(Capability.BROWSER_NAME, browser[0]);
568
- capabilities.set(Capability.VERSION, browser[1] || null);
569
- capabilities.set(Capability.PLATFORM, browser[2] || null);
580
+ capabilities.setBrowserName(browser[0]);
581
+
582
+ browser[1] && capabilities.setBrowserVersion(browser[1]);
583
+ browser[2] && capabilities.setPlatform(browser[2]);
570
584
  }
571
585
 
572
586
  browser = capabilities.get(Capability.BROWSER_NAME);
@@ -583,24 +597,29 @@ class Builder {
583
597
 
584
598
  // Apply browser specific overrides.
585
599
  if (browser === Browser.CHROME && this.chromeOptions_) {
586
- capabilities.merge(this.chromeOptions_.toCapabilities());
600
+ capabilities.merge(this.chromeOptions_);
587
601
 
588
602
  } else if (browser === Browser.FIREFOX && this.firefoxOptions_) {
589
- capabilities.merge(this.firefoxOptions_.toCapabilities());
603
+ capabilities.merge(this.firefoxOptions_);
590
604
 
591
605
  } else if (browser === Browser.INTERNET_EXPLORER && this.ieOptions_) {
592
- capabilities.merge(this.ieOptions_.toCapabilities());
593
-
594
- } else if (browser === Browser.OPERA && this.operaOptions_) {
595
- capabilities.merge(this.operaOptions_.toCapabilities());
606
+ capabilities.merge(this.ieOptions_);
596
607
 
597
608
  } else if (browser === Browser.SAFARI && this.safariOptions_) {
598
- capabilities.merge(this.safariOptions_.toCapabilities());
609
+ capabilities.merge(this.safariOptions_);
599
610
 
600
611
  } else if (browser === Browser.EDGE && this.edgeOptions_) {
601
- capabilities.merge(this.edgeOptions_.toCapabilities());
612
+ capabilities.merge(this.edgeOptions_);
602
613
  }
603
614
 
615
+ checkOptions(
616
+ capabilities, 'chromeOptions', chrome.Options, 'setChromeOptions');
617
+ checkOptions(
618
+ capabilities, 'moz:firefoxOptions', firefox.Options,
619
+ 'setFirefoxOptions');
620
+ checkOptions(
621
+ capabilities, 'safari.options', safari.Options, 'setSafariOptions');
622
+
604
623
  // Check for a remote browser.
605
624
  let url = this.url_;
606
625
  if (!this.ignoreEnv_) {
@@ -623,41 +642,51 @@ class Builder {
623
642
 
624
643
  if (browser === Browser.CHROME) {
625
644
  const driver = ensureFileDetectorsAreEnabled(chrome.Driver);
626
- return createDriver(
627
- driver, capabilities, executor, this.flow_);
645
+ return createDriver(driver, capabilities, executor);
628
646
  }
629
647
 
630
648
  if (browser === Browser.FIREFOX) {
631
649
  const driver = ensureFileDetectorsAreEnabled(firefox.Driver);
632
- return createDriver(
633
- driver, capabilities, executor, this.flow_);
650
+ return createDriver(driver, capabilities, executor);
634
651
  }
635
- return createDriver(
636
- WebDriver, executor, capabilities, this.flow_);
652
+ return createDriver(WebDriver, executor, capabilities);
637
653
  }
638
654
 
639
655
  // Check for a native browser.
640
656
  switch (browser) {
641
- case Browser.CHROME:
642
- return createDriver(chrome.Driver, capabilities, null, this.flow_);
657
+ case Browser.CHROME: {
658
+ let service = null;
659
+ if (this.chromeService_) {
660
+ service = this.chromeService_.build();
661
+ }
662
+ return createDriver(chrome.Driver, capabilities, service);
663
+ }
643
664
 
644
- case Browser.FIREFOX:
645
- return createDriver(firefox.Driver, capabilities, null, this.flow_);
665
+ case Browser.FIREFOX: {
666
+ let service = null;
667
+ if (this.firefoxService_) {
668
+ service = this.firefoxService_.build();
669
+ }
670
+ return createDriver(firefox.Driver, capabilities, service);
671
+ }
646
672
 
647
673
  case Browser.INTERNET_EXPLORER:
648
- return createDriver(ie.Driver, capabilities, this.flow_);
649
-
650
- case Browser.EDGE:
651
- return createDriver(edge.Driver, capabilities, null, this.flow_);
652
-
653
- case Browser.OPERA:
654
- return createDriver(opera.Driver, capabilities, null, this.flow_);
655
-
656
- case Browser.PHANTOM_JS:
657
- return createDriver(phantomjs.Driver, capabilities, this.flow_);
674
+ let service = null;
675
+ if (this.ieService_) {
676
+ service = this.ieService_.build();
677
+ }
678
+ return createDriver(ie.Driver, capabilities, service);
679
+
680
+ case Browser.EDGE: {
681
+ let service = null;
682
+ if (this.edgeService_) {
683
+ service = this.edgeService_.build();
684
+ }
685
+ return createDriver(edge.Driver, capabilities, service);
686
+ }
658
687
 
659
688
  case Browser.SAFARI:
660
- return createDriver(safari.Driver, capabilities, this.flow_);
689
+ return createDriver(safari.Driver, capabilities);
661
690
 
662
691
  default:
663
692
  throw new Error('Do not know how to build driver: ' + browser
@@ -667,10 +696,66 @@ class Builder {
667
696
  }
668
697
 
669
698
 
699
+ /**
700
+ * In the 3.x releases, the various browser option classes
701
+ * (e.g. firefox.Options) had to be manually set as an option using the
702
+ * Capabilties class:
703
+ *
704
+ * let ffo = new firefox.Options();
705
+ * // Configure firefox options...
706
+ *
707
+ * let caps = new Capabilities();
708
+ * caps.set('moz:firefoxOptions', ffo);
709
+ *
710
+ * let driver = new Builder()
711
+ * .withCapabilities(caps)
712
+ * .build();
713
+ *
714
+ * The options are now subclasses of Capabilities and can be used directly. A
715
+ * direct translation of the above is:
716
+ *
717
+ * let ffo = new firefox.Options();
718
+ * // Configure firefox options...
719
+ *
720
+ * let driver = new Builder()
721
+ * .withCapabilities(ffo)
722
+ * .build();
723
+ *
724
+ * You can also set the options for various browsers at once and let the builder
725
+ * choose the correct set at runtime (see Builder docs above):
726
+ *
727
+ * let ffo = new firefox.Options();
728
+ * // Configure ...
729
+ *
730
+ * let co = new chrome.Options();
731
+ * // Configure ...
732
+ *
733
+ * let driver = new Builder()
734
+ * .setChromeOptions(co)
735
+ * .setFirefoxOptions(ffo)
736
+ * .build();
737
+ *
738
+ * @param {!Capabilities} caps
739
+ * @param {string} key
740
+ * @param {function(new: Capabilities)} optionType
741
+ * @param {string} setMethod
742
+ * @throws {error.InvalidArgumentError}
743
+ */
744
+ function checkOptions(caps, key, optionType, setMethod) {
745
+ let val = caps.get(key);
746
+ if (val instanceof optionType) {
747
+ throw new error.InvalidArgumentError(
748
+ 'Options class extends Capabilities and should not be set as key '
749
+ + `"${key}"; set browser-specific options with `
750
+ + `Builder.${setMethod}(). For more information, see the `
751
+ + 'documentation attached to the function that threw this error');
752
+ }
753
+ }
754
+
755
+
670
756
  // PUBLIC API
671
757
 
672
758
 
673
- exports.ActionSequence = actions.ActionSequence;
674
759
  exports.Browser = capabilities.Browser;
675
760
  exports.Builder = Builder;
676
761
  exports.Button = input.Button;
@@ -678,12 +763,11 @@ exports.By = by.By;
678
763
  exports.Capabilities = capabilities.Capabilities;
679
764
  exports.Capability = capabilities.Capability;
680
765
  exports.Condition = webdriver.Condition;
681
- exports.EventEmitter = events.EventEmitter;
682
766
  exports.FileDetector = input.FileDetector;
683
767
  exports.Key = input.Key;
768
+ exports.Origin = input.Origin;
684
769
  exports.Session = session.Session;
685
770
  exports.ThenableWebDriver = ThenableWebDriver;
686
- exports.TouchSequence = actions.TouchSequence;
687
771
  exports.WebDriver = webdriver.WebDriver;
688
772
  exports.WebElement = webdriver.WebElement;
689
773
  exports.WebElementCondition = webdriver.WebElementCondition;
package/io/exec.js CHANGED
@@ -21,22 +21,37 @@ const childProcess = require('child_process');
21
21
 
22
22
 
23
23
  /**
24
- * A hash with configuration options for an executed command.
24
+ * Options for configuring an executed command.
25
25
  *
26
- * - `args` - Command line arguments.
27
- * - `env` - Command environment; will inherit from the current process if
28
- * missing.
29
- * - `stdio` - IO configuration for the spawned server process. For more
30
- * information, refer to the documentation of `child_process.spawn`.
31
- *
32
- * @typedef {{
33
- * args: (!Array<string>|undefined),
34
- * env: (!Object<string, string>|undefined),
35
- * stdio: (string|!Array<string|number|!stream.Stream|null|undefined>|
36
- * undefined)
37
- * }}
26
+ * @record
38
27
  */
39
- var Options;
28
+ class Options {
29
+ constructor() {
30
+ /**
31
+ * Command line arguments for the child process, if any.
32
+ * @type (!Array<string>|undefined)
33
+ */
34
+ this.args;
35
+
36
+ /**
37
+ * Environment variables for the spawned process. If unspecified, the
38
+ * child will inherit this process' environment.
39
+ *
40
+ * @type {(!Object<string, string>|undefined)}
41
+ */
42
+ this.env;
43
+
44
+ /**
45
+ * IO conifguration for the spawned server child process. If unspecified,
46
+ * the child process' IO output will be ignored.
47
+ *
48
+ * @type {(string|!Array<string|number|!stream.Stream|null|undefined>|
49
+ * undefined)}
50
+ * @see <https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_options_stdio>
51
+ */
52
+ this.stdio;
53
+ }
54
+ }
40
55
 
41
56
 
42
57
  /**
@@ -148,6 +163,5 @@ module.exports = function exec(command, opt_options) {
148
163
  // Exported to improve generated API documentation.
149
164
 
150
165
  module.exports.Command = Command;
151
- /** @typedef {!Options} */
152
166
  module.exports.Options = Options;
153
167
  module.exports.Result = Result;
package/io/index.js CHANGED
@@ -89,10 +89,10 @@ exports.copy = function(src, dst) {
89
89
  return new Promise(function(fulfill, reject) {
90
90
  var rs = fs.createReadStream(src);
91
91
  rs.on('error', reject);
92
- rs.on('end', () => fulfill(dst));
93
92
 
94
93
  var ws = fs.createWriteStream(dst);
95
94
  ws.on('error', reject);
95
+ ws.on('close', () => fulfill(dst));
96
96
 
97
97
  rs.pipe(ws);
98
98
  });
package/io/zip.js CHANGED
@@ -45,7 +45,7 @@ class Zip {
45
45
  */
46
46
  addFile(filePath, zipPath = path.basename(filePath)) {
47
47
  let add = io.read(filePath)
48
- .then(buffer => this.z_.file(/** @type {string} */(zipPath), buffer));
48
+ .then(buffer => this.z_.file(/** @type {string} */(zipPath.replace(/\\/g, '/')), buffer));
49
49
  this.pendingAdds_.add(add);
50
50
  return add.then(
51
51
  () => this.pendingAdds_.delete(add),