20
20
module Selenium
21
21
module Client
22
22
23
- # Provide a more idiomatic API than the generated Ruby driver.
24
- #
25
- # Work in progress...
23
+ # Provide a more idiomatic API than the generated Ruby driver.
24
+ #
25
+ # Work in progress...
26
26
module Idiomatic
27
27
28
28
# Return the text content of an HTML element (rendered text shown to
@@ -102,31 +102,31 @@ def wait_for_popup(window_id, timeout_in_seconds=nil)
102
102
def wait_for ( options )
103
103
if options [ :wait_for ] == :page
104
104
wait_for_page options [ :timeout_in_seconds ]
105
- elsif options [ :wait_for ] == :ajax
106
- wait_for_ajax options
107
- elsif options [ :wait_for ] == :element
108
- wait_for_element options [ :element ] , options
109
- elsif options [ :wait_for ] == :no_element
110
- wait_for_no_element options [ :element ] , options
111
- elsif options [ :wait_for ] == :text
112
- wait_for_text options [ :text ] , options
113
- elsif options [ :wait_for ] == :no_text
105
+ elsif options [ :wait_for ] == :ajax
106
+ wait_for_ajax options
107
+ elsif options [ :wait_for ] == :element
108
+ wait_for_element options [ :element ] , options
109
+ elsif options [ :wait_for ] == :no_element
110
+ wait_for_no_element options [ :element ] , options
111
+ elsif options [ :wait_for ] == :text
112
+ wait_for_text options [ :text ] , options
113
+ elsif options [ :wait_for ] == :no_text
114
114
wait_for_no_text options [ :text ] , options
115
- elsif options [ :wait_for ] == :effects
116
- wait_for_effects options
115
+ elsif options [ :wait_for ] == :effects
116
+ wait_for_effects options
117
117
elsif options [ :wait_for ] == :popup
118
- wait_for_popup options [ :window ] , options [ :timeout_in_seconds ]
119
- select_window options [ :window ] if options [ :select ]
118
+ wait_for_popup options [ :window ] , options [ :timeout_in_seconds ]
119
+ select_window options [ :window ] if options [ :select ]
120
120
elsif options [ :wait_for ] == :value
121
- wait_for_field_value options [ :element ] , options [ :value ] , options
121
+ wait_for_field_value options [ :element ] , options [ :value ] , options
122
122
elsif options [ :wait_for ] == :no_value
123
- wait_for_no_field_value options [ :element ] , options [ :value ] , options
123
+ wait_for_no_field_value options [ :element ] , options [ :value ] , options
124
124
elsif options [ :wait_for ] == :visible
125
- wait_for_visible options [ :element ] , options
125
+ wait_for_visible options [ :element ] , options
126
126
elsif options [ :wait_for ] == :not_visible
127
- wait_for_not_visible options [ :element ] , options
128
- elsif options [ :wait_for ] == :condition
129
- wait_for_condition options [ :javascript ] , options [ :timeout_in_seconds ]
127
+ wait_for_not_visible options [ :element ] , options
128
+ elsif options [ :wait_for ] == :condition
129
+ wait_for_condition options [ :javascript ] , options [ :timeout_in_seconds ]
130
130
end
131
131
end
132
132
@@ -206,7 +206,7 @@ def field(locator)
206
206
207
207
# Alias for +field+
208
208
def value ( locator )
209
- field locator
209
+ field locator
210
210
end
211
211
212
212
# Returns whether a toggle-button (checkbox/radio) is checked.
@@ -397,7 +397,7 @@ def cookie?(name)
397
397
# the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will usually fail.
398
398
def create_cookie ( name_value_pair , options = "" )
399
399
if options . kind_of? Hash
400
- options = options . keys . collect { |key | "#{ key } =#{ options [ key ] } " } . sort . join ( ", " )
400
+ options = options . keys . collect { |key | "#{ key } =#{ options [ key ] } " } . sort . join ( ", " )
401
401
end
402
402
remote_control_command "createCookie" , [ name_value_pair , options , ]
403
403
end
@@ -417,8 +417,8 @@ def create_cookie(name_value_pair, options="")
417
417
# 'optionsString' is options for the cookie. Currently supported options include 'path', 'domain' and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true". The order of options are irrelevant. Note that specifying a domain that isn't a subset of the current domain will usually fail.
418
418
def delete_cookie ( name , options = "" )
419
419
if options . kind_of? Hash
420
- ordered_keys = options . keys . sort { |a , b | a . to_s <=> b . to_s }
421
- options = ordered_keys . collect { |key | "#{ key } =#{ options [ key ] } " } . join ( ", " )
420
+ ordered_keys = options . keys . sort { |a , b | a . to_s <=> b . to_s }
421
+ options = ordered_keys . collect { |key | "#{ key } =#{ options [ key ] } " } . join ( ", " )
422
422
end
423
423
remote_control_command "deleteCookie" , [ name , options , ]
424
424
end
0 commit comments