vitalie/webshot

Poltergeist timeout

AlreadyTalk opened this issue · 11 comments

Good morning,
I have a issue with the webshot.
I'm running the project in my local machine. I try to take a screenshot from my webpage, it gives my a time out from the poltergeist. If I try to take a the same page screenshot from the same page, but in some associate instance, doesn't give me the time out.
I look for the answer in other forums and nothing.
Can someone help me please?
I'm using Poltergeist, Capybara and PhantomJS

Hi,

Check that you have enough CPU, RAM & bandwidth on your machine, also check that you can open the page from another browser.

Regards,
Vitalie

Hello. Yes I can open the page on all the browsers in my local machine, and from my associate machine too. I just can't take the screenshot.

Hey,

Facing the same issue, any update on this ??

BTW I am getting this on my terminal

Webshot::WebshotError: Capybara error: "Timed out waiting for response to {\"name\":\"visit\",\"args\":[\"http://www.google.com/\"]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker."
    from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@heroku1/gems/webshot-0.0.7/lib/webshot/screenshot.rb:81:in `rescue in capture'
    from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@heroku1/gems/webshot-0.0.7/lib/webshot/screenshot.rb:30:in `capture'
    from (irb):2
    from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@heroku1/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@heroku1/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@heroku1/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Same here:

Webshot::WebshotError: Capybara error: "Timed out waiting for response to {\"name\":\"visit\",\"args\":[\"http://seocracking.blogspot.com/\"]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker."

ruby 2.0
phantomjs 1.9.7
webshot 0.0.7
capybara 2.4.3
poltergeist 1.5.1
ubuntu 14.04.1 LTS

It works fine with most of the other sites though.

@AlreadyTalk @manoj2411 @arsenische

I'll take a look at this today.

Thank you!

Yep same here. : ( It seems that timeout is hard to recover from.

rgo commented

It's not the solution for the timeouts(I think it is a poltergeist/phantomJS problem) but it can helps to mitigate it.

@vitalie: You implemented a timeout with sleep in the capture method. You can set it very high to avoid the timeouts but it's a pain to wait for working URLs

I was thinking in replace the sleep with this code:

def wait_until
  require "timeout"
  Timeout.timeout(Capybara.default_wait_time) do
    sleep(0.1) until value = yield
    value
  end
end

Code from: https://gist.github.com/jnicklas/d8da686061f0a59ffdf7

But instead of getting the value from a yield get it from the "visit url" or "page.driver.status_code"

What do you think?

Yep same here. : (

Any fix yet?

rgo commented

@mrdougwright have you tried with latest version(0.1.0)?

It upgrades poltergeist and allows to requires phantomjs to 2.x. If I'm not mistaken timeout problem was solved since this phantomjs version.

Regards

Yes, and still getting timeout. I may open separate issue as I'm now seeing the webshots misplaced when called repeatedly from an each block.