lib/page-object/accessors.rb in page-object-0.2 vs lib/page-object/accessors.rb in page-object-0.2.1

- old
+ new

@@ -1,17 +1,16 @@ - module PageObject # # Contains the class level methods that are inserted into your page objects # when you include the PageObject module. These methods will generate another # set of methods that provide access to the elements on the web pages. # # @see PageObject::WatirPageObject for the watir implementation of the platform delegate # @see PageObject::SeleniumPageObject for the selenium implementation of the platform delegate # module Accessors - + # # Specify the url for the page. A call to this method will generate a # 'goto' method to take you to the page. # # @param [String] the url for the page. @@ -19,11 +18,11 @@ def page_url(url) define_method("goto") do platform.navigate_to url end end - + # # adds three methods to the page object - one to set text in a text field, # another to retrieve text from a text field and another to return the text # field element. # @@ -54,11 +53,11 @@ end define_method("#{name}_text_field") do block ? block.call(browser) : platform.text_field_for(identifier.clone) end end - + # # adds two methods to the page object - one to get the text from a hidden field # and another to retrieve the hidden field element. # # @example @@ -84,11 +83,11 @@ end define_method("#{name}_hidden_field") do block ? block.call(browser) : platform.hidden_field_for(identifier.clone) end end - + # # adds three methods to the page object - one to set text in a text area, # another to retrieve text from a text area and another to return the text # area element. # @@ -182,11 +181,11 @@ end define_method("#{name}_link") do block ? block.call(browser) : platform.link_for(identifier.clone) end end - + # # adds four methods - one to check, another to uncheck, another # to return the state of a checkbox, and a final method to return # a PageObject::Elements::CheckBox object representing the checkbox. # @@ -216,11 +215,11 @@ end define_method("#{name}_checkbox") do block ? block.call(browser) : platform.checkbox_for(identifier.clone) end end - + # # adds four methods - one to select, another to clear, # another to return if a radio button is selected, and # another method to return a PageObject::Elements::RadioButton # object representing the radio button element @@ -244,11 +243,11 @@ platform.select_radio(identifier.clone) end define_method("clear_#{name}") do platform.clear_radio(identifier.clone) end - define_method("#{name}_selected?") do + define_method("#{name}_selected?") do platform.radio_selected?(identifier.clone) end define_method("#{name}_radio_button") do block ? block.call(browser) : platform.radio_button_for(identifier.clone) end @@ -279,11 +278,11 @@ end define_method("#{name}_button") do block ? block.call(browser) : platform.button_for(identifier.clone) end end - + # # adds two methods - one to retrieve the text from a div # and another to return the div element # # @example @@ -295,10 +294,11 @@ # by combining of any of the following except xpath. The valid keys are: # * :class => Watir and Selenium # * :id => Watir and Selenium # * :index => Watir and Selenium # * :name => Watir and Selenium + # * :text => Watir and Selenium # * :xpath => Watir and Selenium # @param optional block to be invoked when element method is called # def div(name, identifier=nil, &block) define_method(name) do @@ -356,11 +356,11 @@ def table(name, identifier=nil, &block) define_method("#{name}_table") do block ? block.call(browser) : platform.table_for(identifier.clone) end end - + # # adds two methods one to retrieve the text from a table cell # and another to return the table cell element # # @example @@ -383,11 +383,11 @@ end define_method("#{name}_cell") do block ? block.call(browser) : platform.cell_for(identifier.clone) end end - + # # adds a method to retrieve the image element # # @example # image(:logo, :id => 'logo') @@ -406,11 +406,11 @@ def image(name, identifier=nil, &block) define_method("#{name}_image") do block ? block.call(browser) : platform.image_for(identifier.clone) end end - + # # adds a method to retrieve the form element # # @example # form(:login, :id => 'login') @@ -428,11 +428,11 @@ def form(name, identifier=nil, &block) define_method("#{name}_form") do block ? block.call(browser) : platform.form_for(identifier.clone) end end - + # # adds two methods - one to retrieve the text from a list item # and another to return the list item element # # @example @@ -455,11 +455,11 @@ end define_method("#{name}_list_item") do block ? block.call(browser) : platform.list_item_for(identifier.clone) end end - + # # adds a method to retrieve the unordered list element # # @example # unordered_list(:menu, :id => 'main_menu') @@ -478,10 +478,10 @@ def unordered_list(name, identifier=nil, &block) define_method("#{name}_unordered_list") do block ? block.call(browser) : platform.unordered_list_for(identifier.clone) end end - + # # adds a method to retrieve the ordered list element # # @example # ordered_list(:top_five, :id => 'top')