0

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)

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
El Kopyto
  • 1,157
  • 3
  • 18
  • 33

1 Answers1

1

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.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Matthew Manela
  • 16,572
  • 3
  • 64
  • 66