Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I maximize the browser window while running test scripts in casperjs using slimerjs

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

like image 749
Srikanth Malyala Avatar asked Apr 04 '14 08:04

Srikanth Malyala


2 Answers

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

like image 58
Fanch Avatar answered Oct 04 '22 02:10

Fanch


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.

like image 43
Satevg Avatar answered Oct 04 '22 02:10

Satevg