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.
- package/CHANGES.md +246 -0
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/README.md +40 -40
- package/chrome.js +118 -134
- package/edge.js +43 -117
- package/example/chrome_android.js +8 -9
- package/example/chrome_mobile_emulation.js +8 -9
- package/example/firefox_channels.js +23 -19
- package/example/google_search.js +3 -3
- package/example/google_search_test.js +38 -27
- package/example/{chrome_headless.js → headless.js} +15 -7
- package/example/logging.js +40 -7
- package/firefox.js +789 -0
- package/http/index.js +62 -9
- package/http/util.js +11 -6
- package/ie.js +83 -97
- package/index.js +198 -114
- package/io/exec.js +29 -15
- package/io/index.js +1 -1
- package/io/zip.js +1 -1
- package/lib/actions.js +68 -63
- package/lib/atoms/get-attribute.js +86 -0
- package/lib/atoms/is-displayed.js +76 -76
- package/lib/by.js +7 -4
- package/lib/capabilities.js +310 -210
- package/lib/command.js +27 -51
- package/lib/error.js +100 -41
- package/lib/http.js +161 -120
- package/lib/input.js +1044 -8
- package/lib/logging.js +1 -5
- package/lib/promise.js +222 -3331
- package/lib/proxy.js +134 -39
- package/lib/session.js +2 -2
- package/lib/symbols.js +0 -0
- package/lib/until.js +1 -1
- package/lib/webdriver.js +717 -953
- package/net/index.js +21 -25
- package/net/portprober.js +51 -68
- package/package.json +17 -12
- package/proxy.js +0 -0
- package/remote/index.js +63 -44
- package/safari.js +41 -128
- package/testing/index.js +386 -315
- package/.npmignore +0 -2
- package/example/async_await_test.js +0 -68
- package/example/google_search_generator.js +0 -50
- package/example/parallel_flows.js +0 -54
- package/firefox/binary.js +0 -344
- package/firefox/extension.js +0 -224
- package/firefox/index.js +0 -626
- package/firefox/profile.js +0 -394
- package/lib/README +0 -5
- package/lib/atoms/getAttribute.js +0 -9
- package/lib/devmode.js +0 -34
- package/lib/events.js +0 -210
- package/lib/firefox/webdriver.json +0 -70
- package/lib/test/build.js +0 -151
- package/lib/test/data/ClickTest_testClicksASurroundingStrongTag.html +0 -11
- package/lib/test/data/Page.aspx +0 -17
- package/lib/test/data/Page.aspx.cs +0 -22
- package/lib/test/data/Redirect.aspx +0 -11
- package/lib/test/data/Redirect.aspx.cs +0 -9
- package/lib/test/data/Settings.StyleCop +0 -759
- package/lib/test/data/Web.Config +0 -59
- package/lib/test/data/actualXhtmlPage.xhtml +0 -14
- package/lib/test/data/ajaxy_page.html +0 -81
- package/lib/test/data/alerts.html +0 -85
- package/lib/test/data/banner.gif +0 -0
- package/lib/test/data/beach.jpg +0 -0
- package/lib/test/data/blank.html +0 -1
- package/lib/test/data/bodyTypingTest.html +0 -41
- package/lib/test/data/booleanAttributes.html +0 -19
- package/lib/test/data/child/childPage.html +0 -8
- package/lib/test/data/child/grandchild/grandchildPage.html +0 -8
- package/lib/test/data/clickEventPage.html +0 -26
- package/lib/test/data/click_frames.html +0 -10
- package/lib/test/data/click_jacker.html +0 -38
- package/lib/test/data/click_out_of_bounds.html +0 -23
- package/lib/test/data/click_out_of_bounds_overflow.html +0 -85
- package/lib/test/data/click_rtl.html +0 -19
- package/lib/test/data/click_source.html +0 -18
- package/lib/test/data/click_tests/click_iframe.html +0 -6
- package/lib/test/data/click_tests/click_in_iframe.html +0 -8
- package/lib/test/data/click_tests/disabled_element.html +0 -12
- package/lib/test/data/click_tests/disappearing_element.html +0 -62
- package/lib/test/data/click_tests/google_map.html +0 -15
- package/lib/test/data/click_tests/google_map.png +0 -0
- package/lib/test/data/click_tests/html5_submit_buttons.html +0 -16
- package/lib/test/data/click_tests/issue5237.html +0 -9
- package/lib/test/data/click_tests/issue5237_frame.html +0 -1
- package/lib/test/data/click_tests/issue5237_target.html +0 -10
- package/lib/test/data/click_tests/link_that_wraps.html +0 -11
- package/lib/test/data/click_tests/mapped_page1.html +0 -9
- package/lib/test/data/click_tests/mapped_page2.html +0 -9
- package/lib/test/data/click_tests/mapped_page3.html +0 -9
- package/lib/test/data/click_tests/overlapping_elements.html +0 -70
- package/lib/test/data/click_tests/partially_overlapping_elements.html +0 -124
- package/lib/test/data/click_tests/span_that_wraps.html +0 -11
- package/lib/test/data/click_tests/submitted_page.html +0 -9
- package/lib/test/data/click_tests/wrapped_overlapping_elements.html +0 -13
- package/lib/test/data/click_too_big.html +0 -10
- package/lib/test/data/click_too_big_in_frame.html +0 -11
- package/lib/test/data/clicks.html +0 -35
- package/lib/test/data/closeable_window.html +0 -8
- package/lib/test/data/cn-test.html +0 -156
- package/lib/test/data/colorPage.html +0 -20
- package/lib/test/data/cookies.html +0 -30
- package/lib/test/data/coordinates_tests/element_in_frame.html +0 -9
- package/lib/test/data/coordinates_tests/element_in_nested_frame.html +0 -9
- package/lib/test/data/coordinates_tests/page_with_element_out_of_view.html +0 -11
- package/lib/test/data/coordinates_tests/page_with_empty_element.html +0 -10
- package/lib/test/data/coordinates_tests/page_with_fixed_element.html +0 -12
- package/lib/test/data/coordinates_tests/page_with_hidden_element.html +0 -10
- package/lib/test/data/coordinates_tests/page_with_invisible_element.html +0 -10
- package/lib/test/data/coordinates_tests/page_with_transparent_element.html +0 -10
- package/lib/test/data/coordinates_tests/simple_page.html +0 -10
- package/lib/test/data/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/jquery-ui-1.8.10.custom.css +0 -573
- package/lib/test/data/cssTransform.html +0 -61
- package/lib/test/data/cssTransform2.html +0 -20
- package/lib/test/data/document_write_in_onload.html +0 -13
- package/lib/test/data/dragAndDropInsideScrolledDiv.html +0 -67
- package/lib/test/data/dragAndDropTest.html +0 -102
- package/lib/test/data/dragDropOverflow.html +0 -104
- package/lib/test/data/draggableLists.html +0 -67
- package/lib/test/data/droppableItems.html +0 -65
- package/lib/test/data/dynamic.html +0 -39
- package/lib/test/data/dynamicallyModifiedPage.html +0 -42
- package/lib/test/data/errors.html +0 -15
- package/lib/test/data/firefox/jetpack-sample.xpi +0 -0
- package/lib/test/data/firefox/sample.xpi +0 -0
- package/lib/test/data/firefox/webextension.xpi +0 -0
- package/lib/test/data/fixedFooterNoScroll.html +0 -13
- package/lib/test/data/fixedFooterNoScrollQuirksMode.html +0 -12
- package/lib/test/data/formPage.html +0 -175
- package/lib/test/data/formSelectionPage.html +0 -46
- package/lib/test/data/form_handling_js_submit.html +0 -30
- package/lib/test/data/framePage3.html +0 -7
- package/lib/test/data/frameScrollChild.html +0 -26
- package/lib/test/data/frameScrollPage.html +0 -14
- package/lib/test/data/frameScrollParent.html +0 -11
- package/lib/test/data/frameWithAnimals.html +0 -11
- package/lib/test/data/frame_switching_tests/bug4876.html +0 -9
- package/lib/test/data/frame_switching_tests/bug4876_iframe.html +0 -9
- package/lib/test/data/frame_switching_tests/deletingFrame.html +0 -29
- package/lib/test/data/frame_switching_tests/deletingFrame_iframe.html +0 -8
- package/lib/test/data/frame_switching_tests/deletingFrame_iframe2.html +0 -7
- package/lib/test/data/frameset.html +0 -14
- package/lib/test/data/framesetPage2.html +0 -7
- package/lib/test/data/framesetPage3.html +0 -4
- package/lib/test/data/globalscope.html +0 -15
- package/lib/test/data/hidden.html +0 -5
- package/lib/test/data/hidden_partially.html +0 -45
- package/lib/test/data/html5/blue.jpg +0 -0
- package/lib/test/data/html5/database.js +0 -84
- package/lib/test/data/html5/geolocation.js +0 -18
- package/lib/test/data/html5/green.jpg +0 -0
- package/lib/test/data/html5/red.jpg +0 -0
- package/lib/test/data/html5/status.html +0 -1
- package/lib/test/data/html5/test.appcache +0 -11
- package/lib/test/data/html5/yellow.jpg +0 -0
- package/lib/test/data/html5Page.html +0 -32
- package/lib/test/data/icon.gif +0 -0
- package/lib/test/data/idElements.html +0 -2
- package/lib/test/data/iframeAtBottom.html +0 -15
- package/lib/test/data/iframeWithAlert.html +0 -1
- package/lib/test/data/iframeWithIframe.html +0 -1
- package/lib/test/data/iframes.html +0 -11
- package/lib/test/data/injectableContent.html +0 -22
- package/lib/test/data/javascriptEnhancedForm.html +0 -30
- package/lib/test/data/javascriptPage.html +0 -285
- package/lib/test/data/jquery-1.3.2.js +0 -4376
- package/lib/test/data/js/jquery-1.4.4.min.js +0 -167
- package/lib/test/data/js/jquery-ui-1.8.10.custom.min.js +0 -782
- package/lib/test/data/js/skins/lightgray/content.inline.min.css +0 -1
- package/lib/test/data/js/skins/lightgray/content.min.css +0 -1
- package/lib/test/data/js/skins/lightgray/fonts/readme.md +0 -1
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.dev.svg +0 -175
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.eot +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.svg +0 -62
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.woff +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.dev.svg +0 -153
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.eot +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.svg +0 -63
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.ttf +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.woff +0 -0
- package/lib/test/data/js/skins/lightgray/img/anchor.gif +0 -0
- package/lib/test/data/js/skins/lightgray/img/loader.gif +0 -0
- package/lib/test/data/js/skins/lightgray/img/object.gif +0 -0
- package/lib/test/data/js/skins/lightgray/img/trans.gif +0 -0
- package/lib/test/data/js/skins/lightgray/skin.ie7.min.css +0 -1
- package/lib/test/data/js/skins/lightgray/skin.min.css +0 -1
- package/lib/test/data/js/themes/modern/theme.min.js +0 -1
- package/lib/test/data/js/tinymce.min.js +0 -10
- package/lib/test/data/key_logger.html +0 -34
- package/lib/test/data/key_tests/remove_on_keypress.html +0 -36
- package/lib/test/data/keyboard_shortcut.html +0 -36
- package/lib/test/data/linked_image.html +0 -16
- package/lib/test/data/locators_tests/boolean_attribute_selected.html +0 -13
- package/lib/test/data/locators_tests/boolean_attribute_selected_html4.html +0 -13
- package/lib/test/data/longContentPage.html +0 -55
- package/lib/test/data/macbeth.html +0 -5255
- package/lib/test/data/map.png +0 -0
- package/lib/test/data/map_visibility.html +0 -8
- package/lib/test/data/markerTransparent.png +0 -0
- package/lib/test/data/messages.html +0 -15
- package/lib/test/data/meta-redirect.html +0 -11
- package/lib/test/data/missedJsReference.html +0 -11
- package/lib/test/data/modal_dialogs/modal_1.html +0 -21
- package/lib/test/data/modal_dialogs/modal_2.html +0 -21
- package/lib/test/data/modal_dialogs/modal_3.html +0 -15
- package/lib/test/data/modal_dialogs/modalindex.html +0 -21
- package/lib/test/data/mouseOver.html +0 -17
- package/lib/test/data/mousePositionTracker.html +0 -33
- package/lib/test/data/nestedElements.html +0 -164
- package/lib/test/data/overflow/x_auto_y_auto.html +0 -30
- package/lib/test/data/overflow/x_auto_y_hidden.html +0 -30
- package/lib/test/data/overflow/x_auto_y_scroll.html +0 -30
- package/lib/test/data/overflow/x_hidden_y_auto.html +0 -30
- package/lib/test/data/overflow/x_hidden_y_hidden.html +0 -30
- package/lib/test/data/overflow/x_hidden_y_scroll.html +0 -30
- package/lib/test/data/overflow/x_scroll_y_auto.html +0 -30
- package/lib/test/data/overflow/x_scroll_y_hidden.html +0 -30
- package/lib/test/data/overflow/x_scroll_y_scroll.html +0 -30
- package/lib/test/data/overflow-body.html +0 -15
- package/lib/test/data/pageWithOnBeforeUnloadMessage.html +0 -20
- package/lib/test/data/pageWithOnLoad.html +0 -6
- package/lib/test/data/pageWithOnUnload.html +0 -6
- package/lib/test/data/page_with_link_to_slow_loading_page.html +0 -6
- package/lib/test/data/plain.txt +0 -1
- package/lib/test/data/proxy/page1.html +0 -20
- package/lib/test/data/proxy/page2.html +0 -24
- package/lib/test/data/proxy/page3.html +0 -5
- package/lib/test/data/readOnlyPage.html +0 -24
- package/lib/test/data/rectangles.html +0 -40
- package/lib/test/data/resultPage.html +0 -25
- package/lib/test/data/rich_text.html +0 -161
- package/lib/test/data/safari/frames_benchmark.html +0 -31
- package/lib/test/data/screen/screen.css +0 -19
- package/lib/test/data/screen/screen.html +0 -72
- package/lib/test/data/screen/screen.js +0 -7
- package/lib/test/data/screen/screen_frame1.html +0 -72
- package/lib/test/data/screen/screen_frame2.html +0 -72
- package/lib/test/data/screen/screen_frames.html +0 -11
- package/lib/test/data/screen/screen_iframes.html +0 -12
- package/lib/test/data/screen/screen_too_long.html +0 -68
- package/lib/test/data/screen/screen_x_long.html +0 -72
- package/lib/test/data/screen/screen_x_too_long.html +0 -72
- package/lib/test/data/screen/screen_y_long.html +0 -72
- package/lib/test/data/screen/screen_y_too_long.html +0 -72
- package/lib/test/data/scroll.html +0 -27
- package/lib/test/data/scroll2.html +0 -21
- package/lib/test/data/scroll3.html +0 -8
- package/lib/test/data/scroll4.html +0 -7
- package/lib/test/data/scroll5.html +0 -18
- package/lib/test/data/scrolling_tests/frame_with_height_above_200.html +0 -26
- package/lib/test/data/scrolling_tests/frame_with_height_above_2000.html +0 -26
- package/lib/test/data/scrolling_tests/frame_with_nested_scrolling_frame.html +0 -11
- package/lib/test/data/scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/frame_with_small_height.html +0 -10
- package/lib/test/data/scrolling_tests/page_with_double_overflow_auto.html +0 -19
- package/lib/test/data/scrolling_tests/page_with_frame_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/page_with_nested_scrolling_frames.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/page_with_non_scrolling_frame.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_scrolling_frame.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_scrolling_frame_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/page_with_tall_frame.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_y_overflow_auto.html +0 -14
- package/lib/test/data/scrolling_tests/target_page.html +0 -9
- package/lib/test/data/selectPage.html +0 -58
- package/lib/test/data/selectableItems.html +0 -65
- package/lib/test/data/sessionCookie.html +0 -21
- package/lib/test/data/sessionCookieDest.html +0 -34
- package/lib/test/data/simple.xml +0 -5
- package/lib/test/data/simpleTest.html +0 -98
- package/lib/test/data/single_text_input.html +0 -12
- package/lib/test/data/slowLoadingAlert.html +0 -10
- package/lib/test/data/slowLoadingResourcePage.html +0 -12
- package/lib/test/data/slow_loading_iframes.html +0 -14
- package/lib/test/data/styledPage.html +0 -28
- package/lib/test/data/svgPiechart.xhtml +0 -81
- package/lib/test/data/svgTest.svg +0 -4
- package/lib/test/data/tables.html +0 -36
- package/lib/test/data/tinymce.html +0 -10
- package/lib/test/data/transformable.xml +0 -11
- package/lib/test/data/transformable.xsl +0 -37
- package/lib/test/data/transparentUpload.html +0 -70
- package/lib/test/data/underscore.html +0 -9
- package/lib/test/data/unicode_ltr.html +0 -8
- package/lib/test/data/upload.html +0 -45
- package/lib/test/data/userDefinedProperty.html +0 -8
- package/lib/test/data/veryLargeCanvas.html +0 -81
- package/lib/test/data/visibility-css.html +0 -21
- package/lib/test/data/win32frameset.html +0 -8
- package/lib/test/data/window_switching_tests/page_with_frame.html +0 -12
- package/lib/test/data/window_switching_tests/simple_page.html +0 -9
- package/lib/test/data/xhtmlFormPage.xhtml +0 -17
- package/lib/test/data/xhtmlTest.html +0 -76
- package/lib/test/fileserver.js +0 -321
- package/lib/test/httpserver.js +0 -120
- package/lib/test/index.js +0 -270
- package/lib/test/promise.js +0 -79
- package/lib/test/resources.js +0 -44
- package/opera.js +0 -405
- package/phantomjs.js +0 -282
- package/test/actions_test.js +0 -52
- package/test/chrome/options_test.js +0 -227
- package/test/chrome/service_test.js +0 -45
- package/test/cookie_test.js +0 -214
- package/test/element_finding_test.js +0 -426
- package/test/execute_script_test.js +0 -350
- package/test/fingerprint_test.js +0 -62
- package/test/firefox/extension_test.js +0 -120
- package/test/firefox/firefox_test.js +0 -261
- package/test/firefox/profile_test.js +0 -140
- package/test/http/http_test.js +0 -223
- package/test/http/util_test.js +0 -178
- package/test/io/io_test.js +0 -360
- package/test/io/zip_test.js +0 -128
- package/test/lib/by_test.js +0 -160
- package/test/lib/capabilities_test.js +0 -111
- package/test/lib/error_test.js +0 -305
- package/test/lib/events_test.js +0 -177
- package/test/lib/http_test.js +0 -696
- package/test/lib/logging_test.js +0 -272
- package/test/lib/promise_aplus_test.js +0 -78
- package/test/lib/promise_error_test.js +0 -884
- package/test/lib/promise_flow_test.js +0 -2288
- package/test/lib/promise_generator_test.js +0 -310
- package/test/lib/promise_test.js +0 -1109
- package/test/lib/testutil.js +0 -90
- package/test/lib/until_test.js +0 -478
- package/test/lib/webdriver_test.js +0 -2311
- package/test/logging_test.js +0 -167
- package/test/net/index_test.js +0 -60
- package/test/net/portprober_test.js +0 -128
- package/test/page_loading_test.js +0 -166
- package/test/phantomjs/execute_phantomjs_test.js +0 -59
- package/test/proxy_test.js +0 -180
- package/test/rect_test.js +0 -60
- package/test/remote_test.js +0 -117
- package/test/safari_test.js +0 -108
- package/test/session_test.js +0 -99
- package/test/stale_element_test.js +0 -63
- package/test/tag_name_test.js +0 -36
- package/test/testing/assert_test.js +0 -373
- package/test/testing/index_test.js +0 -224
- package/test/upload_test.js +0 -86
- package/test/window_test.js +0 -161
- package/testing/assert.js +0 -378
package/lib/capabilities.js
CHANGED
|
@@ -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
|
-
*
|
|
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
|
|
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
|
|
56
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
64
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
70
|
-
*
|
|
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
|
-
|
|
155
|
+
ACCEPT_INSECURE_TLS_CERTS: 'acceptInsecureCerts',
|
|
75
156
|
|
|
76
157
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
174
|
+
* Defines the session's
|
|
175
|
+
* {@linkplain ./capabilities.PageLoadStrategy page loading strategy}.
|
|
90
176
|
*/
|
|
91
|
-
|
|
177
|
+
PAGE_LOAD_STRATEGY: 'pageLoadStrategy',
|
|
92
178
|
|
|
93
179
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
133
|
-
*
|
|
204
|
+
* Describes the {@linkplain ./capabilities.Timeouts timeouts} imposed on
|
|
205
|
+
* certain session operations.
|
|
134
206
|
*/
|
|
135
|
-
|
|
207
|
+
TIMEOUTS: 'timeouts',
|
|
136
208
|
|
|
137
|
-
/**
|
|
138
|
-
|
|
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
|
|
237
|
+
class Capabilities {
|
|
208
238
|
/**
|
|
209
|
-
* @param {(Capabilities|Map<string, ?>|Object)=}
|
|
239
|
+
* @param {(Capabilities|Map<string, ?>|Object)=} other Another set of
|
|
210
240
|
* capabilities to initialize this instance from.
|
|
211
241
|
*/
|
|
212
|
-
constructor(
|
|
213
|
-
if (
|
|
214
|
-
|
|
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
|
-
|
|
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().
|
|
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().
|
|
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
|
|
281
|
+
* @return {!Capabilities} A basic set of capabilities for Safari.
|
|
271
282
|
*/
|
|
272
|
-
static
|
|
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 {!
|
|
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
|
-
|
|
282
|
-
return
|
|
283
|
-
set(Capability.BROWSER_NAME, Browser.OPERA);
|
|
293
|
+
[Symbols.serialize]() {
|
|
294
|
+
return serialize(this);
|
|
284
295
|
}
|
|
285
296
|
|
|
286
297
|
/**
|
|
287
|
-
* @
|
|
298
|
+
* @param {string} key the parameter key to get.
|
|
299
|
+
* @return {T} the stored parameter value.
|
|
300
|
+
* @template T
|
|
288
301
|
*/
|
|
289
|
-
|
|
290
|
-
return
|
|
291
|
-
set(Capability.BROWSER_NAME, Browser.PHANTOM_JS);
|
|
302
|
+
get(key) {
|
|
303
|
+
return this.map_.get(key);
|
|
292
304
|
}
|
|
293
305
|
|
|
294
306
|
/**
|
|
295
|
-
* @
|
|
307
|
+
* @param {string} key the key to test.
|
|
308
|
+
* @return {boolean} whether this capability set has the specified key.
|
|
296
309
|
*/
|
|
297
|
-
|
|
298
|
-
return
|
|
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 {!
|
|
315
|
+
* @return {!Iterator<string>} an iterator of the keys set.
|
|
305
316
|
*/
|
|
306
|
-
|
|
307
|
-
return
|
|
308
|
-
set(Capability.BROWSER_NAME, Browser.HTMLUNIT);
|
|
317
|
+
keys() {
|
|
318
|
+
return this.map_.keys();
|
|
309
319
|
}
|
|
310
320
|
|
|
311
|
-
/**
|
|
312
|
-
|
|
313
|
-
|
|
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 (
|
|
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
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
-
*
|
|
391
|
-
*
|
|
392
|
-
* @return {!Capabilities} A self reference.
|
|
488
|
+
* @return {(proxy.Config|undefined)} the configured proxy settings, or
|
|
489
|
+
* undefined if not set.
|
|
393
490
|
*/
|
|
394
|
-
|
|
395
|
-
return this.
|
|
491
|
+
getProxy() {
|
|
492
|
+
return this.get(Capability.PROXY);
|
|
396
493
|
}
|
|
397
494
|
|
|
398
495
|
/**
|
|
399
|
-
* Sets
|
|
400
|
-
*
|
|
401
|
-
*
|
|
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
|
-
|
|
405
|
-
return this.set(Capability.
|
|
504
|
+
setAlertBehavior(behavior) {
|
|
505
|
+
return this.set(Capability.UNHANDLED_PROMPT_BEHAVIOR, behavior);
|
|
406
506
|
}
|
|
407
507
|
|
|
408
508
|
/**
|
|
409
|
-
*
|
|
410
|
-
*
|
|
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
|
-
|
|
416
|
-
return this.
|
|
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
|
|
447
|
-
Capabilities
|
|
448
|
-
Capability
|
|
449
|
-
|
|
543
|
+
Browser,
|
|
544
|
+
Capabilities,
|
|
545
|
+
Capability,
|
|
546
|
+
PageLoadStrategy,
|
|
547
|
+
Platform,
|
|
548
|
+
Timeouts,
|
|
549
|
+
UserPromptHandler,
|
|
450
550
|
};
|