Joe12 Joe12 - 1 year ago 185
Ruby Question

undefined method `visit' for #<Object (NoMethodError) capybara rspec

I am getting an error undefined method `visit' for

require "selenium-webdriver"
require "rubygems"
require "cucumber"
require "capybara"
require 'capybara/rspec/matchers'
Capybara.default_driver = :selenium

Answer Source

As documented you need to require 'capybara/cucumber' to include the capybara dsl methods into cucumber tests. If you have an issue with doing that you'd need to call all the methods on current_session like Capybara.current_session.visit('/').

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download