diff --git a/README.rdoc b/README.rdoc
index 2d22fedd..30496687 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -66,11 +66,15 @@ You can change the driver temporarily:
Capybara.current_driver = :culerity
Capybara.use_default_driver
+You can do this in Before and After blocks to temporarily switch to a different
+driver. Note that switching driver creates a new session, so you may not be able
+to switch in the middle of a Scenario.
+
== Cucumber and Tags
Capybara sets up some {tags}[http://wiki.github.com/aslakhellesoy/cucumber/tags]
-for you to use in Cucumber. Often you'll want to use run only some scenarios
-with a driver that supports JavaScript, Capybara makes this easy: simply tag the
+for you to use in Cucumber. Often you'll want to run only some scenarios with a
+driver that supports JavaScript, Capybara makes this easy: simply tag the
scenario (or feature) with @javascript:
@javascript
@@ -82,8 +86,8 @@ You can change which driver Capybara uses for JavaScript:
Capybara.javascript_driver = :culerity
-There are also explicit @selenium, @culerity and @rack_test tags set up
-for you.
+There are also explicit @selenium, @culerity and
+@rack_test tags set up for you.
== The API
@@ -190,8 +194,8 @@ moving from Webrat and used CSS a lot, or simply generally prefer CSS:
{default_url_options}[https://gist.github.com/643a758320a2926bd2ed] in Rails
for example.
-* The set_hidden_field method from Webrat is not implemented, since it doesn't
- work in any of the browser based drivers (Culerity, Selenium)
+* The set_hidden_field method from Webrat is not implemented, since it
+ doesn't work in any of the browser based drivers (Culerity, Selenium)
* Access to session, request and response from the test is not possible. Maybe
we'll do response headers at some point in the future, but the others really
diff --git a/lib/capybara/driver/base.rb b/lib/capybara/driver/base.rb
index 559a6c66..ae551959 100644
--- a/lib/capybara/driver/base.rb
+++ b/lib/capybara/driver/base.rb
@@ -11,6 +11,10 @@ class Capybara::Driver::Base
raise "Not implemented"
end
+ def evaluate_script(script)
+ raise Capybara::NotSupportedByDriverError
+ end
+
def wait?
false
end
diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb
index 941b1cdd..66883421 100644
--- a/lib/capybara/session.rb
+++ b/lib/capybara/session.rb
@@ -44,9 +44,9 @@ module Capybara
end
def drag(source_locator, target_locator)
- source = find(source_locator)
+ source = wait_for(source_locator)
raise Capybara::ElementNotFound, "drag source '#{source_locator}' not found on page" unless source
- target = find(target_locator)
+ target = wait_for(target_locator)
raise Capybara::ElementNotFound, "drag target '#{target_locator}' not found on page" unless target
source.drag_to(target)
end
@@ -171,11 +171,7 @@ module Capybara
end
def evaluate_script(script)
- begin
- driver.evaluate_script(script)
- rescue NoMethodError
- raise NotSupportedByDriverError
- end
+ driver.evaluate_script(script)
end
private