mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Only FF needs the frame workaround
This commit is contained in:
parent
3692f5abf2
commit
5ca9b25685
2 changed files with 10 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue