Search code examples
ruby-on-railsseleniumcapybararspec-rails

How to use capybara console with google chrome and firefox too?


I would like to use capybara-console with google chrome and firefox too. If I run my test with rspec, I use environment variable JS_DRIVER=chrome or firefox and it works good. I would like to use this semantics too when I start my capybara-console. I tried a lot of settings, but my commands in console run only in firefox. So I want to use this. JS_DRIVER=chrome rake capypara:console or JS_DRIVER=firefox rake capypara:console


Solution

  • You need to add a rake task named capybara:prepare_console that sets Capybara.default_driver (maybe Capybara.current_driver) based on ENV['JS_DRIVER']