4

I keep getting this error while switching from Selenium over to PhantomJs/Poltergeist. Anybody know what I'm doing wrong? If I switch out the driver to selenium, the script works perfectly. Whenever I comment out the default_driver = :selenium and replace with javascript_driver = :poltergeist I run into this error.

initialize': rack-test requires a rack application, but none was given (ArgumentError)

This is all in a ruby file, no rails.

require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require "open-uri"
# require "date"
# require 'active_support/core_ext/integer/inflections'
require 'capybara/poltergeist'
# require 'selenium-webdriver'
require 'pry'
require 'phantomjs'
# require 'database_cleaner'
Capybara.run_server = false
Capybara.javascript_driver = :poltergeist
# Capybara.default_driver = :selenium
Capybara.app_host = 'https://www.sameplsite.com'
module MyCapybaraTest
 class Test
 include Capybara::DSL
 def login_site
 visit('https://www.sameplsite.com')
 # binding.pry
 click_link('Log in')
 fill_in('email', :with => '[email protected]')
 fill_in('password', :with => 'passwordpassword')
 check('checkbox_remember')
 click_button('Log in')
 end
 def click_right_game
 click_link('Create Contest')
 all('.boxed')[1].click
 check('Free practice')
 click_link('Create 1 Head-to-Head')
 save_and_open_page
 end
 def output_game_link
 url = URI.parse(current_url)
 puts url
 end
 end
end
t = MyCapybaraTest::Test.new
t.login_fanduel
t.click_right_game
t.output_game_link
4ae1e1
7,7229 gold badges52 silver badges78 bronze badges
asked Jan 8, 2015 at 23:50

1 Answer 1

5

Capybara.javascript_driver = :poltergeist doesn't switch the driver. If you want to switch driver , use Capybara.current_driver instead. That says : Capybara.current_driver = :poltergeist

answered Jan 27, 2015 at 7:42
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.