Question

been running into a really annoying problem with Poltergeist/cucumber usage. When trying to navigate to any page with a redirect (for example, our app has an immediate redirect to login), Poltergeist and PhantomJS are just sticking with a "Loading..." screen and never following the redirect.

I verified this by just hitting the login page redirect URL itself, and the page loaded fine and I was able to interact with it, but anytime another redirect happens, no matter how small, Poltergeist and PhantomJS stick again. Below is my env.rb file, with the configuration I'm using. If I toggle "--ignore-ssl-errors" to false, the page just displays "about:blank" instead, so that option is doing something.

Anybody who might have a solution will be my hero, as this is the last step we are encountering before having CI fully implemented for our system.

require "Capybara"
require "Capybara/cucumber"
require "rspec"
require 'capybara/poltergeist'

Capybara.default_driver = :poltergeist

Capybara.register_driver :poltergeist do |app|
    options = {
        :js_errors => false,
        :timeout => 120,
        :debug => false,
        :phantomjs_options => ['--load-images=no', '--disk-cache=false', '--ignore-ssl-errors=yes'],
        :inspector => true,
    }
    Capybara::Poltergeist::Driver.new(app, options)
end

Capybara.configure do |config|
    config.javascript_driver = :poltergeist
    config.app_host = "*our webpage*"
    config.run_server = false
    config.default_wait_time = 30
end

And my gemlist. I'm on Windows 7, if that helps, with the binary for PhantomJS for Windows 7 at version 1.9.2.

bigdecimal (1.2.0)
builder (3.2.2)
bundler (1.6.2)
capybara (2.2.1)
cellophane (0.1.3)
childprocess (0.5.3)
cliver (0.3.2)
cucumber (1.3.14)
diff-lcs (1.2.5)
ffi (1.9.3 x86-mingw32)
gherkin (2.12.2 x86-mingw32)
io-console (0.4.2)
json (1.7.7)
mime-types (2.2)
mini_portile (0.5.3)
minitest (4.3.2)
multi_json (1.9.2)
multi_test (0.1.1)
nokogiri (1.6.1 x86-mingw32)
poltergeist (1.5.0)
psych (2.0.0)
rack (1.5.2)
rack-test (0.6.2)
rake (0.9.6)
rdoc (4.0.0)
rspec (2.14.1)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
rspec-mocks (2.14.6)
rubyzip (1.1.3)
selenium-webdriver (2.41.0)
test-unit (2.0.0.0)
websocket (1.0.7)
websocket-driver (0.3.2)
xpath (2.0.0)
Was it helpful?

Solution 2

Unfortunately not a solution but it looks like you might have this problem here which is an open issue on their github, there doesn't appear to be a fix for it (the issue is still open and there aren't any suggestions), so if this is your problem you might have to switch to Selenium. Sorry.

OTHER TIPS

I ran into this problem very recently, and as indicated on the page linked to by Mike H-R, you might need to add '--local-to-remote-url-access=yes' to your phantomjs options.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top