I keep getting this error when switching from Selenium to PhantomJs/Poltergeist. Does anyone know what I'm doing wrong? If I turn off the driver for selenium, the script works fine. Whenever I comment default_driver = :seleniumand replace with javascript_driver = :poltergeist, I come across this error.
initialize': rack-test requires a rack application, but none was given (ArgumentError)
This is all in a ruby file, without rails.
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require "open-uri"
require 'capybara/poltergeist'
require 'pry'
require 'phantomjs'
Capybara.run_server = false
Capybara.javascript_driver = :poltergeist
Capybara.app_host = 'https://www.sameplsite.com'
module MyCapybaraTest
class Test
include Capybara::DSL
def login_site
visit('https://www.sameplsite.com')
click_link('Log in')
fill_in('email', :with => 'joefrank@sharklasers.com')
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
source
share