selenium-webdriver 2.53.4 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +24 -18
- data/README.md +2 -3
- data/lib/selenium/server.rb +64 -68
- data/lib/selenium/webdriver.rb +5 -9
- data/lib/selenium/webdriver/chrome.rb +18 -3
- data/lib/selenium/webdriver/chrome/bridge.rb +13 -16
- data/lib/selenium/webdriver/chrome/profile.rb +7 -9
- data/lib/selenium/webdriver/chrome/service.rb +8 -84
- data/lib/selenium/webdriver/common.rb +1 -2
- data/lib/selenium/webdriver/common/action_builder.rb +28 -38
- data/lib/selenium/webdriver/common/alert.rb +7 -10
- data/lib/selenium/webdriver/common/bridge_helper.rb +10 -15
- data/lib/selenium/webdriver/common/driver.rb +19 -28
- data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +0 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +4 -6
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -3
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -6
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -5
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -5
- data/lib/selenium/webdriver/common/element.rb +27 -29
- data/lib/selenium/webdriver/common/error.rb +17 -20
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -9
- data/lib/selenium/webdriver/common/html5/local_storage.rb +6 -8
- data/lib/selenium/webdriver/common/html5/session_storage.rb +6 -8
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +6 -15
- data/lib/selenium/webdriver/common/keyboard.rb +7 -12
- data/lib/selenium/webdriver/common/keys.rb +67 -69
- data/lib/selenium/webdriver/common/log_entry.rb +3 -4
- data/lib/selenium/webdriver/common/logs.rb +2 -4
- data/lib/selenium/webdriver/common/mouse.rb +9 -12
- data/lib/selenium/webdriver/common/navigation.rb +2 -4
- data/lib/selenium/webdriver/common/options.rb +16 -19
- data/lib/selenium/webdriver/common/platform.rb +61 -90
- data/lib/selenium/webdriver/common/port_prober.rb +1 -2
- data/lib/selenium/webdriver/common/profile_helper.rb +5 -8
- data/lib/selenium/webdriver/common/proxy.rb +58 -70
- data/lib/selenium/webdriver/common/search_context.rb +15 -19
- data/lib/selenium/webdriver/common/service.rb +127 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +5 -11
- data/lib/selenium/webdriver/common/socket_poller.rb +4 -9
- data/lib/selenium/webdriver/common/target_locator.rb +11 -13
- data/lib/selenium/webdriver/common/timeouts.rb +4 -6
- data/lib/selenium/webdriver/common/touch_action_builder.rb +2 -4
- data/lib/selenium/webdriver/common/touch_screen.rb +15 -18
- data/lib/selenium/webdriver/common/w3c_error.rb +3 -6
- data/lib/selenium/webdriver/common/wait.rb +6 -11
- data/lib/selenium/webdriver/common/window.rb +12 -15
- data/lib/selenium/webdriver/common/zipper.rb +6 -8
- data/lib/selenium/webdriver/edge.rb +18 -3
- data/lib/selenium/webdriver/edge/bridge.rb +11 -16
- data/lib/selenium/webdriver/edge/legacy_support.rb +38 -39
- data/lib/selenium/webdriver/edge/service.rb +8 -82
- data/lib/selenium/webdriver/firefox.rb +25 -6
- data/lib/selenium/webdriver/firefox/binary.rb +37 -53
- data/lib/selenium/webdriver/firefox/bridge.rb +3 -6
- data/lib/selenium/webdriver/firefox/extension.rb +4 -6
- data/lib/selenium/webdriver/firefox/extension/prefs.json +1 -10
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +8 -11
- data/lib/selenium/webdriver/firefox/profile.rb +40 -42
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +8 -15
- data/lib/selenium/webdriver/firefox/service.rb +23 -79
- data/lib/selenium/webdriver/firefox/util.rb +0 -2
- data/lib/selenium/webdriver/firefox/w3c_bridge.rb +2 -4
- data/lib/selenium/webdriver/ie.rb +16 -7
- data/lib/selenium/webdriver/ie/bridge.rb +16 -23
- data/lib/selenium/webdriver/{iphone.rb → ie/service.rb} +26 -4
- data/lib/selenium/webdriver/phantomjs.rb +8 -3
- data/lib/selenium/webdriver/phantomjs/bridge.rb +9 -11
- data/lib/selenium/webdriver/phantomjs/service.rb +17 -81
- data/lib/selenium/webdriver/remote.rb +0 -2
- data/lib/selenium/webdriver/remote/bridge.rb +193 -191
- data/lib/selenium/webdriver/remote/capabilities.rb +60 -90
- data/lib/selenium/webdriver/remote/commands.rb +197 -192
- data/lib/selenium/webdriver/remote/http/common.rb +15 -13
- data/lib/selenium/webdriver/remote/http/curb.rb +5 -9
- data/lib/selenium/webdriver/remote/http/default.rb +32 -37
- data/lib/selenium/webdriver/remote/http/persistent.rb +4 -6
- data/lib/selenium/webdriver/remote/response.rb +13 -21
- data/lib/selenium/webdriver/remote/server_error.rb +1 -3
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +200 -195
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +38 -46
- data/lib/selenium/webdriver/remote/w3c_commands.rb +116 -113
- data/lib/selenium/webdriver/safari.rb +23 -7
- data/lib/selenium/{client/javascript_frameworks/jquery.rb → webdriver/safari/apple_bridge.rb} +28 -9
- data/lib/selenium/webdriver/safari/browser.rb +0 -2
- data/lib/selenium/webdriver/safari/{bridge.rb → legacy_bridge.rb} +12 -9
- data/lib/selenium/webdriver/safari/options.rb +3 -4
- data/lib/selenium/webdriver/safari/resources/client.js +56 -7255
- data/lib/selenium/webdriver/safari/server.rb +18 -24
- data/lib/selenium/{client/javascript_frameworks/prototype.rb → webdriver/safari/service.rb} +27 -9
- data/lib/selenium/webdriver/support.rb +1 -0
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +17 -2
- data/lib/selenium/webdriver/support/block_event_listener.rb +1 -3
- data/lib/selenium/webdriver/support/color.rb +55 -38
- data/lib/selenium/webdriver/{android.rb → support/escaper.rb} +19 -4
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +36 -38
- data/lib/selenium/webdriver/support/select.rb +33 -84
- data/selenium-webdriver.gemspec +23 -23
- metadata +19 -30
- data/lib/selenium-client.rb +0 -21
- data/lib/selenium/client.rb +0 -57
- data/lib/selenium/client/base.rb +0 -151
- data/lib/selenium/client/driver.rb +0 -29
- data/lib/selenium/client/errors.rb +0 -28
- data/lib/selenium/client/extensions.rb +0 -132
- data/lib/selenium/client/idiomatic.rb +0 -507
- data/lib/selenium/client/javascript_expression_builder.rb +0 -135
- data/lib/selenium/client/legacy_driver.rb +0 -1722
- data/lib/selenium/client/protocol.rb +0 -123
- data/lib/selenium/client/selenium_helper.rb +0 -49
- data/lib/selenium/rake/server_task.rb +0 -176
- data/lib/selenium/webdriver/android/bridge.rb +0 -68
- data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
- data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
- data/lib/selenium/webdriver/common/html5/location.rb +0 -19
- data/lib/selenium/webdriver/ie/server.rb +0 -133
- data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
@@ -19,7 +19,6 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# The main class through which you control the browser.
|
25
24
|
#
|
@@ -33,7 +32,6 @@ module Selenium
|
|
33
32
|
include SearchContext
|
34
33
|
|
35
34
|
class << self
|
36
|
-
|
37
35
|
#
|
38
36
|
# @api private
|
39
37
|
#
|
@@ -64,14 +62,14 @@ module Selenium
|
|
64
62
|
Chrome::Bridge.new(opts)
|
65
63
|
when :edge
|
66
64
|
Edge::Bridge.new(opts)
|
67
|
-
when :android
|
68
|
-
Android::Bridge.new(opts)
|
69
|
-
when :iphone
|
70
|
-
IPhone::Bridge.new(opts)
|
71
65
|
when :phantomjs
|
72
66
|
PhantomJS::Bridge.new(opts)
|
73
67
|
when :safari
|
74
|
-
Safari::
|
68
|
+
if Safari::LegacyBridge.legacy?
|
69
|
+
Safari::LegacyBridge.new(opts)
|
70
|
+
else
|
71
|
+
Safari::AppleBridge.new(opts)
|
72
|
+
end
|
75
73
|
else
|
76
74
|
raise ArgumentError, "unknown driver: #{browser.inspect}"
|
77
75
|
end
|
@@ -93,13 +91,12 @@ module Selenium
|
|
93
91
|
@bridge = bridge
|
94
92
|
|
95
93
|
# TODO: refactor this away
|
96
|
-
|
97
|
-
|
98
|
-
end
|
94
|
+
return if bridge.driver_extensions.empty?
|
95
|
+
extend(*bridge.driver_extensions)
|
99
96
|
end
|
100
97
|
|
101
98
|
def inspect
|
102
|
-
'#<%s:0x%x browser=%s>'
|
99
|
+
format '#<%s:0x%x browser=%s>', self.class, hash * 2, bridge.browser.inspect
|
103
100
|
end
|
104
101
|
|
105
102
|
#
|
@@ -144,7 +141,7 @@ module Selenium
|
|
144
141
|
#
|
145
142
|
|
146
143
|
def current_url
|
147
|
-
bridge.
|
144
|
+
bridge.url
|
148
145
|
end
|
149
146
|
|
150
147
|
#
|
@@ -154,7 +151,7 @@ module Selenium
|
|
154
151
|
#
|
155
152
|
|
156
153
|
def title
|
157
|
-
bridge.
|
154
|
+
bridge.title
|
158
155
|
end
|
159
156
|
|
160
157
|
#
|
@@ -164,7 +161,7 @@ module Selenium
|
|
164
161
|
#
|
165
162
|
|
166
163
|
def page_source
|
167
|
-
bridge.
|
164
|
+
bridge.page_source
|
168
165
|
end
|
169
166
|
|
170
167
|
#
|
@@ -191,7 +188,7 @@ module Selenium
|
|
191
188
|
#
|
192
189
|
|
193
190
|
def window_handles
|
194
|
-
bridge.
|
191
|
+
bridge.window_handles
|
195
192
|
end
|
196
193
|
|
197
194
|
#
|
@@ -201,7 +198,7 @@ module Selenium
|
|
201
198
|
#
|
202
199
|
|
203
200
|
def window_handle
|
204
|
-
bridge.
|
201
|
+
bridge.window_handle
|
205
202
|
end
|
206
203
|
|
207
204
|
#
|
@@ -217,7 +214,7 @@ module Selenium
|
|
217
214
|
#
|
218
215
|
|
219
216
|
def execute_script(script, *args)
|
220
|
-
bridge.
|
217
|
+
bridge.execute_script(script, *args)
|
221
218
|
end
|
222
219
|
|
223
220
|
# Execute an asynchronous piece of JavaScript in the context of the
|
@@ -236,20 +233,19 @@ module Selenium
|
|
236
233
|
#
|
237
234
|
|
238
235
|
def execute_async_script(script, *args)
|
239
|
-
bridge.
|
236
|
+
bridge.execute_async_script(script, *args)
|
240
237
|
end
|
241
238
|
|
242
|
-
|
243
239
|
#-------------------------------- sugar --------------------------------
|
244
240
|
|
245
241
|
#
|
246
|
-
# driver.first(:
|
242
|
+
# driver.first(id: 'foo')
|
247
243
|
#
|
248
244
|
|
249
245
|
alias_method :first, :find_element
|
250
246
|
|
251
247
|
#
|
252
|
-
# driver.all(:
|
248
|
+
# driver.all(class: 'bar') #=> [#<WebDriver::Element:0x1011c3b88, ...]
|
253
249
|
#
|
254
250
|
|
255
251
|
alias_method :all, :find_elements
|
@@ -273,9 +269,7 @@ module Selenium
|
|
273
269
|
#
|
274
270
|
|
275
271
|
def [](sel)
|
276
|
-
if sel.
|
277
|
-
sel = { :id => sel }
|
278
|
-
end
|
272
|
+
sel = {id: sel} if sel.is_a?(String) || sel.is_a?(Symbol)
|
279
273
|
|
280
274
|
find_element sel
|
281
275
|
end
|
@@ -299,10 +293,7 @@ module Selenium
|
|
299
293
|
|
300
294
|
private
|
301
295
|
|
302
|
-
|
303
|
-
@bridge
|
304
|
-
end
|
305
|
-
|
296
|
+
attr_reader :bridge
|
306
297
|
end # Driver
|
307
298
|
end # WebDriver
|
308
299
|
end # Selenium
|
@@ -19,14 +19,12 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api private
|
25
24
|
#
|
26
25
|
|
27
26
|
module DriverExtensions
|
28
27
|
module HasInputDevices
|
29
|
-
|
30
28
|
#
|
31
29
|
# @return [ActionBuilder]
|
32
30
|
# @api public
|
@@ -51,7 +49,6 @@ module Selenium
|
|
51
49
|
def keyboard
|
52
50
|
Keyboard.new @bridge
|
53
51
|
end
|
54
|
-
|
55
52
|
end # HasInputDevices
|
56
53
|
end # DriverExtensions
|
57
54
|
end # WebDriver
|
@@ -20,25 +20,23 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module DriverExtensions
|
23
|
-
|
24
23
|
module HasLocation
|
25
24
|
def location
|
26
|
-
@bridge.
|
25
|
+
@bridge.location
|
27
26
|
end
|
28
27
|
|
29
28
|
def location=(loc)
|
30
|
-
unless loc.
|
29
|
+
unless loc.is_a?(Location)
|
31
30
|
raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}"
|
32
31
|
end
|
33
32
|
|
34
|
-
@bridge.
|
33
|
+
@bridge.set_location loc.latitude, loc.longitude, loc.altitude
|
35
34
|
end
|
36
35
|
|
37
36
|
def set_location(lat, lon, alt)
|
38
37
|
self.location = Location.new(Float(lat), Float(lon), Float(alt))
|
39
38
|
end
|
40
|
-
|
41
|
-
end #HasLocation
|
39
|
+
end # HasLocation
|
42
40
|
end # DriverExtensions
|
43
41
|
end # WebDriver
|
44
42
|
end # Selenium
|
@@ -22,7 +22,7 @@ module Selenium
|
|
22
22
|
module DriverExtensions
|
23
23
|
module HasNetworkConnection
|
24
24
|
def network_connection_type
|
25
|
-
connection_value = @bridge.
|
25
|
+
connection_value = @bridge.network_connection
|
26
26
|
|
27
27
|
connection_type = values_to_type[connection_value]
|
28
28
|
|
@@ -32,17 +32,17 @@ module Selenium
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def network_connection_type=(connection_type)
|
35
|
-
raise ArgumentError,
|
35
|
+
raise ArgumentError, 'Invalid connection type' unless valid_type? connection_type
|
36
36
|
|
37
37
|
connection_value = type_to_values[connection_type]
|
38
38
|
|
39
|
-
@bridge.
|
39
|
+
@bridge.network_connection = connection_value
|
40
40
|
end
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def type_to_values
|
45
|
-
{:
|
45
|
+
{airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}
|
46
46
|
end
|
47
47
|
|
48
48
|
def values_to_type
|
@@ -52,7 +52,6 @@ module Selenium
|
|
52
52
|
def valid_type?(type)
|
53
53
|
type_to_values.keys.include? type
|
54
54
|
end
|
55
|
-
|
56
55
|
end # HasNetworkConnection
|
57
56
|
end # DriverExtensions
|
58
57
|
end # WebDriver
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module DriverExtensions
|
23
|
-
|
24
23
|
module HasTouchScreen
|
25
24
|
def touch
|
26
25
|
TouchActionBuilder.new mouse, keyboard, touch_screen
|
@@ -31,7 +30,6 @@ module Selenium
|
|
31
30
|
def touch_screen
|
32
31
|
TouchScreen.new @bridge
|
33
32
|
end
|
34
|
-
|
35
33
|
end # HasTouchScreen
|
36
34
|
end # DriverExtensions
|
37
35
|
end # WebDriver
|
@@ -19,14 +19,12 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api private
|
25
24
|
#
|
26
25
|
|
27
26
|
module DriverExtensions
|
28
27
|
module HasWebStorage
|
29
|
-
|
30
28
|
def local_storage
|
31
29
|
HTML5::LocalStorage.new @bridge
|
32
30
|
end
|
@@ -34,7 +32,6 @@ module Selenium
|
|
34
32
|
def session_storage
|
35
33
|
HTML5::SessionStorage.new @bridge
|
36
34
|
end
|
37
|
-
|
38
35
|
end # HasWebStorage
|
39
36
|
end # DriverExtensions
|
40
37
|
end # WebDriver
|
@@ -19,15 +19,13 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api private
|
25
24
|
#
|
26
25
|
|
27
26
|
module DriverExtensions
|
28
27
|
module Rotatable
|
29
|
-
|
30
|
-
ORIENTATIONS = [:landscape, :portrait]
|
28
|
+
ORIENTATIONS = [:landscape, :portrait].freeze
|
31
29
|
|
32
30
|
#
|
33
31
|
# Change the screen orientation
|
@@ -42,7 +40,7 @@ module Selenium
|
|
42
40
|
raise ArgumentError, "expected #{ORIENTATIONS.inspect}, got #{orientation.inspect}"
|
43
41
|
end
|
44
42
|
|
45
|
-
bridge.
|
43
|
+
bridge.screen_orientation = orientation.to_s.upcase
|
46
44
|
end
|
47
45
|
alias_method :rotate, :rotation=
|
48
46
|
|
@@ -55,9 +53,8 @@ module Selenium
|
|
55
53
|
#
|
56
54
|
|
57
55
|
def orientation
|
58
|
-
bridge.
|
56
|
+
bridge.screen_orientation.to_sym.downcase
|
59
57
|
end
|
60
|
-
|
61
58
|
end # Rotatable
|
62
59
|
end # DriverExtensions
|
63
60
|
end # WebDriver
|
@@ -19,14 +19,12 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api private
|
25
24
|
#
|
26
25
|
|
27
26
|
module DriverExtensions
|
28
27
|
module TakesScreenshot
|
29
|
-
|
30
28
|
#
|
31
29
|
# Save a PNG screenshot to the given path
|
32
30
|
#
|
@@ -48,14 +46,13 @@ module Selenium
|
|
48
46
|
def screenshot_as(format)
|
49
47
|
case format
|
50
48
|
when :base64
|
51
|
-
bridge.
|
49
|
+
bridge.screenshot
|
52
50
|
when :png
|
53
|
-
bridge.
|
51
|
+
bridge.screenshot.unpack('m')[0]
|
54
52
|
else
|
55
53
|
raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
56
54
|
end
|
57
55
|
end
|
58
|
-
|
59
56
|
end # TakesScreenshot
|
60
57
|
end # DriverExtensions
|
61
58
|
end # WebDriver
|
@@ -19,14 +19,12 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api private
|
25
24
|
#
|
26
25
|
|
27
26
|
module DriverExtensions
|
28
27
|
module UploadsFiles
|
29
|
-
|
30
28
|
#
|
31
29
|
# Set the file detector to pass local files to a remote WebDriver.
|
32
30
|
#
|
@@ -52,13 +50,12 @@ module Selenium
|
|
52
50
|
#
|
53
51
|
|
54
52
|
def file_detector=(detector)
|
55
|
-
unless detector.nil?
|
56
|
-
raise ArgumentError,
|
53
|
+
unless detector.nil? || detector.respond_to?(:call)
|
54
|
+
raise ArgumentError, 'detector must respond to #call'
|
57
55
|
end
|
58
56
|
|
59
57
|
bridge.file_detector = detector
|
60
58
|
end
|
61
|
-
|
62
59
|
end # UploadsFiles
|
63
60
|
end # DriverExtensions
|
64
61
|
end # WebDriver
|
@@ -29,15 +29,16 @@ module Selenium
|
|
29
29
|
#
|
30
30
|
|
31
31
|
def initialize(bridge, id)
|
32
|
-
@bridge
|
32
|
+
@bridge = bridge
|
33
|
+
@id = id
|
33
34
|
end
|
34
35
|
|
35
36
|
def inspect
|
36
|
-
'#<%s:0x%x id=%s>'
|
37
|
+
format '#<%s:0x%x id=%s>', self.class, hash * 2, @id.inspect
|
37
38
|
end
|
38
39
|
|
39
40
|
def ==(other)
|
40
|
-
other.
|
41
|
+
other.is_a?(self.class) && ref == other.ref
|
41
42
|
end
|
42
43
|
alias_method :eql?, :==
|
43
44
|
|
@@ -63,14 +64,14 @@ module Selenium
|
|
63
64
|
#
|
64
65
|
# @example Click on a button
|
65
66
|
#
|
66
|
-
# driver.find_element(:
|
67
|
+
# driver.find_element(tag_name: "button").click
|
67
68
|
#
|
68
69
|
# @raise [StaleElementReferenceError] if the element no longer exists as
|
69
70
|
# defined
|
70
71
|
#
|
71
72
|
|
72
73
|
def click
|
73
|
-
bridge.
|
74
|
+
bridge.click_element @id
|
74
75
|
end
|
75
76
|
|
76
77
|
#
|
@@ -78,13 +79,13 @@ module Selenium
|
|
78
79
|
#
|
79
80
|
# @example Get the tagname of an INPUT element(returns "input")
|
80
81
|
#
|
81
|
-
# driver.find_element(:
|
82
|
+
# driver.find_element(xpath: "//input").tag_name
|
82
83
|
#
|
83
84
|
# @return [String] The tag name of this element.
|
84
85
|
#
|
85
86
|
|
86
87
|
def tag_name
|
87
|
-
bridge.
|
88
|
+
bridge.element_tag_name @id
|
88
89
|
end
|
89
90
|
|
90
91
|
#
|
@@ -114,7 +115,7 @@ module Selenium
|
|
114
115
|
#
|
115
116
|
|
116
117
|
def attribute(name)
|
117
|
-
bridge.
|
118
|
+
bridge.element_attribute @id, name
|
118
119
|
end
|
119
120
|
|
120
121
|
#
|
@@ -124,7 +125,7 @@ module Selenium
|
|
124
125
|
#
|
125
126
|
|
126
127
|
def text
|
127
|
-
bridge.
|
128
|
+
bridge.element_text @id
|
128
129
|
end
|
129
130
|
|
130
131
|
#
|
@@ -142,7 +143,7 @@ module Selenium
|
|
142
143
|
#
|
143
144
|
|
144
145
|
def send_keys(*args)
|
145
|
-
bridge.
|
146
|
+
bridge.send_keys_to_element @id, Keys.encode(args)
|
146
147
|
end
|
147
148
|
alias_method :send_key, :send_keys
|
148
149
|
|
@@ -157,7 +158,7 @@ module Selenium
|
|
157
158
|
#
|
158
159
|
|
159
160
|
def clear
|
160
|
-
bridge.
|
161
|
+
bridge.clear_element @id
|
161
162
|
end
|
162
163
|
|
163
164
|
#
|
@@ -167,7 +168,7 @@ module Selenium
|
|
167
168
|
#
|
168
169
|
|
169
170
|
def enabled?
|
170
|
-
bridge.
|
171
|
+
bridge.element_enabled? @id
|
171
172
|
end
|
172
173
|
|
173
174
|
#
|
@@ -177,7 +178,7 @@ module Selenium
|
|
177
178
|
#
|
178
179
|
|
179
180
|
def selected?
|
180
|
-
bridge.
|
181
|
+
bridge.element_selected? @id
|
181
182
|
end
|
182
183
|
|
183
184
|
#
|
@@ -187,7 +188,7 @@ module Selenium
|
|
187
188
|
#
|
188
189
|
|
189
190
|
def displayed?
|
190
|
-
bridge.
|
191
|
+
bridge.element_displayed? @id
|
191
192
|
end
|
192
193
|
|
193
194
|
#
|
@@ -195,7 +196,7 @@ module Selenium
|
|
195
196
|
#
|
196
197
|
|
197
198
|
def submit
|
198
|
-
bridge.
|
199
|
+
bridge.submit_element @id
|
199
200
|
end
|
200
201
|
|
201
202
|
#
|
@@ -210,7 +211,7 @@ module Selenium
|
|
210
211
|
#
|
211
212
|
|
212
213
|
def css_value(prop)
|
213
|
-
bridge.
|
214
|
+
bridge.element_value_of_css_property @id, prop
|
214
215
|
end
|
215
216
|
alias_method :style, :css_value
|
216
217
|
|
@@ -221,7 +222,7 @@ module Selenium
|
|
221
222
|
#
|
222
223
|
|
223
224
|
def location
|
224
|
-
bridge.
|
225
|
+
bridge.element_location @id
|
225
226
|
end
|
226
227
|
|
227
228
|
#
|
@@ -231,7 +232,7 @@ module Selenium
|
|
231
232
|
#
|
232
233
|
|
233
234
|
def location_once_scrolled_into_view
|
234
|
-
bridge.
|
235
|
+
bridge.element_location_once_scrolled_into_view @id
|
235
236
|
end
|
236
237
|
|
237
238
|
#
|
@@ -241,19 +242,19 @@ module Selenium
|
|
241
242
|
#
|
242
243
|
|
243
244
|
def size
|
244
|
-
bridge.
|
245
|
+
bridge.element_size @id
|
245
246
|
end
|
246
247
|
|
247
248
|
#-------------------------------- sugar --------------------------------
|
248
249
|
|
249
250
|
#
|
250
|
-
# element.first(:
|
251
|
+
# element.first(id: 'foo')
|
251
252
|
#
|
252
253
|
|
253
254
|
alias_method :first, :find_element
|
254
255
|
|
255
256
|
#
|
256
|
-
# element.all(:
|
257
|
+
# element.all(class: 'bar')
|
257
258
|
#
|
258
259
|
|
259
260
|
alias_method :all, :find_elements
|
@@ -280,7 +281,7 @@ module Selenium
|
|
280
281
|
# @api private
|
281
282
|
#
|
282
283
|
|
283
|
-
def to_json(*
|
284
|
+
def to_json(*)
|
284
285
|
JSON.generate as_json
|
285
286
|
end
|
286
287
|
|
@@ -290,26 +291,23 @@ module Selenium
|
|
290
291
|
# @api private
|
291
292
|
#
|
292
293
|
|
293
|
-
def as_json(
|
294
|
+
def as_json(*)
|
294
295
|
{
|
295
296
|
:ELEMENT => @id,
|
296
|
-
|
297
|
+
'element-6066-11e4-a52e-4f735466cecf' => @id
|
297
298
|
}
|
298
299
|
end
|
299
300
|
|
300
301
|
private
|
301
302
|
|
302
|
-
|
303
|
-
@bridge
|
304
|
-
end
|
303
|
+
attr_reader :bridge
|
305
304
|
|
306
305
|
def selectable?
|
307
306
|
tn = tag_name.downcase
|
308
307
|
type = attribute(:type).to_s.downcase
|
309
308
|
|
310
|
-
tn ==
|
309
|
+
tn == 'option' || (tn == 'input' && %w[radio checkbox].include?(type))
|
311
310
|
end
|
312
|
-
|
313
311
|
end # Element
|
314
312
|
end # WebDriver
|
315
313
|
end # Selenium
|