Sha256: 9f4310e5e4b62c018e3c30145925f4e89aa3a746e94a8c0007e1e3bac4001be5
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
module Watir module HasWindow # # Returns browser windows array. # # @example # browser.windows(title: 'closeable window') # # @return [Array<Window>] # def windows(*args) WindowCollection.new self, extract_selector(args) end # # Returns browser window. # # @example # browser.window(title: 'closeable window') # # @return [Window] # def window(*args, &blk) win = Window.new self, extract_selector(args) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
watir-6.19.1 | lib/watir/has_window.rb |
watir-6.19.0 | lib/watir/has_window.rb |
watir-6.18.0 | lib/watir/has_window.rb |