Sha256: 6c64bfaa6f99bab73adabca589c1b1995e92db0a53875976adf0bd2f308ebd93

Contents?: true

Size: 908 Bytes

Versions: 5

Compression:

Stored size: 908 Bytes

Contents

require 'vapir-ie/ie-class'

module Vapir
  class IE
    # close all ie browser windows
    def self.close_all
      close_all_but nil
    end
    # find other ie browser windows and close them
    def close_others
      IE.close_all_but self
    end
    private
    def self.close_all_but(except=nil)
      Vapir::IE.each do |ie|
        ie.close_modal
        ie.close unless except and except.hwnd == ie.hwnd
      end
      sleep 1.0 # replace with polling for window count to be zero?
    end
    public
    # close modal dialog. unlike IE#modal_dialog.close, does not wait for dialog
    # to appear and does not raise exception if no window is found.
    # returns true if modal was found and close, otherwise false
    def close_modal
      modal_dialog=modal_dialog(:timeout => 0, :error => false)
      if modal_dialog && modal_dialog.exists?
        modal_dialog.close
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vapir-ie-1.7.2 lib/vapir-ie/close_all.rb
vapir-ie-1.7.1 lib/vapir-ie/close_all.rb
vapir-ie-1.7.1.rc1 lib/vapir-ie/close_all.rb
vapir-ie-1.7.0 lib/vapir-ie/close_all.rb
vapir-ie-1.7.0.rc1 lib/vapir-ie/close_all.rb