#162 ✓out-of-date
Jeff Dean

response is nil in selenium mode

Reported by Jeff Dean | February 11th, 2009 @ 10:35 PM

When running cucumber with selenium, response is always nil for me. My current setup is:


  • webrat (0.4.1)
  • cucumber (0.1.16)
  • selenium-client (1.2.10)
  • rspec (1.1.12)
  • rspec-rails (1.1.12)
  • nokogiri (1.1.1)


ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support

require 'webrat' require 'webrat/rails'

require 'cucumber/rails/rspec' require 'webrat/rspec-rails' require 'webrat/core/matchers'

require 'fixjour' require 'faker'

require File.join(RAILS_ROOT, "spec", "object_creation_methods")

Dir["spec/spec_helpers/**/*.rb"].each do |file| require_dependency file # just a table truncation script end

include Fixjour include TruncateTables


require "webrat/selenium"

Webrat.configure do |config| config.mode = :selenium end

Before do truncate_tables! end

Executing with

cucumber -r features/support/env.rb -r features/support/selenium.rb -r features/step_definitions features/people.feature

When I run the command above, the browser opens, the "visit" steps work, clicking links works and all other action steps work, but response is nil. The error I get is:

Error Message

Then I should see "Please enter a search term and try again."
      You have a nil object when you didn't expect it!
      The error occurred while evaluating nil.body (NoMethodError)
      ./features/step_definitions/webrat_steps.rb:90:in `Then /^I should see "(.*)"$/'

When I run it in rails integration mode, the story passes. This worked a few days ago, and I must have upgraded some gem, or changed something in my environment but I can't figure out what. What version of selenium-rc is webrat selenium tested against?

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket