lib/selenium/client/idiomatic.rb in selenium-webdriver-2.47.1 vs lib/selenium/client/idiomatic.rb in selenium-webdriver-2.48.0
- old
+ new
@@ -18,13 +18,13 @@
# under the License.
module Selenium
module Client
- # Provide a more idiomatic API than the generated Ruby driver.
- #
- # Work in progress...
+ # Provide a more idiomatic API than the generated Ruby driver.
+ #
+ # Work in progress...
module Idiomatic
# Return the text content of an HTML element (rendered text shown to
# the user). Works for any HTML element that contains text.
#
@@ -100,35 +100,35 @@
# Using options you can also define an explicit timeout (:timeout_in_seconds key). Otherwise the default driver timeout
# is used.
def wait_for(options)
if options[:wait_for] == :page
wait_for_page options[:timeout_in_seconds]
- elsif options[:wait_for] == :ajax
- wait_for_ajax options
- elsif options[:wait_for] == :element
- wait_for_element options[:element], options
- elsif options[:wait_for] == :no_element
- wait_for_no_element options[:element], options
- elsif options[:wait_for] == :text
- wait_for_text options[:text], options
- elsif options[:wait_for] == :no_text
+ elsif options[:wait_for] == :ajax
+ wait_for_ajax options
+ elsif options[:wait_for] == :element
+ wait_for_element options[:element], options
+ elsif options[:wait_for] == :no_element
+ wait_for_no_element options[:element], options
+ elsif options[:wait_for] == :text
+ wait_for_text options[:text], options
+ elsif options[:wait_for] == :no_text
wait_for_no_text options[:text], options
- elsif options[:wait_for] == :effects
- wait_for_effects options
+ elsif options[:wait_for] == :effects
+ wait_for_effects options
elsif options[:wait_for] == :popup
- wait_for_popup options[:window], options[:timeout_in_seconds]
- select_window options[:window] if options[:select]
+ wait_for_popup options[:window], options[:timeout_in_seconds]
+ select_window options[:window] if options[:select]
elsif options[:wait_for] == :value
- wait_for_field_value options[:element], options[:value], options
+ wait_for_field_value options[:element], options[:value], options
elsif options[:wait_for] == :no_value
- wait_for_no_field_value options[:element], options[:value], options
+ wait_for_no_field_value options[:element], options[:value], options
elsif options[:wait_for] == :visible
- wait_for_visible options[:element], options
+ wait_for_visible options[:element], options
elsif options[:wait_for] == :not_visible
- wait_for_not_visible options[:element], options
- elsif options[:wait_for] == :condition
- wait_for_condition options[:javascript], options[:timeout_in_seconds]
+ wait_for_not_visible options[:element], options
+ elsif options[:wait_for] == :condition
+ wait_for_condition options[:javascript], options[:timeout_in_seconds]
end
end
# Gets the entire text of the page.
def body_text
@@ -204,11 +204,11 @@
string_command "getValue", [locator,]
end
# Alias for +field+
def value(locator)
- field locator
+ field locator
end
# Returns whether a toggle-button (checkbox/radio) is checked.
# Fails if the specified element doesn't exist or isn't a toggle-button.
#
@@ -395,11 +395,11 @@
# 'nameValuePair' is name and value of the cookie in a format "name=value"
# 'optionsString' is options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'.
# 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.
def create_cookie(name_value_pair, options="")
if options.kind_of? Hash
- options = options.keys.collect {|key| "#{key}=#{options[key]}" }.sort.join(", ")
+ options = options.keys.collect {|key| "#{key}=#{options[key]}" }.sort.join(", ")
end
remote_control_command "createCookie", [name_value_pair,options,]
end
# Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you
@@ -415,11 +415,11 @@
#
# 'name' is the name of the cookie to be deleted
# '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.
def delete_cookie(name, options="")
if options.kind_of? Hash
- ordered_keys = options.keys.sort {|a,b| a.to_s <=> b.to_s }
- options = ordered_keys.collect {|key| "#{key}=#{options[key]}" }.join(", ")
+ ordered_keys = options.keys.sort {|a,b| a.to_s <=> b.to_s }
+ options = ordered_keys.collect {|key| "#{key}=#{options[key]}" }.join(", ")
end
remote_control_command "deleteCookie", [name,options,]
end
# Returns the IDs of all windows that the browser knows about.