Reputation: 1177
How I can set viewport size in PhantomJS? I tried to set it using window.callPhantom
:
window.callPhantom('page.viewportSize = { width: 480, height: 800 };')
as suggested here: https://github.com/mmanela/chutzpah/issues/355, but this doesn't seem to work, because later window.innerHeight
still shows 300px (this is the default height of viewport in PhantomJS)
Upvotes: 0
Views: 522
Reputation: 16762
Chutzpah supports you calling phantom to change size but it requires you pass the arguments a little bit differently. Try:
window.callPhantom(
{
Type:"Eval",
Data: "phantom.pagesize(100,200);"
});
I am missing documentation on this which I will correct soon.
Upvotes: 1