module Capybara::Selenium::Driver::SafariDriver

def switch_to_frame(frame)

def switch_to_frame(frame)
  return super unless frame == :parent
  # safaridriver/safari has an issue where switch_to_frame(:parent)
  # behaves like switch_to_frame(:top)
  handles = @frame_handles[current_window_handle]
  browser.switch_to.default_content
  handles.tap(&:pop).each { |fh| browser.switch_to.frame(fh.native) }
end