我可以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/