selenium-webdriver 2.53.3 → 3.142.7

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 (162) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +665 -8
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -1
  5. data/README.md +2 -3
  6. data/lib/selenium/server.rb +76 -73
  7. data/lib/selenium/webdriver/atoms/getAttribute.js +7 -0
  8. data/lib/selenium/webdriver/atoms/isDisplayed.js +102 -0
  9. data/lib/selenium/webdriver/{phantomjs.rb → atoms.rb} +10 -14
  10. data/lib/selenium/webdriver/chrome/bridge.rb +30 -101
  11. data/lib/selenium/webdriver/chrome/driver.rb +127 -0
  12. data/lib/selenium/webdriver/chrome/options.rb +190 -0
  13. data/lib/selenium/webdriver/chrome/profile.rb +21 -20
  14. data/lib/selenium/webdriver/chrome/service.rb +26 -93
  15. data/lib/selenium/webdriver/chrome.rb +15 -6
  16. data/lib/selenium/webdriver/common/action_builder.rb +52 -58
  17. data/lib/selenium/webdriver/common/alert.rb +7 -15
  18. data/lib/selenium/webdriver/common/bridge_helper.rb +18 -22
  19. data/lib/selenium/webdriver/common/driver.rb +72 -72
  20. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
  21. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
  22. data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +11 -27
  23. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +6 -10
  24. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
  25. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +7 -8
  26. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -4
  28. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -4
  29. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +3 -5
  30. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -5
  31. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +6 -9
  32. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -7
  33. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -8
  34. data/lib/selenium/webdriver/common/element.rb +59 -39
  35. data/lib/selenium/webdriver/common/error.rb +259 -104
  36. data/lib/selenium/webdriver/common/file_reaper.rb +6 -14
  37. data/lib/selenium/webdriver/common/html5/local_storage.rb +8 -10
  38. data/lib/selenium/webdriver/common/html5/session_storage.rb +8 -10
  39. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +8 -16
  40. data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
  41. data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
  42. data/lib/selenium/webdriver/{safari/browser.rb → common/interactions/interactions.rb} +17 -14
  43. data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
  44. data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
  45. data/lib/selenium/webdriver/{android.rb → common/interactions/none_input.rb} +14 -6
  46. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
  47. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
  48. data/lib/selenium/webdriver/common/keyboard.rb +10 -14
  49. data/lib/selenium/webdriver/common/keys.rb +102 -82
  50. data/lib/selenium/webdriver/common/log_entry.rb +7 -8
  51. data/lib/selenium/webdriver/common/logger.rb +115 -0
  52. data/lib/selenium/webdriver/common/logs.rb +4 -6
  53. data/lib/selenium/webdriver/common/manager.rb +177 -0
  54. data/lib/selenium/webdriver/common/mouse.rb +12 -14
  55. data/lib/selenium/webdriver/common/navigation.rb +4 -6
  56. data/lib/selenium/webdriver/common/options.rb +26 -127
  57. data/lib/selenium/webdriver/common/platform.rb +75 -101
  58. data/lib/selenium/webdriver/common/port_prober.rb +7 -19
  59. data/lib/selenium/webdriver/common/profile_helper.rb +8 -11
  60. data/lib/selenium/webdriver/common/proxy.rb +68 -74
  61. data/lib/selenium/webdriver/common/search_context.rb +28 -37
  62. data/lib/selenium/webdriver/common/service.rb +219 -0
  63. data/lib/selenium/webdriver/common/socket_lock.rb +15 -16
  64. data/lib/selenium/webdriver/common/socket_poller.rb +30 -28
  65. data/lib/selenium/webdriver/common/target_locator.rb +16 -18
  66. data/lib/selenium/webdriver/common/timeouts.rb +6 -8
  67. data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -10
  68. data/lib/selenium/webdriver/common/touch_screen.rb +22 -23
  69. data/lib/selenium/webdriver/common/w3c_action_builder.rb +212 -0
  70. data/lib/selenium/webdriver/common/w3c_manager.rb +45 -0
  71. data/lib/selenium/webdriver/common/wait.rb +17 -16
  72. data/lib/selenium/webdriver/common/window.rb +50 -17
  73. data/lib/selenium/webdriver/common/zipper.rb +9 -13
  74. data/lib/selenium/webdriver/common.rb +21 -7
  75. data/lib/selenium/webdriver/edge/bridge.rb +34 -63
  76. data/lib/selenium/webdriver/edge/driver.rb +66 -0
  77. data/lib/selenium/webdriver/edge/options.rb +80 -0
  78. data/lib/selenium/webdriver/edge/service.rb +23 -95
  79. data/lib/selenium/webdriver/edge.rb +13 -13
  80. data/lib/selenium/webdriver/firefox/binary.rb +45 -60
  81. data/lib/selenium/webdriver/firefox/driver.rb +50 -0
  82. data/lib/selenium/webdriver/firefox/extension/prefs.json +3 -12
  83. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  84. data/lib/selenium/webdriver/firefox/extension.rb +20 -10
  85. data/lib/selenium/webdriver/firefox/launcher.rb +16 -22
  86. data/lib/selenium/webdriver/firefox/legacy/driver.rb +83 -0
  87. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +49 -0
  88. data/lib/selenium/webdriver/firefox/marionette/driver.rb +90 -0
  89. data/lib/selenium/webdriver/firefox/options.rb +162 -0
  90. data/lib/selenium/webdriver/firefox/profile.rb +47 -48
  91. data/lib/selenium/webdriver/firefox/profiles_ini.rb +11 -18
  92. data/lib/selenium/webdriver/firefox/service.rb +24 -95
  93. data/lib/selenium/webdriver/firefox/util.rb +2 -4
  94. data/lib/selenium/webdriver/firefox.rb +27 -12
  95. data/lib/selenium/webdriver/ie/driver.rb +85 -0
  96. data/lib/selenium/webdriver/ie/options.rb +138 -0
  97. data/lib/selenium/webdriver/ie/service.rb +54 -0
  98. data/lib/selenium/webdriver/ie.rb +12 -10
  99. data/lib/selenium/webdriver/remote/bridge.rb +100 -564
  100. data/lib/selenium/webdriver/remote/capabilities.rb +98 -100
  101. data/lib/selenium/webdriver/remote/driver.rb +51 -0
  102. data/lib/selenium/webdriver/remote/http/common.rb +34 -22
  103. data/lib/selenium/webdriver/remote/http/curb.rb +13 -14
  104. data/lib/selenium/webdriver/remote/http/default.rb +62 -43
  105. data/lib/selenium/webdriver/remote/http/persistent.rb +12 -9
  106. data/lib/selenium/webdriver/remote/oss/bridge.rb +594 -0
  107. data/lib/selenium/webdriver/remote/oss/commands.rb +223 -0
  108. data/lib/selenium/webdriver/remote/response.rb +48 -28
  109. data/lib/selenium/webdriver/remote/server_error.rb +3 -5
  110. data/lib/selenium/webdriver/remote/w3c/bridge.rb +605 -0
  111. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +310 -0
  112. data/lib/selenium/webdriver/remote/w3c/commands.rb +157 -0
  113. data/lib/selenium/webdriver/remote.rb +10 -16
  114. data/lib/selenium/webdriver/safari/bridge.rb +17 -101
  115. data/lib/selenium/webdriver/{firefox/w3c_bridge.rb → safari/driver.rb} +27 -25
  116. data/lib/selenium/webdriver/safari/options.rb +29 -31
  117. data/lib/selenium/webdriver/safari/service.rb +38 -0
  118. data/lib/selenium/webdriver/safari.rb +27 -27
  119. data/lib/selenium/webdriver/support/abstract_event_listener.rb +19 -4
  120. data/lib/selenium/webdriver/support/block_event_listener.rb +3 -5
  121. data/lib/selenium/webdriver/support/color.rb +60 -43
  122. data/lib/selenium/webdriver/support/escaper.rb +43 -0
  123. data/lib/selenium/webdriver/support/event_firing_bridge.rb +39 -41
  124. data/lib/selenium/webdriver/support/select.rb +45 -97
  125. data/lib/selenium/webdriver/support.rb +3 -2
  126. data/lib/selenium/webdriver/{iphone.rb → version.rb} +3 -7
  127. data/lib/selenium/webdriver.rb +36 -23
  128. data/lib/selenium-webdriver.rb +2 -2
  129. data/selenium-webdriver.gemspec +42 -29
  130. metadata +331 -262
  131. data/lib/selenium/client/base.rb +0 -151
  132. data/lib/selenium/client/driver.rb +0 -29
  133. data/lib/selenium/client/errors.rb +0 -28
  134. data/lib/selenium/client/extensions.rb +0 -132
  135. data/lib/selenium/client/idiomatic.rb +0 -507
  136. data/lib/selenium/client/javascript_expression_builder.rb +0 -135
  137. data/lib/selenium/client/javascript_frameworks/jquery.rb +0 -32
  138. data/lib/selenium/client/javascript_frameworks/prototype.rb +0 -32
  139. data/lib/selenium/client/legacy_driver.rb +0 -1722
  140. data/lib/selenium/client/protocol.rb +0 -123
  141. data/lib/selenium/client/selenium_helper.rb +0 -49
  142. data/lib/selenium/client.rb +0 -57
  143. data/lib/selenium/rake/server_task.rb +0 -176
  144. data/lib/selenium/webdriver/android/bridge.rb +0 -68
  145. data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
  146. data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
  147. data/lib/selenium/webdriver/common/html5/location.rb +0 -19
  148. data/lib/selenium/webdriver/common/w3c_error.rb +0 -194
  149. data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
  150. data/lib/selenium/webdriver/firefox/bridge.rb +0 -89
  151. data/lib/selenium/webdriver/ie/bridge.rb +0 -88
  152. data/lib/selenium/webdriver/ie/server.rb +0 -133
  153. data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
  154. data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -78
  155. data/lib/selenium/webdriver/phantomjs/service.rb +0 -130
  156. data/lib/selenium/webdriver/remote/commands.rb +0 -211
  157. data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -668
  158. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -236
  159. data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -132
  160. data/lib/selenium/webdriver/safari/resources/client.js +0 -7255
  161. data/lib/selenium/webdriver/safari/server.rb +0 -187
  162. data/lib/selenium-client.rb +0 -21
@@ -1,194 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Error
23
-
24
- class WebDriverError < StandardError; end
25
-
26
- #
27
- # An attempt was made to select an element that cannot be selected.
28
- #
29
-
30
- class ElementNotSelectableError < WebDriverError; end
31
-
32
- #
33
- # An element command could not be completed because the element is
34
- # not visible on the page.
35
- #
36
-
37
- class ElementNotVisibleError < WebDriverError; end
38
-
39
- #
40
- # The arguments passed to a command are either invalid or malformed.
41
- #
42
-
43
- class InvalidArgumentError < WebDriverError; end
44
-
45
- #
46
- # An illegal attempt was made to set a cookie under a different
47
- # domain than the current page.
48
- #
49
-
50
- class InvalidCookieDomainError < WebDriverError; end
51
-
52
- #
53
- # The coordinates provided to an interactions operation are invalid.
54
- #
55
-
56
- class InvalidElementCoordinatesError < WebDriverError; end
57
-
58
- #
59
- # An element command could not be completed because the element is
60
- # in an invalid state, e.g. attempting to click an element that is no
61
- # longer attached to the document.
62
- #
63
-
64
- class InvalidElementStateError < WebDriverError; end
65
-
66
- #
67
- # Argument was an invalid selector.
68
- #
69
-
70
- class InvalidSelectorError < WebDriverError; end
71
-
72
- #
73
- # Occurs if the given session id is not in the list of active sessions,
74
- # meaning the session either does not exist or that it’s not active.
75
- #
76
-
77
- class InvalidSessionIdError < WebDriverError; end
78
-
79
- #
80
- # An error occurred while executing JavaScript supplied by the user.
81
- #
82
-
83
- class JavascriptError < WebDriverError; end
84
-
85
- #
86
- # The target for mouse interaction is not in the browser’s viewport and
87
- # cannot be brought into that viewport.
88
- #
89
-
90
- class MoveTargetOutOfBoundsError < WebDriverError; end
91
-
92
- #
93
- # An attempt was made to operate on a modal dialog when one was not open.
94
- #
95
-
96
- class NoSuchAlertError < WebDriverError; end
97
-
98
- #
99
- # An element could not be located on the page using the given
100
- # search parameters.
101
- #
102
-
103
- class NoSuchElementError < WebDriverError; end
104
-
105
- #
106
- # A request to switch to a frame could not be satisfied because the
107
- # frame could not be found.
108
- #
109
-
110
- class NoSuchFrameError < WebDriverError; end
111
-
112
- #
113
- # A request to switch to a window could not be satisfied because the
114
- # window could not be found.
115
- #
116
-
117
- class NoSuchWindowError < WebDriverError; end
118
-
119
- #
120
- # A script did not complete before its timeout expired.
121
- #
122
-
123
- class ScriptTimeoutError < WebDriverError; end
124
-
125
- #
126
- # A new session could not be created.
127
- #
128
-
129
- class SessionNotCreatedError < WebDriverError; end
130
-
131
- #
132
- # An element command failed because the referenced element is no longer
133
- # attached to the DOM.
134
- #
135
-
136
- class StaleElementReferenceError < WebDriverError; end
137
-
138
- #
139
- # An operation did not complete before its timeout expired.
140
- #
141
-
142
- class TimeoutError < WebDriverError; end
143
-
144
- #
145
- # A request to set a cookie’s value could not be satisfied.
146
- #
147
-
148
- class UnableToSetCookieError < WebDriverError; end
149
-
150
- #
151
- # A screen capture was made impossible.
152
- #
153
-
154
- class UnableToCaptureScreenError < WebDriverError; end
155
-
156
- #
157
- # A modal dialog was open, blocking this operation.
158
- #
159
-
160
- class UnexpectedAlertOpenError < WebDriverError; end
161
-
162
- #
163
- # An unknown error occurred in the remote end while processing
164
- # the command.
165
- #
166
-
167
- class UnknownError < WebDriverError; end
168
-
169
- #
170
- # The requested command matched a known URL but did not match a
171
- # method for that URL.
172
- #
173
-
174
- class UnknownMethodError < WebDriverError; end
175
-
176
- #
177
- # Indicates that a command that should have executed properly cannot be supported for some reason.
178
- #
179
-
180
- class UnsupportedOperationError < WebDriverError; end
181
-
182
- # aliased for backwards compatibility
183
- NoAlertPresentError = NoSuchAlertError
184
- ScriptTimeOutError = ScriptTimeoutError
185
- ObsoleteElementError = StaleElementReferenceError
186
- UnhandledError = UnknownError
187
- UnexpectedJavascriptError = JavascriptError
188
- NoAlertOpenError = NoAlertPresentError
189
- ElementNotDisplayedError = ElementNotVisibleError
190
-
191
-
192
- end # Error
193
- end # WebDriver
194
- end # Selenium
@@ -1,117 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Edge
23
-
24
- module LegacySupport
25
-
26
- # These are commands Edge is still using from JSON Wire Protocol
27
- [:executeScript, :executeAsyncScript, :submitElement, :doubleClick, :mouseDown, :mouseUp, :mouseMoveTo, :click,
28
- :sendKeysToActiveElement, :getWindowHandles, :getCurrentWindowHandle, :getWindowSize, :setWindowSize, :getWindowPosition,
29
- :setWindowPosition, :maximizeWindow, :getAlertText, :acceptAlert, :dismissAlert].each do |cmd|
30
- jwp = Remote::Bridge::COMMANDS[cmd]
31
- Remote::W3CBridge.command(cmd, jwp.first, jwp.last)
32
- end
33
-
34
- def executeScript(script, *args)
35
- result = execute :executeScript, {}, :script => script, :args => args
36
- unwrap_script_result result
37
- end
38
-
39
- def executeAsyncScript(script, *args)
40
- result = execute :executeAsyncScript, {}, :script => script, :args => args
41
- unwrap_script_result result
42
- end
43
-
44
- def submitElement(element)
45
- execute :submitElement, :id => element
46
- end
47
-
48
- def doubleClick
49
- execute :doubleClick
50
- end
51
-
52
- def click
53
- execute :click, {}, :button => 0
54
- end
55
-
56
- def contextClick
57
- execute :click, {}, :button => 2
58
- end
59
-
60
- def mouseDown
61
- execute :mouseDown
62
- end
63
-
64
- def mouseUp
65
- execute :mouseUp
66
- end
67
-
68
- def mouseMoveTo(element, x = nil, y = nil)
69
- params = { :element => element }
70
-
71
- if x && y
72
- params.merge! :xoffset => x, :yoffset => y
73
- end
74
-
75
- execute :mouseMoveTo, {}, params
76
- end
77
-
78
- def sendKeysToActiveElement(key)
79
- execute :sendKeysToActiveElement, {}, :value => key
80
- end
81
-
82
- def getCurrentWindowHandle
83
- execute :getCurrentWindowHandle
84
- end
85
-
86
- def getWindowSize(handle = :current)
87
- data = execute :getWindowSize, :window_handle => handle
88
-
89
- Dimension.new data['width'], data['height']
90
- end
91
-
92
- def setWindowSize(width, height, handle = :current)
93
- execute :setWindowSize, {:window_handle => handle},
94
- :width => width,
95
- :height => height
96
- end
97
-
98
- def getWindowPosition(handle = :current)
99
- data = execute :getWindowPosition, :window_handle => handle
100
-
101
- Point.new data['x'], data['y']
102
- end
103
-
104
- def setWindowPosition(x, y, handle = :current)
105
- execute :setWindowPosition, {:window_handle => handle},
106
- :x => x, :y => y
107
- end
108
-
109
- def maximizeWindow(handle = :current)
110
- execute :maximizeWindow, :window_handle => handle
111
- end
112
-
113
-
114
- end # LegacySupport
115
- end # Edge
116
- end # WebDriver
117
- end # Selenium
@@ -1,89 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Firefox
23
-
24
- # @api private
25
- class Bridge < Remote::Bridge
26
-
27
- def initialize(opts = {})
28
- port = opts.delete(:port) || DEFAULT_PORT
29
- profile = opts.delete(:profile)
30
- http_client = opts.delete(:http_client)
31
- proxy = opts.delete(:proxy)
32
-
33
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
34
-
35
- Binary.path = caps[:firefox_binary] if caps[:firefox_binary]
36
-
37
- @launcher = create_launcher(port, profile)
38
-
39
- unless opts.empty?
40
- raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
41
- end
42
-
43
- @launcher.launch
44
-
45
- caps.proxy = proxy if proxy
46
-
47
- remote_opts = {
48
- :url => @launcher.url,
49
- :desired_capabilities => caps
50
- }
51
-
52
- remote_opts.merge!(:http_client => http_client) if http_client
53
-
54
- begin
55
- super(remote_opts)
56
- rescue
57
- @launcher.quit
58
- raise
59
- end
60
- end
61
-
62
- def browser
63
- :firefox
64
- end
65
-
66
- def driver_extensions
67
- [
68
- DriverExtensions::TakesScreenshot,
69
- DriverExtensions::HasInputDevices
70
- ]
71
- end
72
-
73
- def quit
74
- super
75
- nil
76
- ensure
77
- @launcher.quit
78
- end
79
-
80
- private
81
-
82
- def create_launcher(port, profile)
83
- Launcher.new Binary.new, port, profile
84
- end
85
-
86
- end # Bridge
87
- end # Firefox
88
- end # WebDriver
89
- end # Selenium
@@ -1,88 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module IE
23
-
24
- #
25
- # @api private
26
- #
27
-
28
- class Bridge < Remote::Bridge
29
-
30
- HOST = Platform.localhost
31
- DEFAULT_PORT = 5555
32
- DEFAULT_TIMEOUT = 30
33
-
34
- def initialize(opts = {})
35
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
36
- timeout = opts.delete(:timeout) { DEFAULT_TIMEOUT }
37
- port = opts.delete(:port) { DEFAULT_PORT }
38
- http_client = opts.delete(:http_client)
39
- ignore_mode = opts.delete(:introduce_flakiness_by_ignoring_security_domains)
40
- native_events = opts.delete(:native_events) != false
41
- implementation = opts.delete(:implementation)
42
-
43
- @server = Server.get(:implementation => implementation)
44
-
45
- @server.log_level = opts.delete(:log_level) if opts[:log_level]
46
- @server.log_file = opts.delete(:log_file) if opts[:log_file]
47
-
48
- unless opts.empty?
49
- raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
50
- end
51
-
52
- @port = @server.start Integer(port), timeout
53
-
54
- if ignore_mode
55
- caps['ignoreProtectedModeSettings'] = true
56
- end
57
-
58
- caps['nativeEvents'] = native_events
59
-
60
- remote_opts = {
61
- :url => @server.uri,
62
- :desired_capabilities => caps
63
- }
64
-
65
- remote_opts[:http_client] = http_client if http_client
66
-
67
- super(remote_opts)
68
- end
69
-
70
- def browser
71
- :internet_explorer
72
- end
73
-
74
- def driver_extensions
75
- [DriverExtensions::TakesScreenshot, DriverExtensions::HasInputDevices]
76
- end
77
-
78
- def quit
79
- super
80
- nil
81
- ensure
82
- @server.stop
83
- end
84
-
85
- end # Bridge
86
- end # IE
87
- end # WebDriver
88
- end # Selenium
@@ -1,133 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module IE
23
-
24
- #
25
- # @api private
26
- #
27
-
28
- class Server
29
-
30
- STOP_TIMEOUT = 5
31
- SOCKET_LOCK_TIMEOUT = 45
32
- MISSING_TEXT = "Unable to find standalone executable. Please download the IEDriverServer from http://selenium-release.storage.googleapis.com/index.html and place the executable on your PATH."
33
-
34
- def self.get(opts = {})
35
- binary = IE.driver_path || Platform.find_binary("IEDriverServer")
36
-
37
- if binary
38
- new binary, opts
39
- else
40
- raise Error::WebDriverError, MISSING_TEXT
41
- end
42
- end
43
-
44
- attr_accessor :log_level, :log_file
45
-
46
- def initialize(binary_path, opts = {})
47
- Platform.assert_executable binary_path
48
-
49
- @binary_path = binary_path
50
- @process = nil
51
-
52
- opts = opts.dup
53
-
54
- @log_level = opts.delete(:log_level)
55
- @log_file = opts.delete(:log_file)
56
- @implementation = opts.delete(:implementation)
57
-
58
- unless opts.empty?
59
- raise ArgumentError, "invalid option#{'s' if opts.size != 1}: #{opts.inspect}"
60
- end
61
- end
62
-
63
- def start(port, timeout)
64
- return @port if running?
65
-
66
- @port = port
67
- socket_lock.locked do
68
- find_free_port
69
- start_process
70
- connect_until_stable(timeout)
71
- end
72
-
73
- Platform.exit_hook { stop } # make sure we don't leave the server running
74
-
75
- @port
76
- end
77
-
78
- def stop
79
- if running?
80
- @process.stop STOP_TIMEOUT
81
- end
82
- end
83
-
84
- def port
85
- @port
86
- end
87
-
88
- def uri
89
- "http://#{Platform.localhost}:#{port}"
90
- end
91
-
92
- def running?
93
- @process && @process.alive?
94
- end
95
-
96
- private
97
-
98
- def server_args
99
- args = ["--port=#{@port}"]
100
-
101
- args << "--log-level=#{@log_level.to_s.upcase}" if @log_level
102
- args << "--log-file=#{@log_file}" if @log_file
103
- args << "--implementation=#{@implementation.to_s.upcase}" if @implementation
104
-
105
- args
106
- end
107
-
108
- def find_free_port
109
- @port = PortProber.above @port
110
- end
111
-
112
- def start_process
113
- @process = ChildProcess.new(@binary_path, *server_args)
114
- @process.io.inherit! if $DEBUG
115
- @process.start
116
- end
117
-
118
- def connect_until_stable(timeout)
119
- socket_poller = SocketPoller.new Platform.localhost, @port, timeout
120
-
121
- unless socket_poller.connected?
122
- raise Error::WebDriverError, "unable to connect to IE server within #{timeout} seconds"
123
- end
124
- end
125
-
126
- def socket_lock
127
- @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
128
- end
129
-
130
- end # Server
131
- end # IE
132
- end # WebDriver
133
- end # Selenium
@@ -1,64 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module IPhone
23
- #
24
- # @api private
25
- #
26
-
27
- class Bridge < Remote::Bridge
28
-
29
- DEFAULT_URL = "http://#{Platform.localhost}:3001/wd/hub/"
30
-
31
- def initialize(opts = {})
32
- warn 'The iPhone driver is deprecated - please use either http://appium.io/ or http://ios-driver.github.io/ios-driver/ instead'
33
-
34
- remote_opts = {
35
- :url => opts.fetch(:url, DEFAULT_URL),
36
- :desired_capabilities => opts.fetch(:desired_capabilities, capabilities),
37
- }
38
-
39
- remote_opts[:http_client] = opts[:http_client] if opts.has_key?(:http_client)
40
-
41
- super remote_opts
42
- end
43
-
44
- def browser
45
- :iphone
46
- end
47
-
48
- def driver_extensions
49
- [
50
- DriverExtensions::TakesScreenshot,
51
- DriverExtensions::HasInputDevices,
52
- DriverExtensions::HasWebStorage,
53
- DriverExtensions::HasLocation
54
- ]
55
- end
56
-
57
- def capabilities
58
- @capabilities ||= Remote::Capabilities.iphone
59
- end
60
-
61
- end # Bridge
62
- end # IPhone
63
- end # WebDriver
64
- end # Selenium