lib/watir-webdriver/elements/frame.rb in watir-webdriver-0.3.1 vs lib/watir-webdriver/elements/frame.rb in watir-webdriver-0.3.2

- old
+ new

@@ -16,11 +16,18 @@ def assert_exists if @selector.has_key? :element raise UnknownFrameException, "wrapping a WebDriver element as a Frame is not currently supported" end - @element = nil # we need to re-locate every time + if @element && !Watir.always_locate? + begin + @element.tag_name # rpc + return @element + rescue Selenium::WebDriver::Error::ObsoleteElementError + @element = nil # re-locate + end + end super end def html @@ -46,16 +53,20 @@ end private def locate_iframe - # hack - Frame doesn't have IFrame's attributes either - IFrame.new(@parent, @selector.merge(:tag_name => "iframe")).locate + locator = locator_class.new(@parent.wd, @selector.merge(:tag_name => "iframe"), attribute_list) + locator.locate end def locate_frame - locator = locator_class.new(@parent.wd, @selector.merge(:tag_name => "frame"), self.class.attribute_list) + locator = locator_class.new(@parent.wd, @selector.merge(:tag_name => "frame"), attribute_list) locator.locate + end + + def attribute_list + self.class.attribute_list | IFrame.attribute_list end end # Frame module Container def frame(*args)