lib/watir-webdriver/elements/iframe.rb in watir-webdriver-0.7.0 vs lib/watir-webdriver/elements/iframe.rb in watir-webdriver-0.8.0
- old
+ new
@@ -1,13 +1,12 @@
-# encoding: utf-8
module Watir
class IFrame < HTMLElement
def locate
@parent.assert_exists
- locator = locator_class.new(@parent.wd, @selector.merge(:tag_name => frame_tag), self.class.attribute_list)
+ locator = locator_class.new(@parent.wd, @selector.merge(tag_name: frame_tag), self.class.attribute_list)
element = locator.locate
element or raise UnknownFrameException, "unable to locate #{@selector[:tag_name]} using #{selector_string}"
FramedDriver.new(element, driver)
end
@@ -15,11 +14,11 @@
def switch_to!
locate.send :switch!
end
def assert_exists
- if @selector.has_key? :element
+ if @selector.key? :element
raise UnknownFrameException, "wrapping a WebDriver element as a Frame is not currently supported"
end
super
end
@@ -27,11 +26,11 @@
def html
assert_exists
# this will actually give us the innerHTML instead of the outerHTML of the <frame>,
# but given the choice this seems more useful
- element_call { execute_atom(:getOuterHtml, @element.find_element(:tag_name => "html")).strip }
+ element_call { execute_atom(:getOuterHtml, @element.find_element(tag_name: "html")).strip }
end
def execute_script(*args)
browser.execute_script(*args)
end
@@ -51,11 +50,11 @@
# In case `#all_elements` returns empty array, but `#elements`
# returns non-empty array (i.e. any frame has loaded between these two calls),
# index will return nil. That's why `#all_elements` should always
# be called after `#elements.`
element_indexes = elements.map { |el| all_elements.index(el) }
- element_indexes.map { |idx| element_class.new(@parent, tag_name: @selector[:tag_name], :index => idx) }
+ element_indexes.map { |idx| element_class.new(@parent, tag_name: @selector[:tag_name], index: idx) }
end
def element_class
IFrame
end
@@ -94,14 +93,14 @@
module Container
def frame(*args)
- Frame.new(self, extract_selector(args).merge(:tag_name => "frame"))
+ Frame.new(self, extract_selector(args).merge(tag_name: "frame"))
end
def frames(*args)
- FrameCollection.new(self, extract_selector(args).merge(:tag_name => "frame"))
+ FrameCollection.new(self, extract_selector(args).merge(tag_name: "frame"))
end
end # Container