Reputation: 69
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
Upvotes: 1
Views: 956
Reputation: 49950
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('/')
.
Upvotes: 1
Reputation: 26788
From the Capybara docs here there's a section using the DSL elsewhere
You can use this code:
require 'capybara/dsl'
# putting this at the top level will make capybara methods available everywhere
# you can put it in a module if you want to, well, modularize ...
include Capybara::DSL
Upvotes: 1