How to easily switch between Webrat and Selenium?

333 views Asked by At

Please let me know how can I easily switch between Webrat and Selinium? Selinium takes longer as it simulates by opening the real browser. In some cases I do not need this and just Webrat, showing results in command line is just fine and faster. Is there anyway to configure cucumber to switch between Webrat and Selenium??

2

There are 2 answers

0
Mark Thomas On BEST ANSWER

Capybara is designed to be a webrat replacement, and it supports multiple back-end drivers (including Selenium) and you can switch between them, even during a test run. For example, maybe you want most of your tests to run fast but some require ajax testing / cross-browser testing and for those you can switch to Selenium.

1
Tyler K On

There are a number of ways to accomplish this. But the easiest is:

Tag individual files/Scenarios with @selenium to invoke selenium and then use @javascript as your default driver which uses webrat as the default driver, if I recall correctly.

This will only call Selenium when you invoke it directly.