vitalie/webshot

Issue with connecting to some sites because of SSL

fabioaanthony opened this issue · 1 comments

Hey so nice gem. Issue I am having is rendering screenshots of some sites. Example github.com.

ws.capture 'http://github.com', 'github.png'
Webshot::WebshotError: Could not fetch page: "http://github.com", error code: 
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/webshot-0.0.7/lib/webshot/screenshot.rb:77:in `capture'
  from (irb):5
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/railties-4.2.0.beta2/lib/rails/commands/console.rb:110:in `start'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/railties-4.2.0.beta2/lib/rails/commands/console.rb:9:in `start'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:68:in `console'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `block in require'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:233:in `load_dependency'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
  from /Users/fabio/Sites/sevenzio/bin/rails:8:in `<top (required)>'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:242:in `load'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:242:in `block in load'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:233:in `load_dependency'
  from /Users/fabio/.rvm/gems/ruby-2.1.3/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:242:in `load'
  from /Users/fabio/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /Users/fabio/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from ws.capture 'http://google.com', 'google.png'

I ran into this issue before and the culprit was SSL certs with phantomjs. What you need to do is pass in the following options to phantomjs:

phantomjs --ignore-ssl-errors=true --ssl-protocol=any YOURSCRIPT

Since Capybara is controlling the phantomjs instance - I'm not sure how you would pass in those options.

@fabioanselmo It was fixed in v0.0.8.