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
@@ -22,6 +22,7 @@
22
22
  * WebDriver session.
23
23
  */
24
24
 
25
+ const proxy = require('./proxy');
25
26
  const Symbols = require('./symbols');
26
27
 
27
28
 
@@ -30,161 +31,190 @@ const Symbols = require('./symbols');
30
31
  * @enum {string}
31
32
  */
32
33
  const Browser = {
33
- ANDROID: 'android',
34
34
  CHROME: 'chrome',
35
35
  EDGE: 'MicrosoftEdge',
36
36
  FIREFOX: 'firefox',
37
37
  IE: 'internet explorer',
38
38
  INTERNET_EXPLORER: 'internet explorer',
39
- IPAD: 'iPad',
40
- IPHONE: 'iPhone',
41
- OPERA: 'opera',
42
- PHANTOM_JS: 'phantomjs',
43
39
  SAFARI: 'safari',
44
- HTMLUNIT: 'htmlunit'
45
40
  };
46
41
 
47
42
 
48
43
  /**
49
- * Common Capability keys.
44
+ * Strategies for waiting for [document readiness] after a navigation
45
+ * event.
46
+ *
47
+ * [document readiness]: https://html.spec.whatwg.org/#current-document-readiness
48
+ *
50
49
  * @enum {string}
51
50
  */
52
- const Capability = {
51
+ const PageLoadStrategy = {
52
+ /**
53
+ * Indicates WebDriver should not wait on the document readiness state after a
54
+ * navigation event.
55
+ */
56
+ NONE: 'none',
53
57
 
54
58
  /**
55
- * Indicates whether a driver should accept all SSL certs by default. This
56
- * capability only applies when requesting a new session. To query whether
57
- * a driver can handle insecure SSL certs, see {@link #SECURE_SSL}.
59
+ * Indicates WebDriver should wait for the document readiness state to
60
+ * become "interactive" after navigation.
58
61
  */
59
- ACCEPT_SSL_CERTS: 'acceptSslCerts',
62
+ EAGER: 'eager',
63
+
64
+ /**
65
+ * Indicates WebDriver should wait for the document readiness state to
66
+ * be "complete" after navigation. This is the default page loading strategy.
67
+ */
68
+ NORMAL: 'normal'
69
+ };
70
+
71
+
72
+ /**
73
+ * Common platform names. These platforms are not explicitly defined by the
74
+ * WebDriver spec, however, their use is encouraged for interoperability.
75
+ *
76
+ * @enum {string}
77
+ * @see <https://w3c.github.io/webdriver/webdriver-spec.html>
78
+ */
79
+ const Platform = {
80
+ LINUX: 'linux',
81
+ MAC: 'mac',
82
+ WINDOWS: 'windows'
83
+ };
84
+
85
+
86
+ /**
87
+ * Record object defining the timeouts that apply to certain WebDriver actions.
88
+ *
89
+ * @record
90
+ */
91
+ function Timeouts() {}
92
+
93
+ /**
94
+ * Defines when, in milliseconds, to interupt a script that is being
95
+ * {@linkplain ./webdriver.IWebDriver#executeScript evaluated}.
96
+ * @type {number}
97
+ */
98
+ Timeouts.prototype.script;
60
99
 
100
+ /**
101
+ * The timeout, in milliseconds, to apply to navigation events along with the
102
+ * {@link PageLoadStrategy}.
103
+ * @type {number}
104
+ */
105
+ Timeouts.prototype.pageLoad;
61
106
 
107
+ /**
108
+ * The maximimum amount of time, in milliseconds, to spend attempting to
109
+ * {@linkplain ./webdriver.IWebDriver#findElement locate} an element on the
110
+ * current page.
111
+ * @type {number}
112
+ */
113
+ Timeouts.prototype.implicit;
114
+
115
+
116
+ /**
117
+ * The possible default actions a WebDriver session can take to respond to
118
+ * unhandled user prompts (`window.alert()`, `window.confirm()`, and
119
+ * `window.prompt()`).
120
+ *
121
+ * @enum {string}
122
+ */
123
+ const UserPromptHandler = {
124
+ /** All prompts should be silently accepted. */
125
+ ACCEPT: 'accept',
126
+ /** All prompts should be silently dismissed. */
127
+ DISMISS: 'dismiss',
62
128
  /**
63
- * The browser name. Common browser names are defined in the {@link Browser}
64
- * enum.
129
+ * All prompts should be automatically accepted, but an error should be
130
+ * returned to the next (or currently executing) WebDriver command.
65
131
  */
66
- BROWSER_NAME: 'browserName',
132
+ ACCEPT_AND_NOTIFY: 'accept and notify',
133
+ /**
134
+ * All prompts should be automatically dismissed, but an error should be
135
+ * returned to the next (or currently executing) WebDriver command.
136
+ */
137
+ DISMISS_AND_NOTIFY: 'dismiss and notify',
138
+ /** All prompts should be left unhandled. */
139
+ IGNORE: 'ignore'
140
+ };
141
+
142
+
143
+ /**
144
+ * The standard WebDriver capability keys.
145
+ *
146
+ * @enum {string}
147
+ * @see <https://w3c.github.io/webdriver/webdriver-spec.html#capabilities>
148
+ */
149
+ const Capability = {
67
150
 
68
151
  /**
69
- * Defines how elements should be scrolled into the viewport for interaction.
70
- * This capability will be set to zero (0) if elements are aligned with the
71
- * top of the viewport, or one (1) if aligned with the bottom. The default
72
- * behavior is to align with the top of the viewport.
152
+ * Indicates whether a WebDriver session implicity trusts otherwise untrusted
153
+ * and self-signed TLS certificates during navigation.
73
154
  */
74
- ELEMENT_SCROLL_BEHAVIOR: 'elementScrollBehavior',
155
+ ACCEPT_INSECURE_TLS_CERTS: 'acceptInsecureCerts',
75
156
 
76
157
  /**
77
- * Whether the driver is capable of handling modal alerts (e.g. alert,
78
- * confirm, prompt). To define how a driver <i>should</i> handle alerts,
79
- * use {@link #UNEXPECTED_ALERT_BEHAVIOR}.
158
+ * The browser name. Common browser names are defined in the
159
+ * {@link ./capabilities.Browser Browser} enum.
80
160
  */
81
- HANDLES_ALERTS: 'handlesAlerts',
161
+ BROWSER_NAME: 'browserName',
162
+
163
+ /** Identifies the browser version. */
164
+ BROWSER_VERSION: 'browserVersion',
82
165
 
83
166
  /**
84
167
  * Key for the logging driver logging preferences.
168
+ * The browser name. Common browser names are defined in the
169
+ * {@link ./capabilities.Browser Browser} enum.
85
170
  */
86
171
  LOGGING_PREFS: 'loggingPrefs',
87
172
 
88
173
  /**
89
- * Whether this session generates native events when simulating user input.
174
+ * Defines the session's
175
+ * {@linkplain ./capabilities.PageLoadStrategy page loading strategy}.
90
176
  */
91
- NATIVE_EVENTS: 'nativeEvents',
177
+ PAGE_LOAD_STRATEGY: 'pageLoadStrategy',
92
178
 
93
179
  /**
94
- * Describes the platform the browser is running on. Will be one of
95
- * ANDROID, IOS, LINUX, MAC, UNIX, or WINDOWS. When <i>requesting</i> a
96
- * session, ANY may be used to indicate no platform preference (this is
97
- * semantically equivalent to omitting the platform capability).
180
+ * Identifies the operating system of the endpoint node. Common values
181
+ * recognized by the most WebDriver server implementations are predefined in
182
+ * the {@link ./capabilities.Platform Platform} enum.
98
183
  */
99
- PLATFORM: 'platform',
184
+ PLATFORM_NAME: 'platformName',
100
185
 
101
186
  /**
102
187
  * Describes the proxy configuration to use for a new WebDriver session.
103
188
  */
104
189
  PROXY: 'proxy',
105
190
 
106
- /** Whether the driver supports changing the browser's orientation. */
107
- ROTATABLE: 'rotatable',
108
-
109
191
  /**
110
- * Whether a driver is only capable of handling secure SSL certs. To request
111
- * that a driver accept insecure SSL certs by default, use
112
- * {@link #ACCEPT_SSL_CERTS}.
192
+ * Indicates whether the remote end supports all of the window resizing and
193
+ * positioning commands:
194
+ *
195
+ * - {@linkplain ./webdriver.Window#getRect Window.getRect()}
196
+ * - {@linkplain ./webdriver.Window#setRect Window.setRect()}
197
+ * - {@linkplain ./webdriver.Window#maximize Window.maximize()}
198
+ * - {@linkplain ./webdriver.Window#minimize Window.minimize()}
199
+ * - {@linkplain ./webdriver.Window#fullscreen Window.fullscreen()}
113
200
  */
114
- SECURE_SSL: 'secureSsl',
115
-
116
- /** Whether the driver supports manipulating the app cache. */
117
- SUPPORTS_APPLICATION_CACHE: 'applicationCacheEnabled',
118
-
119
- /** Whether the driver supports locating elements with CSS selectors. */
120
- SUPPORTS_CSS_SELECTORS: 'cssSelectorsEnabled',
121
-
122
- /** Whether the browser supports JavaScript. */
123
- SUPPORTS_JAVASCRIPT: 'javascriptEnabled',
124
-
125
- /** Whether the driver supports controlling the browser's location info. */
126
- SUPPORTS_LOCATION_CONTEXT: 'locationContextEnabled',
127
-
128
- /** Whether the driver supports taking screenshots. */
129
- TAKES_SCREENSHOT: 'takesScreenshot',
201
+ SET_WINDOW_RECT: 'setWindowRect',
130
202
 
131
203
  /**
132
- * Defines how the driver should handle unexpected alerts. The value should
133
- * be one of "accept", "dismiss", or "ignore".
204
+ * Describes the {@linkplain ./capabilities.Timeouts timeouts} imposed on
205
+ * certain session operations.
134
206
  */
135
- UNEXPECTED_ALERT_BEHAVIOR: 'unexpectedAlertBehaviour',
207
+ TIMEOUTS: 'timeouts',
136
208
 
137
- /** Defines the browser version. */
138
- VERSION: 'version'
209
+ /**
210
+ * Defines how a WebDriver session should
211
+ * {@linkplain ./capabilities.UserPromptHandler respond} to unhandled user
212
+ * prompts.
213
+ */
214
+ UNHANDLED_PROMPT_BEHAVIOR: 'unhandledPromptBehavior',
139
215
  };
140
216
 
141
217
 
142
- /**
143
- * Describes how a proxy should be configured for a WebDriver session.
144
- * @record
145
- */
146
- function ProxyConfig() {}
147
-
148
- /**
149
- * The proxy type. Must be one of {"manual", "pac", "system"}.
150
- * @type {string}
151
- */
152
- ProxyConfig.prototype.proxyType;
153
-
154
- /**
155
- * URL for the PAC file to use. Only used if {@link #proxyType} is "pac".
156
- * @type {(string|undefined)}
157
- */
158
- ProxyConfig.prototype.proxyAutoconfigUrl;
159
-
160
- /**
161
- * The proxy host for FTP requests. Only used if {@link #proxyType} is "manual".
162
- * @type {(string|undefined)}
163
- */
164
- ProxyConfig.prototype.ftpProxy;
165
-
166
- /**
167
- * The proxy host for HTTP requests. Only used if {@link #proxyType} is
168
- * "manual".
169
- * @type {(string|undefined)}
170
- */
171
- ProxyConfig.prototype.httpProxy;
172
-
173
- /**
174
- * The proxy host for HTTPS requests. Only used if {@link #proxyType} is
175
- * "manual".
176
- * @type {(string|undefined)}
177
- */
178
- ProxyConfig.prototype.sslProxy;
179
-
180
- /**
181
- * A comma delimited list of hosts which should bypass all proxies. Only used if
182
- * {@link #proxyType} is "manual".
183
- * @type {(string|undefined)}
184
- */
185
- ProxyConfig.prototype.noProxy;
186
-
187
-
188
218
  /**
189
219
  * Converts a generic hash object to a map.
190
220
  * @param {!Object<string, ?>} hash The hash object.
@@ -204,128 +234,93 @@ function toMap(hash) {
204
234
  /**
205
235
  * Describes a set of capabilities for a WebDriver session.
206
236
  */
207
- class Capabilities extends Map {
237
+ class Capabilities {
208
238
  /**
209
- * @param {(Capabilities|Map<string, ?>|Object)=} opt_other Another set of
239
+ * @param {(Capabilities|Map<string, ?>|Object)=} other Another set of
210
240
  * capabilities to initialize this instance from.
211
241
  */
212
- constructor(opt_other) {
213
- if (opt_other && !(opt_other instanceof Map)) {
214
- opt_other = toMap(opt_other);
242
+ constructor(other = undefined) {
243
+ if (other instanceof Capabilities) {
244
+ other = other.map_;
245
+ } else if (other && !(other instanceof Map)) {
246
+ other = toMap(other);
215
247
  }
216
- super(opt_other);
217
- }
218
-
219
- /**
220
- * @return {!Capabilities} A basic set of capabilities for Android.
221
- */
222
- static android() {
223
- return new Capabilities()
224
- .set(Capability.BROWSER_NAME, Browser.ANDROID)
225
- .set(Capability.PLATFORM, 'ANDROID');
248
+ /** @private @const {!Map<string, ?>} */
249
+ this.map_ = new Map(other);
226
250
  }
227
251
 
228
252
  /**
229
253
  * @return {!Capabilities} A basic set of capabilities for Chrome.
230
254
  */
231
255
  static chrome() {
232
- return new Capabilities().set(Capability.BROWSER_NAME, Browser.CHROME);
256
+ return new Capabilities().setBrowserName(Browser.CHROME);
233
257
  }
234
258
 
235
259
  /**
236
260
  * @return {!Capabilities} A basic set of capabilities for Microsoft Edge.
237
261
  */
238
262
  static edge() {
239
- return new Capabilities()
240
- .set(Capability.BROWSER_NAME, Browser.EDGE)
241
- .set(Capability.PLATFORM, 'WINDOWS');
263
+ return new Capabilities().setBrowserName(Browser.EDGE);
242
264
  }
243
265
 
244
266
  /**
245
267
  * @return {!Capabilities} A basic set of capabilities for Firefox.
246
268
  */
247
269
  static firefox() {
248
- return new Capabilities().set(Capability.BROWSER_NAME, Browser.FIREFOX);
270
+ return new Capabilities().setBrowserName(Browser.FIREFOX);
249
271
  }
250
272
 
251
273
  /**
252
274
  * @return {!Capabilities} A basic set of capabilities for Internet Explorer.
253
275
  */
254
276
  static ie() {
255
- return new Capabilities().
256
- set(Capability.BROWSER_NAME, Browser.INTERNET_EXPLORER).
257
- set(Capability.PLATFORM, 'WINDOWS');
258
- }
259
-
260
- /**
261
- * @return {!Capabilities} A basic set of capabilities for iPad.
262
- */
263
- static ipad() {
264
- return new Capabilities().
265
- set(Capability.BROWSER_NAME, Browser.IPAD).
266
- set(Capability.PLATFORM, 'MAC');
277
+ return new Capabilities().setBrowserName(Browser.INTERNET_EXPLORER);
267
278
  }
268
279
 
269
280
  /**
270
- * @return {!Capabilities} A basic set of capabilities for iPhone.
281
+ * @return {!Capabilities} A basic set of capabilities for Safari.
271
282
  */
272
- static iphone() {
273
- return new Capabilities().
274
- set(Capability.BROWSER_NAME, Browser.IPHONE).
275
- set(Capability.PLATFORM, 'MAC');
283
+ static safari() {
284
+ return new Capabilities().setBrowserName(Browser.SAFARI);
276
285
  }
277
286
 
278
287
  /**
279
- * @return {!Capabilities} A basic set of capabilities for Opera.
288
+ * @return {!Object<string, ?>} The JSON representation of this instance.
289
+ * Note, the returned object may contain nested promised values.
290
+ * @suppress {checkTypes} Suppress [] access on a struct (state inherited from
291
+ * Map).
280
292
  */
281
- static opera() {
282
- return new Capabilities().
283
- set(Capability.BROWSER_NAME, Browser.OPERA);
293
+ [Symbols.serialize]() {
294
+ return serialize(this);
284
295
  }
285
296
 
286
297
  /**
287
- * @return {!Capabilities} A basic set of capabilities for PhantomJS.
298
+ * @param {string} key the parameter key to get.
299
+ * @return {T} the stored parameter value.
300
+ * @template T
288
301
  */
289
- static phantomjs() {
290
- return new Capabilities().
291
- set(Capability.BROWSER_NAME, Browser.PHANTOM_JS);
302
+ get(key) {
303
+ return this.map_.get(key);
292
304
  }
293
305
 
294
306
  /**
295
- * @return {!Capabilities} A basic set of capabilities for Safari.
307
+ * @param {string} key the key to test.
308
+ * @return {boolean} whether this capability set has the specified key.
296
309
  */
297
- static safari() {
298
- return new Capabilities().
299
- set(Capability.BROWSER_NAME, Browser.SAFARI).
300
- set(Capability.PLATFORM, 'MAC');
310
+ has(key) {
311
+ return this.map_.has(key);
301
312
  }
302
313
 
303
314
  /**
304
- * @return {!Capabilities} A basic set of capabilities for HTMLUnit.
315
+ * @return {!Iterator<string>} an iterator of the keys set.
305
316
  */
306
- static htmlunit() {
307
- return new Capabilities().
308
- set(Capability.BROWSER_NAME, Browser.HTMLUNIT);
317
+ keys() {
318
+ return this.map_.keys();
309
319
  }
310
320
 
311
- /**
312
- * @return {!Capabilities} A basic set of capabilities for HTMLUnit
313
- * with enabled Javascript.
314
- */
315
- static htmlunitwithjs() {
316
- return new Capabilities().
317
- set(Capability.BROWSER_NAME, Browser.HTMLUNIT).
318
- set(Capability.SUPPORTS_JAVASCRIPT, true);
319
- }
320
-
321
- /**
322
- * @return {!Object<string, ?>} The JSON representation of this instance.
323
- * Note, the returned object may contain nested promised values.
324
- * @suppress {checkTypes} Suppress [] access on a struct (state inherited from
325
- * Map).
326
- */
327
- [Symbols.serialize]() {
328
- return serialize(this);
321
+ /** @return {number} The number of capabilities set. */
322
+ get size() {
323
+ return this.map_.size;
329
324
  }
330
325
 
331
326
  /**
@@ -335,19 +330,31 @@ class Capabilities extends Map {
335
330
  * @return {!Capabilities} A self reference.
336
331
  */
337
332
  merge(other) {
338
- if (!other) {
333
+ if (other) {
334
+ let otherMap;
335
+ if (other instanceof Capabilities) {
336
+ otherMap = other.map_;
337
+ } else if (other instanceof Map) {
338
+ otherMap = other;
339
+ } else {
340
+ otherMap = toMap(other);
341
+ }
342
+ otherMap.forEach((value, key) => {
343
+ this.set(key, value);
344
+ });
345
+ return this;
346
+ } else {
339
347
  throw new TypeError('no capabilities provided for merge');
340
348
  }
349
+ }
341
350
 
342
- if (!(other instanceof Map)) {
343
- other = toMap(other);
344
- }
345
-
346
- for (let key of other.keys()) {
347
- this.set(key, other.get(key));
348
- }
349
-
350
- return this;
351
+ /**
352
+ * Deletes an entry from this set of capabilities.
353
+ *
354
+ * @param {string} key the capability key to delete.
355
+ */
356
+ delete(key) {
357
+ this.map_.delete(key);
351
358
  }
352
359
 
353
360
  /**
@@ -355,16 +362,107 @@ class Capabilities extends Map {
355
362
  * @param {*} value The capability value.
356
363
  * @return {!Capabilities} A self reference.
357
364
  * @throws {TypeError} If the `key` is not a string.
358
- * @override
359
365
  */
360
366
  set(key, value) {
361
367
  if (typeof key !== 'string') {
362
368
  throw new TypeError('Capability keys must be strings: ' + typeof key);
363
369
  }
364
- super.set(key, value);
370
+ this.map_.set(key, value);
365
371
  return this;
366
372
  }
367
373
 
374
+ /**
375
+ * Sets whether a WebDriver session should implicitly accept self-signed, or
376
+ * other untrusted TLS certificates on navigation.
377
+ *
378
+ * @param {boolean} accept whether to accept insecure certs.
379
+ * @return {!Capabilities} a self reference.
380
+ */
381
+ setAcceptInsecureCerts(accept) {
382
+ return this.set(Capability.ACCEPT_INSECURE_TLS_CERTS, accept);
383
+ }
384
+
385
+ /**
386
+ * @return {boolean} whether the session is configured to accept insecure
387
+ * TLS certificates.
388
+ */
389
+ getAcceptInsecureCerts() {
390
+ return this.get(Capability.ACCEPT_INSECURE_TLS_CERTS);
391
+ }
392
+
393
+ /**
394
+ * Sets the name of the target browser.
395
+ *
396
+ * @param {(Browser|string)} name the browser name.
397
+ * @return {!Capabilities} a self reference.
398
+ */
399
+ setBrowserName(name) {
400
+ return this.set(Capability.BROWSER_NAME, name);
401
+ }
402
+
403
+ /**
404
+ * @return {(string|undefined)} the configured browser name, or undefined if
405
+ * not set.
406
+ */
407
+ getBrowserName() {
408
+ return this.get(Capability.BROWSER_NAME);
409
+ }
410
+
411
+ /**
412
+ * Sets the desired version of the target browser.
413
+ *
414
+ * @param {string} version the desired version.
415
+ * @return {!Capabilities} a self reference.
416
+ */
417
+ setBrowserVersion(version) {
418
+ return this.set(Capability.BROWSER_VERSION, version);
419
+ }
420
+
421
+ /**
422
+ * @return {(string|undefined)} the configured browser version, or undefined
423
+ * if not set.
424
+ */
425
+ getBrowserVersion() {
426
+ return this.get(Capability.BROWSER_VERSION);
427
+ }
428
+
429
+ /**
430
+ * Sets the desired page loading strategy for a new WebDriver session.
431
+ *
432
+ * @param {PageLoadStrategy} strategy the desired strategy.
433
+ * @return {!Capabilities} a self reference.
434
+ */
435
+ setPageLoadStrategy(strategy) {
436
+ return this.set(Capability.PAGE_LOAD_STRATEGY, strategy);
437
+ }
438
+
439
+ /**
440
+ * Returns the configured page load strategy.
441
+ *
442
+ * @return {(string|undefined)} the page load strategy.
443
+ */
444
+ getPageLoadStrategy() {
445
+ return this.get(Capability.PAGE_LOAD_STRATEGY);
446
+ }
447
+
448
+ /**
449
+ * Sets the target platform.
450
+ *
451
+ * @param {(Platform|string)} platform the target platform.
452
+ * @return {!Capabilities} a self reference.
453
+ */
454
+ setPlatform(platform) {
455
+ return this.set(Capability.PLATFORM_NAME, platform);
456
+ }
457
+
458
+ /**
459
+ * @return {(string|undefined)} the configured platform or undefined if not
460
+ * set.
461
+ */
462
+ getPlatform() {
463
+ return this.get(Capability.PLATFORM_NAME);
464
+ }
465
+
368
466
  /**
369
467
  * Sets the logging preferences. Preferences may be specified as a
370
468
  * {@link ./logging.Preferences} instance, or as a map of log-type to
@@ -379,7 +477,7 @@ class Capabilities extends Map {
379
477
 
380
478
  /**
381
479
  * Sets the proxy configuration for this instance.
382
- * @param {ProxyConfig} proxy The desired proxy configuration.
480
+ * @param {proxy.Config} proxy The desired proxy configuration.
383
481
  * @return {!Capabilities} A self reference.
384
482
  */
385
483
  setProxy(proxy) {
@@ -387,33 +485,32 @@ class Capabilities extends Map {
387
485
  }
388
486
 
389
487
  /**
390
- * Sets whether native events should be used.
391
- * @param {boolean} enabled Whether to enable native events.
392
- * @return {!Capabilities} A self reference.
488
+ * @return {(proxy.Config|undefined)} the configured proxy settings, or
489
+ * undefined if not set.
393
490
  */
394
- setEnableNativeEvents(enabled) {
395
- return this.set(Capability.NATIVE_EVENTS, enabled);
491
+ getProxy() {
492
+ return this.get(Capability.PROXY);
396
493
  }
397
494
 
398
495
  /**
399
- * Sets how elements should be scrolled into view for interaction.
400
- * @param {number} behavior The desired scroll behavior: either 0 to align
401
- * with the top of the viewport or 1 to align with the bottom.
496
+ * Sets the default action to take with an unexpected alert before returning
497
+ * an error. If unspecified, WebDriver will default to
498
+ * {@link UserPromptHandler.DISMISS_AND_NOTIFY}.
499
+ *
500
+ * @param {?UserPromptHandler} behavior The way WebDriver should respond to
501
+ * unhandled user prompts.
402
502
  * @return {!Capabilities} A self reference.
403
503
  */
404
- setScrollBehavior(behavior) {
405
- return this.set(Capability.ELEMENT_SCROLL_BEHAVIOR, behavior);
504
+ setAlertBehavior(behavior) {
505
+ return this.set(Capability.UNHANDLED_PROMPT_BEHAVIOR, behavior);
406
506
  }
407
507
 
408
508
  /**
409
- * Sets the default action to take with an unexpected alert before returning
410
- * an error.
411
- * @param {string} behavior The desired behavior should be "accept",
412
- * "dismiss", or "ignore". Defaults to "dismiss".
413
- * @return {!Capabilities} A self reference.
509
+ * @return {(UserPromptHandler|undefined)} the behavior pattern for responding
510
+ * to unhandled user prompts, or undefined if not set.
414
511
  */
415
- setAlertBehavior(behavior) {
416
- return this.set(Capability.UNEXPECTED_ALERT_BEHAVIOR, behavior);
512
+ getAlertBehavior() {
513
+ return this.get(Capability.UNHANDLED_PROMPT_BEHAVIOR);
417
514
  }
418
515
  }
419
516
 
@@ -443,8 +540,11 @@ function serialize(caps) {
443
540
 
444
541
 
445
542
  module.exports = {
446
- Browser: Browser,
447
- Capabilities: Capabilities,
448
- Capability: Capability,
449
- ProxyConfig: ProxyConfig
543
+ Browser,
544
+ Capabilities,
545
+ Capability,
546
+ PageLoadStrategy,
547
+ Platform,
548
+ Timeouts,
549
+ UserPromptHandler,
450
550
  };