【问题标题】:Phantomjs makes screencapture on mobilesite level and not full websitePhantomjs 在移动网站级别而不是整个网站上进行屏幕截图
【发布时间】:2013-09-21 18:58:41
【问题描述】:

对 phantomjs 和测试屏幕捕获功能来说非常新,因为这是我需要的。但似乎我制作的屏幕捕获捕获了网页的移动视图。我的页面是响应式的,我得到了适合移动设备的视图,而不是我想要的全尺寸。是否可以控制它并请求“全尺寸”?

【问题讨论】:

  • 请张贴您当前使用phantomjs代码的截屏!

标签: phantomjs viewport


【解决方案1】:

使用此代码让它工作

var page = require('webpage').create();

page.viewportSize = {width: 1600, height: 1050};
page.open('http://elmah.io', function () {    
    page.render('elmah6.png');
    console.log('elamh6.png')
    phantom.exit();        
});

问题是我将 viewportSize 放在了 open 函数中。

我遵循了这个例子。

http://daker.me/2013/07/testing-your-responsive-design-with-phantomjs.html

【讨论】:

    猜你喜欢
    • 2014-12-18
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-27
    相关资源
    最近更新 更多