lib/page-object/accessors.rb in page-object-0.8.6 vs lib/page-object/accessors.rb in page-object-0.8.6.1
- old
+ new
@@ -192,10 +192,11 @@
# * :css => Selenium only
# * :id => Watir and Selenium
# * :index => Watir and Selenium
# * :name => Watir and Selenium
# * :xpath => Watir and Selenium
+ # * :label => Watir and Selenium
# @param optional block to be invoked when element method is called
#
def text_area(name, identifier={:index => 0}, &block)
define_method(name) do
return platform.text_area_value_for identifier.clone unless block_given?
@@ -229,10 +230,11 @@
# * :index => Watir and Selenium
# * :name => Watir and Selenium
# * :text => Watir only
# * :value => Watir only
# * :xpath => Watir and Selenium
+ # * :label => Watir and Selenium
# @param optional block to be invoked when element method is called
#
def select_list(name, identifier={:index => 0}, &block)
define_method(name) do
return platform.select_list_value_for identifier.clone unless block_given?
@@ -240,16 +242,16 @@
end
define_method("#{name}=") do |value|
return platform.select_list_value_set(identifier.clone, value) unless block_given?
self.send("#{name}_element").select(value)
end
-
+
define_method("#{name}_options") do
element = self.send("#{name}_element")
(element && element.options) ? element.options.collect(&:text) : []
end
-
+
standard_methods(name, identifier, 'select_list_for', &block)
end
alias_method :select, :select_list
#
@@ -305,10 +307,11 @@
# * :id => Watir and Selenium
# * :index => Watir and Selenium
# * :name => Watir and Selenium
# * :value => Watir and Selenium
# * :xpath => Watir and Selenium
+ # * :label => Watir and Selenium
# @param optional block to be invoked when element method is called
#
def checkbox(name, identifier={:index => 0}, &block)
define_method("check_#{name}") do
return platform.check_checkbox(identifier.clone) unless block_given?
@@ -345,10 +348,11 @@
# * :id => Watir and Selenium
# * :index => Watir and Selenium
# * :name => Watir and Selenium
# * :value => Watir and Selenium
# * :xpath => Watir and Selenium
+ # * :label => Watir and Selenium
# @param optional block to be invoked when element method is called
#
def radio_button(name, identifier={:index => 0}, &block)
define_method("select_#{name}") do
return platform.select_radio(identifier.clone) unless block_given?
@@ -857,10 +861,11 @@
# * :id => Watir and Selenium
# * :index => Watir and Selenium
# * :name => Watir and Selenium
# * :title => Watir and Selenium
# * :xpath => Watir and Selenium
+ # * :label => Watir and Selenium
# @param optional block to be invoked when element method is called
#
def file_field(name, identifier={:index => 0}, &block)
define_method("#{name}=") do |value|
return platform.file_field_value_set(identifier.clone, value) unless block_given?
@@ -1116,10 +1121,10 @@
define_method("#{name}?") do
return call_block(&block).exists? if block_given?
platform.send(method, identifier.clone).exists?
end
end
-
+
#
# adds a method that will return an indexed property. The property will respond to
# the [] method with an object that has a set of normal page_object properties that
# correspond to the definitions included in the identifier_list parameter, with the
# "what" of the "how and what" substituted based on the index provided to the []