How to properly debug with Capybara/Poltergeist?

Viewed 4356

I am playing around with capybara/poltergeist perfect duo, but I am having trouble to properly debugging. I was testing a simple script:

logger = Logger.new "./log/who-scored-com.log"
Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, js_errors: false,
                                         debug: true,
                                         logger: logger)
end
browser = Capybara.current_session
browser.visit 'https://www.whoscored.com/LiveScores'
browser.save_page 'page.html'

I am expecting that the script grap the page normally and saves it, but the page is empty and this is returned:

`Capybara::Poltergeist::StatusFailError: Capybara::Poltergeist::StatusFailError
    from /home/vagrant/local/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/browser.rb:351:in `command'
    from /home/vagrant/local/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/browser.rb:34:in `visit'`

Now, this don't give me nothing about this error. I catch the exception and print it and it gives me:

"Request to 'https://www.whoscored.com/LiveScores' failed to reach server, check DNS and/or server status"

Even if I have no idea why the address do not respond for capybara (and any hint would be appreciate :) ) I don't understand why the :debug options used in configuration doesn't seem to give me no info

3 Answers
Related