diff --git a/History.txt b/History.txt index ea24c9ea..f86dd3e8 100644 --- a/History.txt +++ b/History.txt @@ -12,6 +12,7 @@ CHANGED: Due to a reorganization, if you're currently requiring "webrat/rspec-ra * Minor enhancements + * When a timeout occurs in wait_for, include the HTML from Selenium in the exception * Update the Merb support to be based directly on Rack (Simon Rozet) * Support multiple select fields (Kieran P) * When locating select options, always match against text, not HTML diff --git a/lib/webrat/selenium/selenium_session.rb b/lib/webrat/selenium/selenium_session.rb index 16d1ac92..7d445064 100644 --- a/lib/webrat/selenium/selenium_session.rb +++ b/lib/webrat/selenium/selenium_session.rb @@ -169,7 +169,19 @@ def wait_for(params={}) sleep 0.25 end - raise Webrat::TimeoutError.new(message + " (after #{timeout} sec)") + error_message = "#{message} (after #{timeout} sec)" + + if $browser + error_message += <<-EOS + + +HTML of the page was: + +#{selenium.get_html_source}" +EOS + end + + raise Webrat::TimeoutError.new(error_message) true end