gwuhaolin / chrome-render

general server render base on headless chrome
95 stars 10 forks source link

How to get the whole page content (the part render by js) #10

Closed tracyshen closed 7 years ago

tracyshen commented 7 years ago

I use chrome-render to fetch some page, but the html returned by chrome-render doesn't include the part rendered by js........ ......how to get the whole page content?......Thanks...

gwuhaolin commented 7 years ago

It depend on how your web page get data and render data to html.

By default chrome-render will return page DOM string when event domContentEventFired is fired, If your page hasn't get and render data to html before event domContentEventFired you should use option useReady:true in chrome-render and call window.isPageReady=1 in your web page after page get and render data to html.

tracyshen commented 7 years ago

Thanks~ I found i can get whole html include rendered by js when Page.loadEventFired, but sometimes i get two html, because Page.loadEventFired event will fired twice when the page is redirect......(before redirect and after redirect....)

a question is: ..when the page finally loaded.......... when and where.. call window.isPageReady=1......

gwuhaolin commented 7 years ago

call window.isPageReady=1 when your page is ready to be render, e.g. when async fetch data has be render to dom by react.