class Watir::IFrame

Public Instance Methods

execute_script(script, *args, function_name: nil) click to toggle source

Executes JavaScript snippet in context of frame.

@see Watir::Browser#execute_script

# File lib/watir/elements/iframe.rb, line 47
def execute_script(script, *args, function_name: nil)
  args.map! do |e|
    Watir.logger.info "Executing Script on Frame: #{function_name}" if function_name
    e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
  end
  returned = driver.execute_script(script, *args)

  browser.wrap_elements_in(self, returned)
end
html() click to toggle source

Returns HTML code of iframe.

@return [String]

# File lib/watir/elements/iframe.rb, line 29
def html
  wd.page_source
end
send_keys(*args) click to toggle source

Delegate sending keystrokes to FramedDriver

# File lib/watir/elements/iframe.rb, line 37
def send_keys(*args)
  wd.send_keys(*args)
end
switch_to!() click to toggle source

Move Driver context into the iframe

# File lib/watir/elements/iframe.rb, line 7
def switch_to!
  locate unless located?
  wd.switch!
end
text() click to toggle source

Returns text of iframe body. body ensures context so this method does not have to

@return [String]

# File lib/watir/elements/iframe.rb, line 19
def text
  body.text
end
to_subtype() click to toggle source

Cast this Element instance to a more specific subtype. Cached element needs to be the IFrame element, not the FramedDriver

Calls superclass method Watir::Element#to_subtype
# File lib/watir/elements/iframe.rb, line 73
def to_subtype
  super.tap { |el| el.cache = @element }
end
wd() click to toggle source

Provides access to underlying Selenium Objects as delegated by FramedDriver

@return [Watir::FramedDriver]

Calls superclass method Watir::Element#wd
# File lib/watir/elements/iframe.rb, line 63
def wd
  super
  FramedDriver.new(@element, browser)
end

Private Instance Methods

unknown_exception() click to toggle source
# File lib/watir/elements/iframe.rb, line 79
def unknown_exception
  UnknownFrameException
end