Method: Watir::HasWindow#switch_window
- Defined in:
- lib/watir/has_window.rb
#switch_window ⇒ Window
Waits for and returns second window if present See Window#use
62 63 64 65 66 67 68 69 70 |
# File 'lib/watir/has_window.rb', line 62 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 |