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/phantomjs.js
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @fileoverview Defines a {@linkplain Driver WebDriver} client for the
|
|
20
|
-
* PhantomJS web browser. By default, it is expected that the PhantomJS
|
|
21
|
-
* executable can be located on your
|
|
22
|
-
* [PATH](https://en.wikipedia.org/wiki/PATH_(variable))
|
|
23
|
-
*
|
|
24
|
-
* __Using a Custom PhantomJS Binary__
|
|
25
|
-
*
|
|
26
|
-
* If you have PhantomJS.exe placed somewhere other than the root of your
|
|
27
|
-
* working directory, you can build a custom Capability and attach the
|
|
28
|
-
* executable's location to the Capability
|
|
29
|
-
*
|
|
30
|
-
* For example, if you're using the
|
|
31
|
-
* [phantomjs-prebuilt](https://www.npmjs.com/package/phantomjs-prebuilt) module
|
|
32
|
-
* from npm:
|
|
33
|
-
*
|
|
34
|
-
* //setup custom phantomJS capability
|
|
35
|
-
* var phantomjs_exe = require('phantomjs-prebuilt').path;
|
|
36
|
-
* var customPhantom = selenium.Capabilities.phantomjs();
|
|
37
|
-
* customPhantom.set("phantomjs.binary.path", phantomjs_exe);
|
|
38
|
-
* //build custom phantomJS driver
|
|
39
|
-
* var driver = new selenium.Builder().
|
|
40
|
-
* withCapabilities(customPhantom).
|
|
41
|
-
* build();
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
'use strict';
|
|
46
|
-
|
|
47
|
-
const fs = require('fs');
|
|
48
|
-
|
|
49
|
-
const http = require('./http'),
|
|
50
|
-
io = require('./io'),
|
|
51
|
-
capabilities = require('./lib/capabilities'),
|
|
52
|
-
command = require('./lib/command'),
|
|
53
|
-
logging = require('./lib/logging'),
|
|
54
|
-
promise = require('./lib/promise'),
|
|
55
|
-
webdriver = require('./lib/webdriver'),
|
|
56
|
-
portprober = require('./net/portprober'),
|
|
57
|
-
remote = require('./remote');
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Name of the PhantomJS executable.
|
|
62
|
-
* @type {string}
|
|
63
|
-
* @const
|
|
64
|
-
*/
|
|
65
|
-
const PHANTOMJS_EXE =
|
|
66
|
-
process.platform === 'win32' ? 'phantomjs.exe' : 'phantomjs';
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Capability that designates the location of the PhantomJS executable to use.
|
|
71
|
-
* @type {string}
|
|
72
|
-
* @const
|
|
73
|
-
*/
|
|
74
|
-
const BINARY_PATH_CAPABILITY = 'phantomjs.binary.path';
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Capability that designates the CLI arguments to pass to PhantomJS.
|
|
79
|
-
* @type {string}
|
|
80
|
-
* @const
|
|
81
|
-
*/
|
|
82
|
-
const CLI_ARGS_CAPABILITY = 'phantomjs.cli.args';
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Custom command names supported by PhantomJS.
|
|
87
|
-
* @enum {string}
|
|
88
|
-
*/
|
|
89
|
-
const Command = {
|
|
90
|
-
EXECUTE_PHANTOM_SCRIPT: 'executePhantomScript'
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Finds the PhantomJS executable.
|
|
96
|
-
* @param {string=} opt_exe Path to the executable to use.
|
|
97
|
-
* @return {string} The located executable.
|
|
98
|
-
* @throws {Error} If the executable cannot be found on the PATH, or if the
|
|
99
|
-
* provided executable path does not exist.
|
|
100
|
-
*/
|
|
101
|
-
function findExecutable(opt_exe) {
|
|
102
|
-
var exe = opt_exe || io.findInPath(PHANTOMJS_EXE, true);
|
|
103
|
-
if (!exe) {
|
|
104
|
-
throw Error(
|
|
105
|
-
'The PhantomJS executable could not be found on the current PATH. ' +
|
|
106
|
-
'Please download the latest version from ' +
|
|
107
|
-
'http://phantomjs.org/download.html and ensure it can be found on ' +
|
|
108
|
-
'your PATH. For more information, see ' +
|
|
109
|
-
'https://github.com/ariya/phantomjs/wiki');
|
|
110
|
-
}
|
|
111
|
-
if (!fs.existsSync(exe)) {
|
|
112
|
-
throw Error('File does not exist: ' + exe);
|
|
113
|
-
}
|
|
114
|
-
return exe;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Maps WebDriver logging level name to those recognised by PhantomJS.
|
|
120
|
-
* @const {!Map<string, string>}
|
|
121
|
-
*/
|
|
122
|
-
const WEBDRIVER_TO_PHANTOMJS_LEVEL = new Map([
|
|
123
|
-
[logging.Level.ALL.name, 'DEBUG'],
|
|
124
|
-
[logging.Level.DEBUG.name, 'DEBUG'],
|
|
125
|
-
[logging.Level.INFO.name, 'INFO'],
|
|
126
|
-
[logging.Level.WARNING.name, 'WARN'],
|
|
127
|
-
[logging.Level.SEVERE.name, 'ERROR']]);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Creates a command executor with support for PhantomJS' custom commands.
|
|
132
|
-
* @param {!Promise<string>} url The server's URL.
|
|
133
|
-
* @return {!command.Executor} The new command executor.
|
|
134
|
-
*/
|
|
135
|
-
function createExecutor(url) {
|
|
136
|
-
let client = url.then(url => new http.HttpClient(url));
|
|
137
|
-
let executor = new http.Executor(client);
|
|
138
|
-
|
|
139
|
-
executor.defineCommand(
|
|
140
|
-
Command.EXECUTE_PHANTOM_SCRIPT,
|
|
141
|
-
'POST', '/session/:sessionId/phantom/execute');
|
|
142
|
-
|
|
143
|
-
return executor;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Creates a new WebDriver client for PhantomJS.
|
|
148
|
-
*/
|
|
149
|
-
class Driver extends webdriver.WebDriver {
|
|
150
|
-
/**
|
|
151
|
-
* Creates a new PhantomJS session.
|
|
152
|
-
*
|
|
153
|
-
* @param {capabilities.Capabilities=} opt_capabilities The desired
|
|
154
|
-
* capabilities.
|
|
155
|
-
* @param {promise.ControlFlow=} opt_flow The control flow to use,
|
|
156
|
-
* or {@code null} to use the currently active flow.
|
|
157
|
-
* @param {string=} opt_logFile Path to the log file for the phantomjs
|
|
158
|
-
* executable's output. For convenience, this may be set at runtime with
|
|
159
|
-
* the `SELENIUM_PHANTOMJS_LOG` environment variable.
|
|
160
|
-
* @return {!Driver} A new driver reference.
|
|
161
|
-
*/
|
|
162
|
-
static createSession(opt_capabilities, opt_flow, opt_logFile) {
|
|
163
|
-
// TODO: add an Options class for consistency with the other driver types.
|
|
164
|
-
|
|
165
|
-
var caps = opt_capabilities || capabilities.Capabilities.phantomjs();
|
|
166
|
-
var exe = findExecutable(caps.get(BINARY_PATH_CAPABILITY));
|
|
167
|
-
var args = [];
|
|
168
|
-
|
|
169
|
-
var logPrefs = caps.get(capabilities.Capability.LOGGING_PREFS);
|
|
170
|
-
if (logPrefs instanceof logging.Preferences) {
|
|
171
|
-
logPrefs = logPrefs.toJSON();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (logPrefs && logPrefs[logging.Type.DRIVER]) {
|
|
175
|
-
let level = WEBDRIVER_TO_PHANTOMJS_LEVEL.get(
|
|
176
|
-
logPrefs[logging.Type.DRIVER]);
|
|
177
|
-
if (level) {
|
|
178
|
-
args.push('--webdriver-loglevel=' + level);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
opt_logFile = process.env['SELENIUM_PHANTOMJS_LOG'] || opt_logFile;
|
|
183
|
-
if (typeof opt_logFile === 'string') {
|
|
184
|
-
args.push('--webdriver-logfile=' + opt_logFile);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
var proxy = caps.get(capabilities.Capability.PROXY);
|
|
188
|
-
if (proxy) {
|
|
189
|
-
switch (proxy.proxyType) {
|
|
190
|
-
case 'manual':
|
|
191
|
-
if (proxy.httpProxy) {
|
|
192
|
-
args.push(
|
|
193
|
-
'--proxy-type=http',
|
|
194
|
-
'--proxy=' + proxy.httpProxy);
|
|
195
|
-
console.log(args);
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
case 'pac':
|
|
199
|
-
throw Error('PhantomJS does not support Proxy PAC files');
|
|
200
|
-
case 'system':
|
|
201
|
-
args.push('--proxy-type=system');
|
|
202
|
-
break;
|
|
203
|
-
case 'direct':
|
|
204
|
-
args.push('--proxy-type=none');
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
args = args.concat(caps.get(CLI_ARGS_CAPABILITY) || []);
|
|
209
|
-
|
|
210
|
-
var port = portprober.findFreePort();
|
|
211
|
-
var service = new remote.DriverService(exe, {
|
|
212
|
-
port: port,
|
|
213
|
-
args: Promise.resolve(port).then(function(port) {
|
|
214
|
-
args.push('--webdriver=' + port);
|
|
215
|
-
return args;
|
|
216
|
-
})
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
var executor = createExecutor(service.start());
|
|
220
|
-
return /** @type {!Driver} */(super.createSession(
|
|
221
|
-
executor, caps, opt_flow, () => service.kill()));
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* This function is a no-op as file detectors are not supported by this
|
|
226
|
-
* implementation.
|
|
227
|
-
* @override
|
|
228
|
-
*/
|
|
229
|
-
setFileDetector() {}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Executes a PhantomJS fragment. This method is similar to
|
|
233
|
-
* {@link #executeScript}, except it exposes the
|
|
234
|
-
* <a href="http://phantomjs.org/api/">PhantomJS API</a> to the injected
|
|
235
|
-
* script.
|
|
236
|
-
*
|
|
237
|
-
* <p>The injected script will execute in the context of PhantomJS's
|
|
238
|
-
* {@code page} variable. If a page has not been loaded before calling this
|
|
239
|
-
* method, one will be created.</p>
|
|
240
|
-
*
|
|
241
|
-
* <p>Be sure to wrap callback definitions in a try/catch block, as failures
|
|
242
|
-
* may cause future WebDriver calls to fail.</p>
|
|
243
|
-
*
|
|
244
|
-
* <p>Certain callbacks are used by GhostDriver (the PhantomJS WebDriver
|
|
245
|
-
* implementation) and overriding these may cause the script to fail. It is
|
|
246
|
-
* recommended that you check for existing callbacks before defining your own.
|
|
247
|
-
* </p>
|
|
248
|
-
*
|
|
249
|
-
* As with {@link #executeScript}, the injected script may be defined as
|
|
250
|
-
* a string for an anonymous function body (e.g. "return 123;"), or as a
|
|
251
|
-
* function. If a function is provided, it will be decompiled to its original
|
|
252
|
-
* source. Note that injecting functions is provided as a convenience to
|
|
253
|
-
* simplify defining complex scripts. Care must be taken that the function
|
|
254
|
-
* only references variables that will be defined in the page's scope and
|
|
255
|
-
* that the function does not override {@code Function.prototype.toString}
|
|
256
|
-
* (overriding toString() will interfere with how the function is
|
|
257
|
-
* decompiled.
|
|
258
|
-
*
|
|
259
|
-
* @param {(string|!Function)} script The script to execute.
|
|
260
|
-
* @param {...*} var_args The arguments to pass to the script.
|
|
261
|
-
* @return {!promise.Thenable<T>} A promise that resolve to the
|
|
262
|
-
* script's return value.
|
|
263
|
-
* @template T
|
|
264
|
-
*/
|
|
265
|
-
executePhantomJS(script, var_args) {
|
|
266
|
-
if (typeof script === 'function') {
|
|
267
|
-
script = 'return (' + script + ').apply(this, arguments);';
|
|
268
|
-
}
|
|
269
|
-
var args = arguments.length > 1
|
|
270
|
-
? Array.prototype.slice.call(arguments, 1) : [];
|
|
271
|
-
return this.schedule(
|
|
272
|
-
new command.Command(Command.EXECUTE_PHANTOM_SCRIPT)
|
|
273
|
-
.setParameter('script', script)
|
|
274
|
-
.setParameter('args', args),
|
|
275
|
-
'Driver.executePhantomJS()');
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
// PUBLIC API
|
|
281
|
-
|
|
282
|
-
exports.Driver = Driver;
|
package/test/actions_test.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var Browser = require('..').Browser,
|
|
21
|
-
By = require('..').By,
|
|
22
|
-
until = require('..').until,
|
|
23
|
-
test = require('../lib/test'),
|
|
24
|
-
fileServer = require('../lib/test/fileserver');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
test.suite(function(env) {
|
|
28
|
-
var driver;
|
|
29
|
-
test.beforeEach(function*() { driver = yield env.builder().build(); });
|
|
30
|
-
test.afterEach(function() { return driver.quit(); });
|
|
31
|
-
|
|
32
|
-
test.ignore(
|
|
33
|
-
env.browsers(Browser.FIREFOX, Browser.PHANTOM_JS, Browser.SAFARI)).
|
|
34
|
-
describe('WebDriver.actions()', function() {
|
|
35
|
-
|
|
36
|
-
test.it('can move to and click element in an iframe', function*() {
|
|
37
|
-
yield driver.get(fileServer.whereIs('click_tests/click_in_iframe.html'));
|
|
38
|
-
|
|
39
|
-
yield driver.wait(until.elementLocated(By.id('ifr')), 5000)
|
|
40
|
-
.then(frame => driver.switchTo().frame(frame));
|
|
41
|
-
|
|
42
|
-
let link = yield driver.findElement(By.id('link'));
|
|
43
|
-
yield driver.actions()
|
|
44
|
-
.mouseMove(link)
|
|
45
|
-
.click()
|
|
46
|
-
.perform();
|
|
47
|
-
|
|
48
|
-
return driver.wait(until.titleIs('Submitted Successfully!'), 5000);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var fs = require('fs');
|
|
21
|
-
|
|
22
|
-
var webdriver = require('../..'),
|
|
23
|
-
chrome = require('../../chrome'),
|
|
24
|
-
symbols = require('../../lib/symbols'),
|
|
25
|
-
proxy = require('../../proxy'),
|
|
26
|
-
assert = require('../../testing/assert');
|
|
27
|
-
|
|
28
|
-
var test = require('../../lib/test');
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
describe('chrome.Options', function() {
|
|
32
|
-
describe('fromCapabilities', function() {
|
|
33
|
-
|
|
34
|
-
it('should return a new Options instance if none were defined',
|
|
35
|
-
function() {
|
|
36
|
-
var options = chrome.Options.fromCapabilities(
|
|
37
|
-
new webdriver.Capabilities());
|
|
38
|
-
assert(options).instanceOf(chrome.Options);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should return options instance if present', function() {
|
|
42
|
-
var options = new chrome.Options();
|
|
43
|
-
var caps = options.toCapabilities();
|
|
44
|
-
assert(caps).instanceOf(webdriver.Capabilities);
|
|
45
|
-
assert(chrome.Options.fromCapabilities(caps)).equalTo(options);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should rebuild options from wire representation', function() {
|
|
49
|
-
var expectedExtension = fs.readFileSync(__filename, 'base64');
|
|
50
|
-
var caps = webdriver.Capabilities.chrome().set('chromeOptions', {
|
|
51
|
-
args: ['a', 'b'],
|
|
52
|
-
extensions: [__filename],
|
|
53
|
-
binary: 'binaryPath',
|
|
54
|
-
logPath: 'logFilePath',
|
|
55
|
-
detach: true,
|
|
56
|
-
localState: 'localStateValue',
|
|
57
|
-
prefs: 'prefsValue'
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
var options = chrome.Options.fromCapabilities(caps);
|
|
61
|
-
var json = options[symbols.serialize]();
|
|
62
|
-
|
|
63
|
-
assert(json.args.length).equalTo(2);
|
|
64
|
-
assert(json.args[0]).equalTo('a');
|
|
65
|
-
assert(json.args[1]).equalTo('b');
|
|
66
|
-
assert(json.extensions.length).equalTo(1);
|
|
67
|
-
assert(json.extensions[0]).equalTo(expectedExtension);
|
|
68
|
-
assert(json.binary).equalTo('binaryPath');
|
|
69
|
-
assert(json.logPath).equalTo('logFilePath');
|
|
70
|
-
assert(json.detach).equalTo(true);
|
|
71
|
-
assert(json.localState).equalTo('localStateValue');
|
|
72
|
-
assert(json.prefs).equalTo('prefsValue');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should rebuild options from incomplete wire representation',
|
|
76
|
-
function() {
|
|
77
|
-
var caps = webdriver.Capabilities.chrome().set('chromeOptions', {
|
|
78
|
-
logPath: 'logFilePath'
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
var options = chrome.Options.fromCapabilities(caps);
|
|
82
|
-
var json = options[symbols.serialize]();
|
|
83
|
-
assert(json.args).isUndefined();
|
|
84
|
-
assert(json.binary).isUndefined();
|
|
85
|
-
assert(json.detach).isUndefined();
|
|
86
|
-
assert(json.excludeSwitches).isUndefined();
|
|
87
|
-
assert(json.extensions).isUndefined();
|
|
88
|
-
assert(json.localState).isUndefined();
|
|
89
|
-
assert(json.logPath).equalTo('logFilePath');
|
|
90
|
-
assert(json.prefs).isUndefined();
|
|
91
|
-
assert(json.minidumpPath).isUndefined();
|
|
92
|
-
assert(json.mobileEmulation).isUndefined();
|
|
93
|
-
assert(json.perfLoggingPrefs).isUndefined();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('should extract supported WebDriver capabilities', function() {
|
|
97
|
-
var proxyPrefs = proxy.direct();
|
|
98
|
-
var logPrefs = {};
|
|
99
|
-
var caps = webdriver.Capabilities.chrome().
|
|
100
|
-
set(webdriver.Capability.PROXY, proxyPrefs).
|
|
101
|
-
set(webdriver.Capability.LOGGING_PREFS, logPrefs);
|
|
102
|
-
|
|
103
|
-
var options = chrome.Options.fromCapabilities(caps);
|
|
104
|
-
assert(options.proxy_).equalTo(proxyPrefs);
|
|
105
|
-
assert(options.logPrefs_).equalTo(logPrefs);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
describe('addArguments', function() {
|
|
110
|
-
it('takes var_args', function() {
|
|
111
|
-
var options = new chrome.Options();
|
|
112
|
-
assert(options[symbols.serialize]().args).isUndefined();
|
|
113
|
-
|
|
114
|
-
options.addArguments('a', 'b');
|
|
115
|
-
var json = options[symbols.serialize]();
|
|
116
|
-
assert(json.args.length).equalTo(2);
|
|
117
|
-
assert(json.args[0]).equalTo('a');
|
|
118
|
-
assert(json.args[1]).equalTo('b');
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('flattens input arrays', function() {
|
|
122
|
-
var options = new chrome.Options();
|
|
123
|
-
assert(options[symbols.serialize]().args).isUndefined();
|
|
124
|
-
|
|
125
|
-
options.addArguments(['a', 'b'], 'c', [1, 2], 3);
|
|
126
|
-
var json = options[symbols.serialize]();
|
|
127
|
-
assert(json.args.length).equalTo(6);
|
|
128
|
-
assert(json.args[0]).equalTo('a');
|
|
129
|
-
assert(json.args[1]).equalTo('b');
|
|
130
|
-
assert(json.args[2]).equalTo('c');
|
|
131
|
-
assert(json.args[3]).equalTo(1);
|
|
132
|
-
assert(json.args[4]).equalTo(2);
|
|
133
|
-
assert(json.args[5]).equalTo(3);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
describe('addExtensions', function() {
|
|
138
|
-
it('takes var_args', function() {
|
|
139
|
-
var options = new chrome.Options();
|
|
140
|
-
assert(options.extensions_.length).equalTo(0);
|
|
141
|
-
|
|
142
|
-
options.addExtensions('a', 'b');
|
|
143
|
-
assert(options.extensions_.length).equalTo(2);
|
|
144
|
-
assert(options.extensions_[0]).equalTo('a');
|
|
145
|
-
assert(options.extensions_[1]).equalTo('b');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('flattens input arrays', function() {
|
|
149
|
-
var options = new chrome.Options();
|
|
150
|
-
assert(options.extensions_.length).equalTo(0);
|
|
151
|
-
|
|
152
|
-
options.addExtensions(['a', 'b'], 'c', [1, 2], 3);
|
|
153
|
-
assert(options.extensions_.length).equalTo(6);
|
|
154
|
-
assert(options.extensions_[0]).equalTo('a');
|
|
155
|
-
assert(options.extensions_[1]).equalTo('b');
|
|
156
|
-
assert(options.extensions_[2]).equalTo('c');
|
|
157
|
-
assert(options.extensions_[3]).equalTo(1);
|
|
158
|
-
assert(options.extensions_[4]).equalTo(2);
|
|
159
|
-
assert(options.extensions_[5]).equalTo(3);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe('serialize', function() {
|
|
164
|
-
it('base64 encodes extensions', function() {
|
|
165
|
-
var expected = fs.readFileSync(__filename, 'base64');
|
|
166
|
-
var wire = new chrome.Options()
|
|
167
|
-
.addExtensions(__filename)
|
|
168
|
-
[symbols.serialize]();
|
|
169
|
-
assert(wire.extensions.length).equalTo(1);
|
|
170
|
-
assert(wire.extensions[0]).equalTo(expected);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
describe('toCapabilities', function() {
|
|
175
|
-
it('returns a new capabilities object if one is not provided', function() {
|
|
176
|
-
var options = new chrome.Options();
|
|
177
|
-
var caps = options.toCapabilities();
|
|
178
|
-
assert(caps.get('browserName')).equalTo('chrome');
|
|
179
|
-
assert(caps.get('chromeOptions')).equalTo(options);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('adds to input capabilities object', function() {
|
|
183
|
-
var caps = webdriver.Capabilities.firefox();
|
|
184
|
-
var options = new chrome.Options();
|
|
185
|
-
assert(options.toCapabilities(caps)).equalTo(caps);
|
|
186
|
-
assert(caps.get('browserName')).equalTo('firefox');
|
|
187
|
-
assert(caps.get('chromeOptions')).equalTo(options);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('sets generic driver capabilities', function() {
|
|
191
|
-
var proxyPrefs = {};
|
|
192
|
-
var loggingPrefs = {};
|
|
193
|
-
var options = new chrome.Options().
|
|
194
|
-
setLoggingPrefs(loggingPrefs).
|
|
195
|
-
setProxy(proxyPrefs);
|
|
196
|
-
|
|
197
|
-
var caps = options.toCapabilities();
|
|
198
|
-
assert(caps.get('proxy')).equalTo(proxyPrefs);
|
|
199
|
-
assert(caps.get('loggingPrefs')).equalTo(loggingPrefs);
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test.suite(function(env) {
|
|
205
|
-
var driver;
|
|
206
|
-
|
|
207
|
-
test.afterEach(function() {
|
|
208
|
-
return driver.quit();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe('Chrome options', function() {
|
|
212
|
-
test.it('can start Chrome with custom args', function*() {
|
|
213
|
-
var options = new chrome.Options().
|
|
214
|
-
addArguments('user-agent=foo;bar');
|
|
215
|
-
|
|
216
|
-
driver = yield env.builder()
|
|
217
|
-
.setChromeOptions(options)
|
|
218
|
-
.build();
|
|
219
|
-
|
|
220
|
-
yield driver.get(test.Pages.ajaxyPage);
|
|
221
|
-
|
|
222
|
-
var userAgent =
|
|
223
|
-
yield driver.executeScript('return window.navigator.userAgent');
|
|
224
|
-
assert(userAgent).equalTo('foo;bar');
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
}, {browsers: ['chrome']});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var webdriver = require('../..'),
|
|
21
|
-
chrome = require('../../chrome'),
|
|
22
|
-
assert = require('../../testing/assert');
|
|
23
|
-
|
|
24
|
-
var test = require('../../lib/test');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
test.suite(function(env) {
|
|
28
|
-
describe('chromedriver', function() {
|
|
29
|
-
var service;
|
|
30
|
-
test.afterEach(function() {
|
|
31
|
-
if (service) {
|
|
32
|
-
return service.kill();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test.it('can be started on a custom path', function() {
|
|
37
|
-
service = new chrome.ServiceBuilder()
|
|
38
|
-
.setPath('/foo/bar/baz')
|
|
39
|
-
.build();
|
|
40
|
-
return service.start().then(function(url) {
|
|
41
|
-
assert(url).endsWith('/foo/bar/baz');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}, {browsers: ['chrome']});
|