我收到一个错误未定义方法`visit&# 39;对于
require "selenium-webdriver"
require "rubygems"
require "cucumber"
require "capybara"
require 'capybara/rspec/matchers'
Capybara.default_driver = :selenium
答案 0 :(得分:1)
作为documented你需要要求' capybara / cucumber'将水豚dsl方法纳入黄瓜试验。如果您在执行此操作时遇到问题,则需要调用current_session上的所有方法,例如Capybara.current_session.visit('/')
。
答案 1 :(得分:0)
来自Capybara文档here,其他地方使用DSL
您可以使用此代码:
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