lib/page-object/accessors.rb in page-object-0.9.5 vs lib/page-object/accessors.rb in page-object-0.9.6
- old
+ new
@@ -131,11 +131,11 @@
self.respond_to? "#{element_name}_element" and self.send("#{element_name}_element").when_visible timeout
end
end
#
- # Identify an element as existing within a frame or iframe. A frame parameter
+ # Identify an element as existing within a frame . A frame parameter
# is passed to the block and must be passed to the other calls to PageObject.
# You can nest calls to in_frame by passing the frame to the next level.
#
# @example
# in_frame(:id => 'frame_id') do |frame|
@@ -150,10 +150,34 @@
# @param frame passed from a previous call to in_frame. Used to nest calls
# @param block that contains the calls to elements that exist inside the frame.
#
def in_frame(identifier, frame=nil, &block)
frame = [] if frame.nil?
- frame << identifier
+ frame << {frame: identifier}
+ block.call(frame)
+ end
+
+ #
+ # Identify an element as existing within an iframe. A frame parameter
+ # is passed to the block and must be passed to the other calls to PageObject.
+ # You can nest calls to in_frame by passing the frame to the next level.
+ #
+ # @example
+ # in_iframe(:id => 'frame_id') do |frame|
+ # text_field(:first_name, :id => 'fname', :frame => frame)
+ # end
+ #
+ # @param [Hash] identifier how we find the frame. The valid keys are:
+ # * :id => Watir and Selenium
+ # * :index => Watir and Selenium
+ # * :name => Watir and Selenium
+ # * :regexp => Watir only
+ # @param frame passed from a previous call to in_iframe. Used to nest calls
+ # @param block that contains the calls to elements that exist inside the iframe.
+ #
+ def in_iframe(identifier, frame=nil, &block)
+ frame = [] if frame.nil?
+ frame << {iframe: identifier}
block.call(frame)
end
#
# adds four methods to the page object - one to set text in a text field,