【发布时间】:2018-04-15 07:43:46
【问题描述】:
这是我第一次无法使用无头浏览器打开网站,例如:phantomjs、slimerjs 或 casperjs。我只想打开网站。我只是创建了非常基本的脚本来打开网站并截取屏幕截图。但是其中 3(三)张给了我空白图片。
我尝试使用:
--debug=true
--ssl-protocol=TLSv1.2 (i try each of available protocol)
--ignore-ssl-errors=true
这是我的脚本:
Slimerjs
var page = require("webpage").create();
page.open("https://domain/")
.then(function(status){
if (status == "success") {
page.viewportSize = { width:1024, height:768 };
page.render('screenshot.png');
}
else {
console.log("Sorry, the page is not loaded");
}
page.close();
phantom.exit();
});
phantomjs
var page = require('webpage').create();
page.open('https://domain/', function() {
page.render('screenshot.png');
phantom.exit();
});
casperjs
var casper = require('casper').create({
viewportSize: {width: 950, height: 950}
});
casper.start('https://domain/', function() {
this.capture('screenshot.png');
});
casper.run();
我什至尝试使用屏幕截图服务来了解它们是否可以打开。但他们都没有给我任何东西。
我有什么想念的吗?
【问题讨论】:
标签: automation phantomjs casperjs slimerjs