我正在尝试在长页面(例如http://www.taoism.net/ttc/complete.htm)的底部创建一个屏幕截图,如下所示:
Nightmare({ show: false })
.viewport(1024, 30000)
.goto('http://www.taoism.net/ttc/complete.htm')
.wait()
.screenshot(sImagePath, {
x : 0,
y : 27711,
width : 1024,
height : 133
});截图文件大小为0字节。使用不同的y值进行测试,它可以工作到大约8000px。尝试使用.scrollTo,但没有任何帮助。
有谁知道解决办法吗?
P.S. Nightmarejs围绕着电子浏览器。
发布于 2016-10-20 14:45:44
这可能就是你要找的https://github.com/segmentio/nightmare/issues/328#issuecomment-159311982
基本上,您可以根据抓取大小的内容动态调整视口大小。
https://stackoverflow.com/questions/36994379
复制相似问题