class Cornucopia::Capybara::PageDiagnostics::WindowIterator
Public Class Methods
new(window_handles, current_window, diagnostics)
click to toggle source
# File lib/cornucopia/capybara/page_diagnostics.rb, line 108 def initialize(window_handles, current_window, diagnostics) @window_handles = window_handles @current_window = current_window @diagnostics = diagnostics end
Public Instance Methods
each(&block)
click to toggle source
# File lib/cornucopia/capybara/page_diagnostics.rb, line 114 def each(&block) begin @diagnostics.allow_other_windows = false if @window_handles.length > 1 @window_handles.each do |window_handle| unless @current_window && @current_window == window_handle switched = @diagnostics.execute_driver_function(:switch_to_window, "could not switch windows", window_handle) if switched != "could not switch windows" block.yield @diagnostics end end end end ensure @diagnostics.allow_other_windows = true @diagnostics.execute_driver_function(:switch_to_window, "could not switch windows", @current_window) end end