9

I'm unable to view the full window while running test scripts in casperjs using slimerjs engine . could any one please help me to increase the mozila browser window size

Srikanth Malyala
  • 941
  • 15
  • 24

2 Answers2

15

Sure, use the phantom/slimer viewportSize option in casper :

casper.options.viewportSize = {width: 1600, height: 950};

Or the casper function :

casper.start(url)
.viewport(1600,1000)
.{...}

With the function you can easily change the window size during steps of a scenario.

And the scrollTo(), srollToBottom() functions should help you too : http://casperjs.readthedocs.org/en/latest/modules/casper.html#scrollto

Fanch
  • 3,274
  • 3
  • 20
  • 51
  • Any idea how to detect screen size, so as to provide parameters width and height that are optimal for user running the script ? – Vic Seedoubleyew May 05 '16 at 09:35
  • Do you mean that : http://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window ? – Fanch May 09 '16 at 09:06
3
var page = require('webpage').create();
page.open("http://slimerjs.org", function (status) {
    page.viewportSize = { width:1024, height:768 };
    page.render('screenshot.png')
});

viewportSize allows you to set the window size.

Satevg
  • 1,601
  • 2
  • 16
  • 23