Method: PageObject#in_iframe

Defined in:
lib/page-object.rb

#in_iframe(identifier, frame = nil, &block) ⇒ Object

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_iframe by passing the frame to the next level.

Examples:

in_iframe(:id => 'iframe_id') do |iframe|
  text_field_element(:id => 'ifname', :frame => iframe)
end

Parameters:

  • identifier (Hash)

    how we find the iframe. The valid keys are:

    • :id => Watir and Selenium

    • :index => Watir and Selenium

    • :name => Watir and Selenium

    • :class => Watir only

  • frame (defaults to: nil)

    passed from a previous call to in_iframe. Used to nest calls

  • block

    that contains the calls to elements that exist inside the iframe.



310
311
312
# File 'lib/page-object.rb', line 310

def in_iframe(identifier, frame=nil, &block)
  platform.in_iframe(identifier, frame, &block)
end