PhantomJS failing to load Google Maps -


my end goal open local html file javascript embedded, creating map polygons, , take screenshot of using phantomjs. have written simple js file this:

var page = require('webpage').create(); page.open('https://www.google.com/maps', function(status) {   console.log('state: ' + status);   if(status === 'success') {       page.render('example.pdf', {format: 'pdf', quality: '100'});   }   phantom.exit(); });  

this returns error:

referenceerror: can't find variable: google 

i've tried on local html file , on other websites using google maps , keep getting same error. have been successful in taking screenshot of other websites without google maps. searching internet doesn't seem people have had issues this, , have been successful in taking screenshots of pages google maps...so i'm wondering wrong.

another note: installed phantomjs gem in rails project , running javascript file through rails console using gem. have tried using standard installation of phantomjs (v 2.0.0) , still didn't work.

you should give puppeter go, makes easy:

const puppeteer = require('puppeteer'); (async () => {   const browser = await puppeteer.launch();   const page = await browser.newpage();   await page.goto('https://example.com');   await page.screenshot({path: 'example.pdf'});    await browser.close(); })(); 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -