lib/watir-webdriver/window_switching.rb in watir-webdriver-0.2.0.dev vs lib/watir-webdriver/window_switching.rb in watir-webdriver-0.2.0.dev2
- old
+ new
@@ -1,11 +1,8 @@
module Watir
module WindowSwitching
- class NoMatchingWindowFoundException < StandardError
- end
-
def windows(*args)
all = @driver.window_handles.map { |handle| Window.new(@driver, :handle => handle) }
if args.empty?
all
@@ -60,11 +57,11 @@
end
def exists?
handle
true
- rescue NoMatchingWindowFoundException
+ rescue Exception::NoMatchingWindowFoundException
false
end
alias_method :present?, :exists? # for Wait::EventuallyPresent
def ==(other)
@@ -120,10 +117,10 @@
def locate
handle = @driver.window_handles.find { |handle|
matches?(handle)
}
- handle or raise NoMatchingWindowFoundException, @selector.inspect
+ handle or raise Exception::NoMatchingWindowFoundException, @selector.inspect
end
def matches?(handle)
@driver.switch_to.window(handle) {
matches_title = @selector[:title].nil? || @selector[:title] === @driver.title