class Watir::IFrame

Public Instance Methods

assert_exists() click to toggle source
Calls superclass method Watir::Element#assert_exists
# File lib/watir-webdriver/elements/iframe.rb, line 22
def assert_exists
  if @selector.key? :element
    raise UnknownFrameException, "wrapping a WebDriver element as a Frame is not currently supported"
  end

  super
end
execute_script(*args) click to toggle source
# File lib/watir-webdriver/elements/iframe.rb, line 51
def execute_script(*args)
  browser.execute_script(*args)
end
html() click to toggle source

Returns HTML code of iframe.

@return [String]

# File lib/watir-webdriver/elements/iframe.rb, line 46
def html
  assert_exists
  wd.page_source
end
locate() click to toggle source
# File lib/watir-webdriver/elements/iframe.rb, line 4
def locate
  @parent.assert_exists

  selector = @selector.merge(tag_name: frame_tag)
  element_validator = element_validator_class.new
  selector_builder = selector_builder_class.new(@parent, selector, self.class.attribute_list)
  locator = locator_class.new(@parent, selector, selector_builder, element_validator)

  element = locator.locate
  element or raise UnknownFrameException, "unable to locate #{@selector[:tag_name]} using #{selector_string}"

  FramedDriver.new(element, driver)
end
switch_to!() click to toggle source
# File lib/watir-webdriver/elements/iframe.rb, line 18
def switch_to!
  locate.send :switch!
end
text() click to toggle source

Returns text of iframe body.

@return [String]

# File lib/watir-webdriver/elements/iframe.rb, line 36
def text
  body.text
end

Private Instance Methods

frame_tag() click to toggle source
# File lib/watir-webdriver/elements/iframe.rb, line 57
def frame_tag
  'iframe'
end