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

我怕爱的太早我们不能终老 提交于 2019-11-30 03:09:08

问题


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


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/22858088/how-can-i-maximize-the-browser-window-while-running-test-scripts-in-casperjs-usi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!