Use Chrome with Cucumber & Capybara
Photo by Tambako the Jaguar, used under Creative Commons https://flic.kr/p/dJD2dV
Step 1 - Tell Capybara about Chrome
features/support/env.rb add these lines:
Step 2 - Install chromedriver
If you’re using homebrew on OS X (and why wouldn’t you?) simply install using:
brew install chromedriver
Otherwise, download it manually and make sure it is in your path (I typically put it in
Step 3 - Run the features
Run your features and anything tagged with
@selenium is now running in Chrome instead of Firefox. Yay!
Thanks mate, this works fiine, but do you know how to override the user agent of the chrome browser? i’ve seen alot of tutorials but only with Firefox, but i much rather do it with chrome browser.
@glenn: see https://makandracards.com/makandra/8381-run-chrome-in-a-specific-resolution-or-user-agent-with-selenium.
no able to find inner html of an element
not able o get value “Hello World”
Using cucumber, capybara and crome driver
All Latest versions
Does not work on mavricks
My env.rb looks like this:
Capybara.default_selector = :css
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome, :switches => %w[–test-type]) #comment it out!!!
ActionController::Base.allow_rescue = false
DatabaseCleaner.strategy = :transaction
raise “You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.”
that’s the parts that are not commented out anyway. It works great. I would like to test in firefox as well, and ideally eventually with other browsers. How do I switch back to firefox?
You completed a few nice points there. I did a search on the theme and found nearly all persons will consent with your blog.
Thank you!!!! I did not install Mercury Reader because I use Firefox but it has an add on simply titled “Reader” and it is fantastic. Your article motivated me to look it up.