lib/watir-webdriver/has_window.rb in watir-webdriver-0.6.1 vs lib/watir-webdriver/has_window.rb in watir-webdriver-0.6.2

- old
+ new

@@ -1,17 +1,38 @@ module Watir module HasWindow + + # + # Returns browser windows array. + # + # @example + # browser.a(:id => "open_new_window").click + # browser.windows(:title => "new") + # + # @return [Array<Window>] + # + def windows(*args) all = @driver.window_handles.map { |handle| Window.new(@driver, :handle => handle) } if args.empty? all else filter_windows extract_selector(args), all end end + # + # Returns browser window. + # + # @example + # browser.a(:id => "open_new_window").click + # browser.window(:title => "new") + # + # @return [Window] + # + def window(*args, &blk) win = Window.new @driver, extract_selector(args) win.use(&blk) if block_given? @@ -27,7 +48,8 @@ windows.select do |win| selector.all? { |key, value| value === win.send(key) } end end - end # WindowSwitching + + end # HasWindow end # Watir