lib/watir/frame.rb in watir-1.8.1 vs lib/watir/frame.rb in watir-1.9.0.rc1
- old
+ new
@@ -15,11 +15,20 @@
['FRAME', 'IFRAME'].each do |frame_tag|
locator.tag = frame_tag
located_frame, document = locator.locate
unless (located_frame.nil? && document.nil?)
@o = located_frame
- @document = document.document
+ begin
+ @document = document.document
+ rescue WIN32OLERuntimeError => e
+ if e.message =~ /Access is denied/
+ # This frame's content is not directly accessible but let the
+ # user continue so they can access the frame properties
+ else
+ raise e
+ end
+ end
break
end
end
end
end
@@ -36,10 +45,14 @@
copy_test_config container
end
def document
assert_exists
- @document
+ if @document
+ @document
+ else
+ raise FrameAccessDeniedException, "IE will not allow access to this frame for security reasons. You can work around this with ie.goto(frame.src)"
+ end
end
def attach_command
@container.page_container.attach_command + ".frame(#{@how.inspect}, #{@what.inspect})".gsub('"','\'')
end
\ No newline at end of file