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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -12
- data/LICENSE.md +1 -1
- data/README.md +1794 -697
- data/lib/devices/devices.yml +144 -216
- data/lib/testcentricity_web/browser_helper.rb +33 -4
- data/lib/testcentricity_web/data_objects/environment.rb +96 -13
- data/lib/testcentricity_web/exception_queue_helper.rb +5 -6
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +53 -49
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +20 -11
- data/lib/testcentricity_web/web_core/page_section.rb +31 -34
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +379 -252
- data/lib/testcentricity_web/web_elements/audio.rb +6 -4
- data/lib/testcentricity_web/web_elements/button.rb +7 -4
- data/lib/testcentricity_web/web_elements/checkbox.rb +149 -147
- data/lib/testcentricity_web/web_elements/file_field.rb +38 -36
- data/lib/testcentricity_web/web_elements/image.rb +75 -70
- data/lib/testcentricity_web/web_elements/label.rb +6 -4
- data/lib/testcentricity_web/web_elements/link.rb +15 -13
- data/lib/testcentricity_web/web_elements/list.rb +171 -169
- data/lib/testcentricity_web/web_elements/media.rb +384 -379
- data/lib/testcentricity_web/web_elements/radio.rb +135 -133
- data/lib/testcentricity_web/web_elements/range.rb +16 -29
- data/lib/testcentricity_web/web_elements/select_list.rb +247 -245
- data/lib/testcentricity_web/web_elements/table.rb +575 -573
- data/lib/testcentricity_web/web_elements/textfield.rb +143 -139
- data/lib/testcentricity_web/web_elements/ui_element.rb +1171 -0
- data/lib/testcentricity_web/web_elements/video.rb +39 -37
- data/lib/testcentricity_web/world_extensions.rb +37 -4
- data/lib/testcentricity_web.rb +4 -23
- metadata +28 -80
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +0 -1148
@@ -1,416 +1,421 @@
|
|
1
1
|
module TestCentricity
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
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
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
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
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
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
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
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
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
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
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
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
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
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
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
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
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
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
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
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
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
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
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
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
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
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
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
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
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
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
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
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
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
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
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
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
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
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
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
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
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
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
|