Taking automated webpages screenshots using JavaScript and PhantomJS