Only FF needs the frame workaround

This commit is contained in:
Thomas Walpole 2018-09-11 11:15:07 -07:00
parent 3692f5abf2
commit 5ca9b25685
2 changed files with 10 additions and 4 deletions

View File

@ -143,11 +143,8 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
handles.clear
browser.switch_to.default_content
when :parent
# would love to use browser.switch_to.parent_frame here
# but it has an issue if the current frame is removed from within it
handles.pop
browser.switch_to.default_content
handles.each { |fh| browser.switch_to.frame(fh) }
browser.switch_to.parent_frame
else
handles << frame.native
browser.switch_to.frame(frame.native)

View File

@ -32,6 +32,15 @@ module Capybara::Selenium::Driver::MarionetteDriver
# No modal was opened - page has refreshed - ignore
end
def switch_to_frame(frame)
return super unless frame == :parent
# geckodriver/firefox has an issue if the current frame is removed from within it
# so we have to move to the default_content and iterate back through the frames
handles = @frame_handles[current_window_handle]
browser.switch_to.default_content
handles.tap(&:pop).each { |fh| browser.switch_to.frame(fh) }
end
private
def build_node(native_node)