-1

I am creating nodejs application which uses phantomjs to capture website image. Phantomjs is taking too much loading time while taking screenshots. Is it possible to use single instance or previously loaded phantomjs to take new screenshots. Actually, i was using grunt task to take screenshot of website. Everytime i run this task, it is taking so long to render website and i think keeping phantomjs instance alive would decrease time.

degendra
  • 335
  • 1
  • 4
  • 11
  • It seems you have a problem with your code, but you haven't shown it. We can't help you without it. Please provide a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Artjom B. Sep 20 '15 at 15:16
  • Actually, i was using grunt task to take screenshot of website. Everytime i run this task, it is taking so long to render website and i think keeping phantomjs instance alive would decrease time. I might be wrong. – degendra Sep 20 '15 at 15:26
  • I haven't used gruntjs, but I don't think it is possible without completely rewriting everything. If I understand you correctly you want to somehow keep the PhantomJS instance alive across multiple invocations from the commandline. Is this what you mean or do you somehow invoke the same task multiple times within one grunt run? In any case, you need to provide at least some code. At the very least your gruntjs configuration. – Artjom B. Sep 20 '15 at 15:32
  • Sure, just pass all the urls to phantomjs up front and let it do them one at a time. – pguardiario Sep 20 '15 at 21:52

1 Answers1

-2

You can use the phantomjs-node module

Jason Livesay
  • 6,317
  • 3
  • 25
  • 31
  • Is it possible to use this module to take screenshots of 100's of websites in reasonable amount of time? Maybe within a minute. – degendra Sep 20 '15 at 14:40
  • You may need many CPUs for that speed since each is a full web page render. It could do a lot quickly if you do it in parallel and have several CPU cores. Limited by browser. Imagine trying to do that in Chrome on your laptop. Btw screenshot is page.render(). – Jason Livesay Sep 20 '15 at 14:47
  • That's not an answer to this question, is it? – Artjom B. Sep 20 '15 at 15:04
  • Yes, he asked three questions and I answered all of them. – Jason Livesay Sep 20 '15 at 21:45