testcentricity_web 4.3.1 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -12
  3. data/LICENSE.md +1 -1
  4. data/README.md +1794 -697
  5. data/lib/devices/devices.yml +144 -216
  6. data/lib/testcentricity_web/browser_helper.rb +33 -4
  7. data/lib/testcentricity_web/data_objects/environment.rb +96 -13
  8. data/lib/testcentricity_web/exception_queue_helper.rb +5 -6
  9. data/lib/testcentricity_web/version.rb +1 -1
  10. data/lib/testcentricity_web/web_core/page_object.rb +53 -49
  11. data/lib/testcentricity_web/web_core/page_objects_helper.rb +20 -11
  12. data/lib/testcentricity_web/web_core/page_section.rb +31 -34
  13. data/lib/testcentricity_web/web_core/webdriver_helper.rb +379 -252
  14. data/lib/testcentricity_web/web_elements/audio.rb +6 -4
  15. data/lib/testcentricity_web/web_elements/button.rb +7 -4
  16. data/lib/testcentricity_web/web_elements/checkbox.rb +149 -147
  17. data/lib/testcentricity_web/web_elements/file_field.rb +38 -36
  18. data/lib/testcentricity_web/web_elements/image.rb +75 -70
  19. data/lib/testcentricity_web/web_elements/label.rb +6 -4
  20. data/lib/testcentricity_web/web_elements/link.rb +15 -13
  21. data/lib/testcentricity_web/web_elements/list.rb +171 -169
  22. data/lib/testcentricity_web/web_elements/media.rb +384 -379
  23. data/lib/testcentricity_web/web_elements/radio.rb +135 -133
  24. data/lib/testcentricity_web/web_elements/range.rb +16 -29
  25. data/lib/testcentricity_web/web_elements/select_list.rb +247 -245
  26. data/lib/testcentricity_web/web_elements/table.rb +575 -573
  27. data/lib/testcentricity_web/web_elements/textfield.rb +143 -139
  28. data/lib/testcentricity_web/web_elements/ui_element.rb +1171 -0
  29. data/lib/testcentricity_web/web_elements/video.rb +39 -37
  30. data/lib/testcentricity_web/world_extensions.rb +37 -4
  31. data/lib/testcentricity_web.rb +4 -23
  32. metadata +28 -80
  33. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +0 -1148
@@ -1,416 +1,421 @@
1
1
  module TestCentricity
2
- class Media < UIElement
3
- # Return media autoplay property
4
- #
5
- # @return [Boolean]
6
- # @example
7
- # media_player.autoplay?
8
- #
9
- def autoplay?
10
- obj, = find_element(visible = :all)
11
- object_not_found_exception(obj, @type)
12
- state = obj.native.attribute('autoplay')
13
- state.boolean? ? state : state == 'true'
14
- end
2
+ module Elements
3
+ class Media < UIElement
4
+ # Return media autoplay property
5
+ #
6
+ # @return [Boolean]
7
+ # @example
8
+ # media_player.autoplay?
9
+ #
10
+ def autoplay?
11
+ obj, = find_element(visible = :all)
12
+ object_not_found_exception(obj, @type)
13
+ state = obj.native.attribute('autoplay')
14
+ state.boolean? ? state : state == 'true'
15
+ end
15
16
 
16
- # Return media ended property
17
- #
18
- # @return [Boolean]
19
- # @example
20
- # media_player.ended?
21
- #
22
- def ended?
23
- obj, = find_element(visible = :all)
24
- object_not_found_exception(obj, @type)
25
- state = obj.native.attribute('ended')
26
- state.boolean? ? state : state == 'true'
27
- end
17
+ # Return media ended property
18
+ #
19
+ # @return [Boolean]
20
+ # @example
21
+ # media_player.ended?
22
+ #
23
+ def ended?
24
+ obj, = find_element(visible = :all)
25
+ object_not_found_exception(obj, @type)
26
+ state = obj.native.attribute('ended')
27
+ state.boolean? ? state : state == 'true'
28
+ end
28
29
 
29
- # Return media controls property
30
- #
31
- # @return [Boolean]
32
- # @example
33
- # media_player.controls?
34
- #
35
- def controls?
36
- obj, = find_element(visible = :all)
37
- object_not_found_exception(obj, @type)
38
- state = obj.native.attribute('controls')
39
- state.boolean? ? state : state == 'true'
40
- end
30
+ # Return media controls property
31
+ #
32
+ # @return [Boolean]
33
+ # @example
34
+ # media_player.controls?
35
+ #
36
+ def controls?
37
+ obj, = find_element(visible = :all)
38
+ object_not_found_exception(obj, @type)
39
+ state = obj.native.attribute('controls')
40
+ state.boolean? ? state : state == 'true'
41
+ end
41
42
 
42
- # Return media loop property
43
- #
44
- # @return [Boolean]
45
- # @example
46
- # media_player.loop?
47
- #
48
- def loop?
49
- obj, = find_element(visible = :all)
50
- object_not_found_exception(obj, @type)
51
- loop_state = obj.native.attribute('loop')
52
- loop_state.boolean? ? loop_state : loop_state == 'true'
53
- end
43
+ # Return media loop property
44
+ #
45
+ # @return [Boolean]
46
+ # @example
47
+ # media_player.loop?
48
+ #
49
+ def loop?
50
+ obj, = find_element(visible = :all)
51
+ object_not_found_exception(obj, @type)
52
+ loop_state = obj.native.attribute('loop')
53
+ loop_state.boolean? ? loop_state : loop_state == 'true'
54
+ end
54
55
 
55
- # Return media muted property
56
- #
57
- # @return [Boolean]
58
- # @example
59
- # media_player.muted?
60
- #
61
- def muted?
62
- obj, = find_element(visible = :all)
63
- object_not_found_exception(obj, @type)
64
- mute_state = obj.native.attribute('muted')
65
- mute_state.boolean? ? mute_state : mute_state == 'true'
66
- end
56
+ # Return media muted property
57
+ #
58
+ # @return [Boolean]
59
+ # @example
60
+ # media_player.muted?
61
+ #
62
+ def muted?
63
+ obj, = find_element(visible = :all)
64
+ object_not_found_exception(obj, @type)
65
+ mute_state = obj.native.attribute('muted')
66
+ mute_state.boolean? ? mute_state : mute_state == 'true'
67
+ end
67
68
 
68
- # Return media defaultMuted property
69
- #
70
- # @return [Boolean]
71
- # @example
72
- # media_player.default_muted?
73
- #
74
- def default_muted?
75
- obj, = find_element(visible = :all)
76
- object_not_found_exception(obj, @type)
77
- mute_state = obj.native.attribute('defaultMuted')
78
- mute_state.boolean? ? mute_state : mute_state == 'true'
79
- end
69
+ # Return media defaultMuted property
70
+ #
71
+ # @return [Boolean]
72
+ # @example
73
+ # media_player.default_muted?
74
+ #
75
+ def default_muted?
76
+ obj, = find_element(visible = :all)
77
+ object_not_found_exception(obj, @type)
78
+ mute_state = obj.native.attribute('defaultMuted')
79
+ mute_state.boolean? ? mute_state : mute_state == 'true'
80
+ end
80
81
 
81
- # Return media paused property
82
- #
83
- # @return [Boolean]
84
- # @example
85
- # media_player.paused?
86
- #
87
- def paused?
88
- obj, = find_element(visible = :all)
89
- object_not_found_exception(obj, @type)
90
- paused_state = obj.native.attribute('paused')
91
- paused_state.boolean? ? paused_state : paused_state == 'true'
92
- end
82
+ # Return media paused property
83
+ #
84
+ # @return [Boolean]
85
+ # @example
86
+ # media_player.paused?
87
+ #
88
+ def paused?
89
+ obj, = find_element(visible = :all)
90
+ object_not_found_exception(obj, @type)
91
+ paused_state = obj.native.attribute('paused')
92
+ paused_state.boolean? ? paused_state : paused_state == 'true'
93
+ end
93
94
 
94
- # Return media seeking property
95
- #
96
- # @return [Boolean]
97
- # @example
98
- # media_player.seeking?
99
- #
100
- def seeking?
101
- obj, = find_element(visible = :all)
102
- object_not_found_exception(obj, @type)
103
- state = obj.native.attribute('seeking')
104
- state.boolean? ? state : state == 'true'
105
- end
95
+ # Return media seeking property
96
+ #
97
+ # @return [Boolean]
98
+ # @example
99
+ # media_player.seeking?
100
+ #
101
+ def seeking?
102
+ obj, = find_element(visible = :all)
103
+ object_not_found_exception(obj, @type)
104
+ state = obj.native.attribute('seeking')
105
+ state.boolean? ? state : state == 'true'
106
+ end
106
107
 
107
- # Return media src property
108
- #
109
- # @return [String] value of src property
110
- # @example
111
- # src_value = media_player.src
112
- #
113
- def src
114
- obj, = find_element(visible = :all)
115
- object_not_found_exception(obj, @type)
116
- obj.native.attribute('src')
117
- end
108
+ # Return media src property
109
+ #
110
+ # @return [String] value of src property
111
+ # @example
112
+ # src_value = media_player.src
113
+ #
114
+ def src
115
+ obj, = find_element(visible = :all)
116
+ object_not_found_exception(obj, @type)
117
+ obj.native.attribute('src')
118
+ end
118
119
 
119
- # Return media currentTime property
120
- #
121
- # @return [Float] current playback position in seconds
122
- # @example
123
- # current_player_time = media_player.current_time
124
- #
125
- def current_time
126
- obj, = find_element(visible = :all)
127
- object_not_found_exception(obj, @type)
128
- obj.native.attribute('currentTime').to_f.round(2)
129
- end
120
+ # Return media currentTime property
121
+ #
122
+ # @return [Float] current playback position in seconds
123
+ # @example
124
+ # current_player_time = media_player.current_time
125
+ #
126
+ def current_time
127
+ obj, = find_element(visible = :all)
128
+ object_not_found_exception(obj, @type)
129
+ obj.native.attribute('currentTime').to_f.round(2)
130
+ end
130
131
 
131
- # Return media defaultPlaybackRate property
132
- #
133
- # @return [Integer or Float] default playback speed
134
- # @example
135
- # default_speed = media_player.default_playback_rate
136
- #
137
- def default_playback_rate
138
- obj, = find_element(visible = :all)
139
- object_not_found_exception(obj, @type)
140
- obj.native.attribute('defaultPlaybackRate').to_f
141
- end
132
+ # Return media defaultPlaybackRate property
133
+ #
134
+ # @return [Integer or Float] default playback speed
135
+ # @example
136
+ # default_speed = media_player.default_playback_rate
137
+ #
138
+ def default_playback_rate
139
+ obj, = find_element(visible = :all)
140
+ object_not_found_exception(obj, @type)
141
+ obj.native.attribute('defaultPlaybackRate').to_f
142
+ end
142
143
 
143
- # Return media duration property
144
- #
145
- # @return [Float] duration of media
146
- # @example
147
- # how_long = media_player.duration
148
- #
149
- def duration
150
- obj, = find_element(visible = :all)
151
- object_not_found_exception(obj, @type)
152
- obj.native.attribute('duration').to_f.round(2)
153
- end
144
+ # Return media duration property
145
+ #
146
+ # @return [Float] duration of media
147
+ # @example
148
+ # how_long = media_player.duration
149
+ #
150
+ def duration
151
+ obj, = find_element(visible = :all)
152
+ object_not_found_exception(obj, @type)
153
+ obj.native.attribute('duration').to_f.round(2)
154
+ end
154
155
 
155
- # Return media playbackRate property
156
- #
157
- # @return [Integer or Float] current playback speed
158
- # @example
159
- # playback_speed = media_player.playback_rate
160
- #
161
- def playback_rate
162
- obj, = find_element(visible = :all)
163
- object_not_found_exception(obj, @type)
164
- obj.native.attribute('playbackRate').to_f
165
- end
156
+ # Return media playbackRate property
157
+ #
158
+ # @return [Integer or Float] current playback speed
159
+ # @example
160
+ # playback_speed = media_player.playback_rate
161
+ #
162
+ def playback_rate
163
+ obj, = find_element(visible = :all)
164
+ object_not_found_exception(obj, @type)
165
+ obj.native.attribute('playbackRate').to_f
166
+ end
166
167
 
167
- # Return media readyState property
168
- #
169
- # @return [Integer] media ready state
170
- # 0 = HAVE_NOTHING - no information whether or not the audio/video is ready
171
- # 1 = HAVE_METADATA - metadata for the audio/video is ready
172
- # 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play next frame/millisecond
173
- # 3 = HAVE_FUTURE_DATA - data for the current and at least the next frame is available
174
- # 4 = HAVE_ENOUGH_DATA - enough data available to start playing
175
- # @example
176
- # media_status = media_player.ready_state
177
- #
178
- def ready_state
179
- obj, = find_element(visible = :all)
180
- object_not_found_exception(obj, @type)
181
- page.execute_script('return arguments[0].readyState', obj)
182
- end
168
+ # Return media readyState property
169
+ #
170
+ # @return [Integer] media ready state
171
+ # 0 = HAVE_NOTHING - no information whether or not the audio/video is ready
172
+ # 1 = HAVE_METADATA - metadata for the audio/video is ready
173
+ # 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play next frame/millisecond
174
+ # 3 = HAVE_FUTURE_DATA - data for the current and at least the next frame is available
175
+ # 4 = HAVE_ENOUGH_DATA - enough data available to start playing
176
+ # @example
177
+ # media_status = media_player.ready_state
178
+ #
179
+ def ready_state
180
+ obj, = find_element(visible = :all)
181
+ object_not_found_exception(obj, @type)
182
+ page.execute_script('return arguments[0].readyState', obj)
183
+ end
183
184
 
184
- # Wait until the media object's readyState value equals the specified value, or until the specified wait time has expired. If the wait
185
- # time is nil, then the wait time will be Capybara.default_max_wait_time.
186
- #
187
- # @param value [Integer] value expected
188
- # @param seconds [Integer or Float] wait time in seconds
189
- # @example
190
- # media_player.wait_until_ready_state_is(4, 5)
191
- #
192
- def wait_until_ready_state_is(value, seconds = nil, post_exception = true)
193
- timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
194
- wait = Selenium::WebDriver::Wait.new(timeout: timeout)
195
- wait.until { ready_state == value }
196
- rescue StandardError
197
- if post_exception
198
- raise "Ready state of media #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
199
- else
200
- ready_state == value
185
+ # Wait until the media object's readyState value equals the specified value, or until the specified wait time has expired. If the wait
186
+ # time is nil, then the wait time will be Capybara.default_max_wait_time.
187
+ #
188
+ # @param value [Integer] value expected
189
+ # @param seconds [Integer or Float] wait time in seconds
190
+ # @example
191
+ # media_player.wait_until_ready_state_is(4, 5)
192
+ #
193
+ def wait_until_ready_state_is(value, seconds = nil, post_exception = true)
194
+ timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
195
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
196
+ wait.until do
197
+ reset_mru_cache
198
+ ready_state == value
199
+ end
200
+ rescue StandardError
201
+ if post_exception
202
+ raise "Ready state of media #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
203
+ else
204
+ ready_state == value
205
+ end
201
206
  end
202
- end
203
207
 
204
- # Return media volume property
205
- #
206
- # @return [Float] media volume setting
207
- # @example
208
- # volume_level = media_player.volume
209
- #
210
- def volume
211
- obj, = find_element(visible = :all)
212
- object_not_found_exception(obj, @type)
213
- obj.native.attribute('volume').to_f
214
- end
208
+ # Return media volume property
209
+ #
210
+ # @return [Float] media volume setting
211
+ # @example
212
+ # volume_level = media_player.volume
213
+ #
214
+ def volume
215
+ obj, = find_element(visible = :all)
216
+ object_not_found_exception(obj, @type)
217
+ obj.native.attribute('volume').to_f
218
+ end
215
219
 
216
- # Return number of text tracks of associated media
217
- #
218
- # @return [Integer] number of text tracks
219
- # @example
220
- # num_tracks = media_player.track_count
221
- #
222
- def track_count
223
- obj, = find_element(visible = :all)
224
- object_not_found_exception(obj, @type)
225
- page.execute_script('return arguments[0].textTracks.length', obj)
226
- end
220
+ # Return number of text tracks of associated media
221
+ #
222
+ # @return [Integer] number of text tracks
223
+ # @example
224
+ # num_tracks = media_player.track_count
225
+ #
226
+ def track_count
227
+ obj, = find_element(visible = :all)
228
+ object_not_found_exception(obj, @type)
229
+ page.execute_script('return arguments[0].textTracks.length', obj)
230
+ end
227
231
 
228
- # Return index of active text track of associated media
229
- #
230
- # @return [Integer] number of active text track
231
- # @example
232
- # track_num = media_player.active_track
233
- #
234
- def active_track
235
- num_tracks = track_count
236
- return 0 if num_tracks.zero?
237
-
238
- obj, = find_element(visible = :all)
239
- object_not_found_exception(obj, @type)
240
- (0..num_tracks).each do |track|
241
- track_info = page.execute_script("return arguments[0].textTracks[#{track}].mode", obj)
242
- return track + 1 if track_info == 'showing'
232
+ # Return index of active text track of associated media
233
+ #
234
+ # @return [Integer] number of active text track
235
+ # @example
236
+ # track_num = media_player.active_track
237
+ #
238
+ def active_track
239
+ num_tracks = track_count
240
+ return 0 if num_tracks.zero?
241
+
242
+ obj, = find_element(visible = :all)
243
+ object_not_found_exception(obj, @type)
244
+ (0..num_tracks).each do |track|
245
+ track_info = page.execute_script("return arguments[0].textTracks[#{track}].mode", obj)
246
+ return track + 1 if track_info == 'showing'
247
+ end
248
+ 0
243
249
  end
244
- 0
245
- end
246
250
 
247
- # Return properties of active text track of associated media
248
- #
249
- # @return [Hash] properties of active text track (:kind, :label, :language, :mode)
250
- # @example
251
- # track_info = media_player.active_track_data
252
- #
253
- def active_track_data
254
- active = active_track
255
- return nil if active.zero?
256
-
257
- track_data(active)
258
- end
251
+ # Return properties of active text track of associated media
252
+ #
253
+ # @return [Hash] properties of active text track (:kind, :label, :language, :mode)
254
+ # @example
255
+ # track_info = media_player.active_track_data
256
+ #
257
+ def active_track_data
258
+ active = active_track
259
+ return nil if active.zero?
260
+
261
+ track_data(active)
262
+ end
259
263
 
260
- # Return properties of all text tracks of associated media
261
- #
262
- # @return [Array of Hash] properties of active text track (:kind, :label, :language, :mode)
263
- # @example
264
- # all_track_info = media_player.all_tracks_data
265
- #
266
- def all_tracks_data
267
- num_tracks = track_count
268
- return 0 if num_tracks.zero?
269
-
270
- all_data = []
271
- (1..num_tracks).each do |track|
272
- all_data.push( { track => track_data(track) })
264
+ # Return properties of all text tracks of associated media
265
+ #
266
+ # @return [Array of Hash] properties of active text track (:kind, :label, :language, :mode)
267
+ # @example
268
+ # all_track_info = media_player.all_tracks_data
269
+ #
270
+ def all_tracks_data
271
+ num_tracks = track_count
272
+ return 0 if num_tracks.zero?
273
+
274
+ all_data = []
275
+ (1..num_tracks).each do |track|
276
+ all_data.push( { track => track_data(track) })
277
+ end
278
+ all_data
273
279
  end
274
- all_data
275
- end
276
280
 
277
- # Return properties of specified text track of associated media
278
- #
279
- # @param track [Integer] index of requested track
280
- # @return [Hash] properties of requested text track (:kind, :label, :language, :mode)
281
- # @example
282
- # track_info = media_player.track_data(1)
283
- #
284
- def track_data(track)
285
- obj, = find_element(visible = :all)
286
- object_not_found_exception(obj, @type)
287
- track_mode = page.execute_script("return arguments[0].textTracks[#{track - 1}].mode", obj)
288
- track_obj = obj.find(:css, "track:nth-of-type(#{track})", visible: :all, wait: 1)
289
- {
290
- kind: track_obj[:kind],
291
- label: track_obj[:label],
292
- language: track_obj[:srclang],
293
- mode: track_mode
294
- }
295
- end
281
+ # Return properties of specified text track of associated media
282
+ #
283
+ # @param track [Integer] index of requested track
284
+ # @return [Hash] properties of requested text track (:kind, :label, :language, :mode)
285
+ # @example
286
+ # track_info = media_player.track_data(1)
287
+ #
288
+ def track_data(track)
289
+ obj, = find_element(visible = :all)
290
+ object_not_found_exception(obj, @type)
291
+ track_mode = page.execute_script("return arguments[0].textTracks[#{track - 1}].mode", obj)
292
+ track_obj = obj.find(:css, "track:nth-of-type(#{track})", visible: :all, wait: 1)
293
+ {
294
+ kind: track_obj[:kind],
295
+ label: track_obj[:label],
296
+ language: track_obj[:srclang],
297
+ mode: track_mode
298
+ }
299
+ end
296
300
 
297
- # Return src property of active text track of associated media
298
- #
299
- # @return [String] src property of active text track
300
- # @example
301
- # track_src = media_player.active_track_source
302
- #
303
- def active_track_source
304
- active = active_track
305
- return nil if active.zero?
306
-
307
- track_source(active)
308
- end
301
+ # Return src property of active text track of associated media
302
+ #
303
+ # @return [String] src property of active text track
304
+ # @example
305
+ # track_src = media_player.active_track_source
306
+ #
307
+ def active_track_source
308
+ active = active_track
309
+ return nil if active.zero?
310
+
311
+ track_source(active)
312
+ end
309
313
 
310
- # Return srv property of specified text track of associated media
311
- #
312
- # @param track [Integer] index of requested track
313
- # @return [String] src property of requested text track
314
- # @example
315
- # track_src = media_player.track_source(2)
316
- #
317
- def track_source(track)
318
- obj, = find_element(visible = :all)
319
- object_not_found_exception(obj, @type)
320
- track_obj = obj.find(:css, "track:nth-of-type(#{track})", visible: :all, wait: 1)
321
- track_obj[:src]
322
- end
314
+ # Return srv property of specified text track of associated media
315
+ #
316
+ # @param track [Integer] index of requested track
317
+ # @return [String] src property of requested text track
318
+ # @example
319
+ # track_src = media_player.track_source(2)
320
+ #
321
+ def track_source(track)
322
+ obj, = find_element(visible = :all)
323
+ object_not_found_exception(obj, @type)
324
+ track_obj = obj.find(:css, "track:nth-of-type(#{track})", visible: :all, wait: 1)
325
+ track_obj[:src]
326
+ end
323
327
 
324
- # Set the media currentTime property
325
- #
326
- # @param value [Float] time in seconds
327
- # @example
328
- # media_player.current_time = 1.5
329
- #
330
- def current_time=(value)
331
- obj, = find_element(visible = :all)
332
- object_not_found_exception(obj, @type)
333
- page.execute_script('arguments[0].currentTime = arguments[1]', obj, value)
334
- end
328
+ # Set the media currentTime property
329
+ #
330
+ # @param value [Float] time in seconds
331
+ # @example
332
+ # media_player.current_time = 1.5
333
+ #
334
+ def current_time=(value)
335
+ obj, = find_element(visible = :all)
336
+ object_not_found_exception(obj, @type)
337
+ page.execute_script('arguments[0].currentTime = arguments[1]', obj, value)
338
+ end
335
339
 
336
- # Play the media
337
- #
338
- # @example
339
- # media_player.play
340
- #
341
- def play
342
- obj, = find_element(visible = :all)
343
- object_not_found_exception(obj, @type)
344
- page.execute_script('arguments[0].play()', obj)
345
- end
340
+ # Play the media
341
+ #
342
+ # @example
343
+ # media_player.play
344
+ #
345
+ def play
346
+ obj, = find_element(visible = :all)
347
+ object_not_found_exception(obj, @type)
348
+ page.execute_script('arguments[0].play()', obj)
349
+ end
346
350
 
347
- # Pause the media
348
- #
349
- # @example
350
- # media_player.pause
351
- #
352
- def pause
353
- obj, = find_element(visible = :all)
354
- object_not_found_exception(obj, @type)
355
- page.execute_script('arguments[0].pause()', obj)
356
- end
351
+ # Pause the media
352
+ #
353
+ # @example
354
+ # media_player.pause
355
+ #
356
+ def pause
357
+ obj, = find_element(visible = :all)
358
+ object_not_found_exception(obj, @type)
359
+ page.execute_script('arguments[0].pause()', obj)
360
+ end
357
361
 
358
- # Mute the media's audio
359
- #
360
- # @example
361
- # media_player.mute
362
- #
363
- def mute
364
- obj, = find_element(visible = :all)
365
- object_not_found_exception(obj, @type)
366
- page.execute_script('arguments[0].muted = true;', obj)
367
- end
362
+ # Mute the media's audio
363
+ #
364
+ # @example
365
+ # media_player.mute
366
+ #
367
+ def mute
368
+ obj, = find_element(visible = :all)
369
+ object_not_found_exception(obj, @type)
370
+ page.execute_script('arguments[0].muted = true;', obj)
371
+ end
368
372
 
369
- # Unmute the media's audio
370
- #
371
- # @example
372
- # media_player.unmute
373
- #
374
- def unmute
375
- obj, = find_element(visible = :all)
376
- object_not_found_exception(obj, @type)
377
- page.execute_script('arguments[0].muted = false;', obj)
378
- end
373
+ # Unmute the media's audio
374
+ #
375
+ # @example
376
+ # media_player.unmute
377
+ #
378
+ def unmute
379
+ obj, = find_element(visible = :all)
380
+ object_not_found_exception(obj, @type)
381
+ page.execute_script('arguments[0].muted = false;', obj)
382
+ end
379
383
 
380
- # Set the media playbackRate property
381
- #
382
- # @param value [Float]
383
- # @example
384
- # media_player.playback_rate = 1.5
385
- #
386
- def playback_rate=(value)
387
- obj, = find_element(visible = :all)
388
- object_not_found_exception(obj, @type)
389
- page.execute_script('arguments[0].playbackRate = arguments[1]', obj, value)
390
- end
384
+ # Set the media playbackRate property
385
+ #
386
+ # @param value [Float]
387
+ # @example
388
+ # media_player.playback_rate = 1.5
389
+ #
390
+ def playback_rate=(value)
391
+ obj, = find_element(visible = :all)
392
+ object_not_found_exception(obj, @type)
393
+ page.execute_script('arguments[0].playbackRate = arguments[1]', obj, value)
394
+ end
391
395
 
392
- # Set the media volume property
393
- #
394
- # @param value [Float] between 0 and 1
395
- # @example
396
- # media_player.volume = 0.5
397
- #
398
- def volume=(value)
399
- obj, = find_element(visible = :all)
400
- object_not_found_exception(obj, @type)
401
- page.execute_script('arguments[0].volume = arguments[1]', obj, value)
402
- end
396
+ # Set the media volume property
397
+ #
398
+ # @param value [Float] between 0 and 1
399
+ # @example
400
+ # media_player.volume = 0.5
401
+ #
402
+ def volume=(value)
403
+ obj, = find_element(visible = :all)
404
+ object_not_found_exception(obj, @type)
405
+ page.execute_script('arguments[0].volume = arguments[1]', obj, value)
406
+ end
403
407
 
404
- # Return media preload property
405
- #
406
- # @return preload value
407
- # @example
408
- # preload = media_player.preload
409
- #
410
- def preload
411
- obj, = find_element
412
- object_not_found_exception(obj, @type)
413
- obj.native.attribute('preload')
408
+ # Return media preload property
409
+ #
410
+ # @return preload value
411
+ # @example
412
+ # preload = media_player.preload
413
+ #
414
+ def preload
415
+ obj, = find_element
416
+ object_not_found_exception(obj, @type)
417
+ obj.native.attribute('preload')
418
+ end
414
419
  end
415
420
  end
416
421
  end