Sha256: 849ce54e34288a692e012495a61f784ffddc280ce233862747891221ad9109c3
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
module Watir module HasWindow # # Returns browser windows array. # # @example # browser.windows(title: 'closeable window') # # @return [Array<Window>] # def windows(opts = {}) WindowCollection.new self, opts end # # Returns browser window. # # @example # browser.window(title: 'closeable window') # # @return [Window] # def window(opts = {}, &blk) win = Window.new self, opts win.use(&blk) if block_given? win end # # Returns original window if defined, current window if not # See Window#use # # @example # browser.window(title: 'closeable window').use # browser.original_window.use # # @return [Window] # def original_window @original_window ||= window end # # Waits for and returns second window if present # See Window#use # # @example # browser.switch_window # # @return [Window] # def switch_window current_window = window wins = windows wait_until { (wins = windows) && wins.size > 1 } if wins.size == 1 raise StandardError, 'Unable to determine which window to switch to' if wins.size > 2 wins.find { |w| w != current_window }.use window end end # HasWindow end # Watir
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
watir-7.0.0.beta1 | lib/watir/has_window.rb |