Module: Watir::WindowSwitching

Included in:
Browser
Defined in:
lib/watir-webdriver/window_switching.rb

Instance Method Summary collapse

Instance Method Details

#window(*args, &blk) ⇒ Object


16
17
18
19
20
21
22
23
24
# File 'lib/watir-webdriver/window_switching.rb', line 16

def window(*args, &blk)
  win = filter_windows(args, windows, :find)

  if win && block_given?
    win.use(&blk)
  end

  win
end

#windows(*args) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
# File 'lib/watir-webdriver/window_switching.rb', line 4

def windows(*args)
  wins = @driver.window_handles.map do |id|
    Window.new(@driver, id)
  end

  if args.empty?
    wins
  else
    filter_windows(args, wins, :select)
  end
end