0
我有這個腳本截屏與PhantomJS:page.clipRect導致page.render()掛
var page = require('webpage').create();
page.open('https://github.com', function() {
page.viewportSize = { width: 320, height: 600 };
page.render('e:\\Screenshots\\test.png');
phantom.exit();
它工作正常,但我想設置的視口的高度,因爲它是目前整個頁面高度。
文檔說使用page.clipRect:http://phantomjs.org/screen-capture.html
但是,下面的代碼不能正常工作,它只是掛起,從不截圖:
var page = require('webpage').create();
page.open('https://github.com', function() {
page.viewportSize = { width: 320, height: 600 };
page.clipRect = { top: 0, left: 0, width: 320 height: 600 };
page.render('e:\\Screenshots\\test.png');
phantom.exit();
我沒有得到任何錯誤,只是沒有發生並輸入攤位。
任何想法是怎麼回事?
啊啊謝謝,不敢相信我沒注意到。 1.9.8的好消息,我從現在開始也會這樣做。 – Guerrilla