From f956bea7ddd8b5724bb8bcb1067095435d616a42 Mon Sep 17 00:00:00 2001 From: Noah Davis Date: Sat, 24 Jan 2009 01:36:58 -0500 Subject: [PATCH] Adding rescue from Webrat::TimeoutError in selenium matchers which allows NegativeMatchers to behave correctly --- History.txt | 1 + lib/webrat/selenium/matchers/have_content.rb | 2 ++ lib/webrat/selenium/matchers/have_selector.rb | 2 ++ lib/webrat/selenium/matchers/have_xpath.rb | 2 ++ 4 files changed, 7 insertions(+) diff --git a/History.txt b/History.txt index 2b338d4..0e07a0f 100644 --- a/History.txt +++ b/History.txt @@ -8,6 +8,7 @@ * Bug fixes + * rescue from Webrat::TimeoutError in selenium matchers which allows NegativeMatchers to behave correctly (Noah Davis) * Switch to using selenium.click instead of .check when checking a checkbox (Noah Davis) * Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney) diff --git a/lib/webrat/selenium/matchers/have_content.rb b/lib/webrat/selenium/matchers/have_content.rb index 5fa84f6..471493d 100644 --- a/lib/webrat/selenium/matchers/have_content.rb +++ b/lib/webrat/selenium/matchers/have_content.rb @@ -16,6 +16,8 @@ module Webrat response.session.wait_for do response.selenium.is_text_present(text_finder) end + rescue Webrat::TimeoutError + false end # ==== Returns diff --git a/lib/webrat/selenium/matchers/have_selector.rb b/lib/webrat/selenium/matchers/have_selector.rb index f7b394c..884dfdf 100644 --- a/lib/webrat/selenium/matchers/have_selector.rb +++ b/lib/webrat/selenium/matchers/have_selector.rb @@ -10,6 +10,8 @@ module Webrat response.session.wait_for do response.selenium.is_element_present("css=#{@expected}") end + rescue Webrat::TimeoutError + false end # ==== Returns diff --git a/lib/webrat/selenium/matchers/have_xpath.rb b/lib/webrat/selenium/matchers/have_xpath.rb index 40cf9b8..3498a9a 100644 --- a/lib/webrat/selenium/matchers/have_xpath.rb +++ b/lib/webrat/selenium/matchers/have_xpath.rb @@ -10,6 +10,8 @@ module Webrat response.session.wait_for do response.selenium.is_element_present("xpath=#{@expected}") end + rescue Webrat::TimeoutError + false end # ==== Returns