javascript - 如何使用 CasperJS/PhantomJS 生成类似移动设备的高 DPI 屏幕截图?

标签 javascript phantomjs casperjs

我可以set the viewportSize获得小型移动布局和尺寸的屏幕截图:

// 1080 x 1920 is Nexus 5 resolution
casper.options.viewportSize = {width: 1080 / 3, height: 1920 / 3};

但是 DPI 较低,与在移动设备上查看时不同。

相关信息

我的页面uses the viewport meta tag to control layout on mobile browsers像这样

<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">

最佳答案

我们真正需要的是设置 Device Pixel Ratio 。截至 2016 年 7 月,PhantomJS is lacking that ability ,但是people are working on it .

关于javascript - 如何使用 CasperJS/PhantomJS 生成类似移动设备的高 DPI 屏幕截图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38166527/

相关文章:

javascript - 为什么 reduxReducer 中的状态变量不加 1

javascript - PhantomJS - 试图找出一个元素是否为空

angularjs - 迁移到 AngularJS 时保持 SEO 排名

javascript - Casperjs Google 登录无法正常工作

javascript - Casperjs Casper错误: Cannot dispatch mousedown event on nonexistent selector:

jquery-ui - 如何使用 CasperJS 移动 jquery-ui slider

javascript - 迭代 Angular 4 Firebase 数据库中的对象数组

JavaScript 比较功能不起作用

javascript - 如何使 ng-repeat 中的子 Controller 一次加载一个?

javascript - Phantom JS 没有点击按钮,但如果我使用任何其他浏览器它就可以工作