How to make jsdom wait for full rendering of html page..?
Asked Answered
S

0

6

I'm using jsdom to load a html page from the server using nodejs to fetch some google charts graph URL. But the issue is i'm only able to fetch partially loaded graph URL. how to make jsdom wait until full graph is rendered and then console.log the URL.

Below is my JSDOM COde :

 router.post('/Endpoint',(req,res,next)=>{
 // the file I will be loading
 uri = 'one.html',

 // the options that I will be giving to jsdom
 options = {
   runScripts: 'dangerously',
   resources: "usable"
 };

 // load from an external file
jsdom.fromFile(uri, options).then(function (dom) {

let window = (new jsdom(``, {  pretendToBeVisual: true })).window;

window.requestAnimationFrame(timestamp => {
    console.log(timestamp > 0);
  });
}).catch (function (e) {
   console.log(e);
});

});//EOF API

Graph URL is base64 encoded string

Secular answered 20/2, 2019 at 7:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.