joelgriffith / navalia

A bullet-proof, fast, and reliable headless browser API
https://joelgriffith.github.io/navalia/
GNU General Public License v3.0
957 stars 33 forks source link

page gets cropped #4

Closed fimdomeio closed 7 years ago

fimdomeio commented 7 years ago

this happens when using setWindowSize. The only way I found to get around this is to insert an artificial waiting time (around 10s) or no to have the windows headeless and resizing by hand... as soon as it moves a pixel it re-renders the webpage and everything gets on the right place

fimdomeio commented 7 years ago

on further investigation this appears to be risizeing the html document window but not the browser window.

joelgriffith commented 7 years ago

Yup, can verify. Appears to be a shortcoming of the Chrome devtools protocol. Seems that resizing prior to navigating works for a quick fix until i find a more robust solution

joelgriffith commented 7 years ago

Seems the sites that are most vulnerable to this are those that aren't responsive. @fimdomeio is there a site I can test against that more acutely exhibits this behavior?

fimdomeio commented 7 years ago

I detected this on a site I'm developing so it's not publicly available. But I can confirm the same behavior on google.com.

joelgriffith commented 7 years ago

Yeah, google.com seems to have issues, but https://www.chromestatus.com/features seems to work. (Make sure your on Canary)

If you're up for it, there's a beta build up navalia@0.0.10-0. Try something like this script:

// npm i --save navalia@0.0.10-0
const { Chrome } = require('navalia');
const chrome = new Chrome();

chrome.goto('https://www.chromestatus.com/')
.then(() => chrome.screenshot('/Users/jgriffith/Downloads/google.png')) // Change filepath here
.then(() => chrome.done());
fimdomeio commented 7 years ago

Hello. Did not have the time to test extensively but it seems to be fixed when using Chrome Canary on the latest version of your code.

joelgriffith commented 7 years ago

Very good. I'll make sure to broadcast this in the docs