我试图用CasperJS点击一个链接,但是收到了一个奇怪的错误:[warning] [phantom] Loading resource failed with status=fail (HTTP 200): http://njit.edu/。这是我的代码:
// Creating a casper module instance
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
var config = {
url: 'http://telluswho2.herokuapp.com/',
};
casper.start(config.url);
casper.then(function() {
console.log(this.getCurrentUrl());
this.click('a.btn-lg:nth-child(3)');
console.log(this.getTitle());
});
casper.run(function() {
console.log(this.getTitle());
this.exit();
});以下是我尝试过的解决方案:
casperjs njit.jscasperjs njit.js --ssl-protocol=anycasperjs njit.js --ssl-protocol=tlsv1casperjs njit.js --ignore-ssl-errors=yescasperjs njit.js --ignore-ssl-errors=truecasperjs njit.js --ignore-ssl-errors=falsecasperjs --ssl-protocol=any njit.jscasperjs --ssl-protocol=tlsv1 njit.jscasperjs --ignore-ssl=yes njit.js所有这些可能的解决方案都会导致相同的错误。有什么想法吗?
发布于 2014-12-15 05:57:27
从我的快速测试中,我相信按钮重定向到http://njit.edu/而不是http://www.njit.edu/,这就是为什么您要收到这个错误。
然后是自动从http://njit.edu/到http://www.njit.edu/,但是PhantomJS由于某种原因无法执行重定向。
https://stackoverflow.com/questions/27477868
复制相似问题