使用casperjs中的--ignore-ssl-errors = true运行phantomjs [英] Run phantomjs with --ignore-ssl-errors=true from casperjs
问题描述
我的https页面有问题。页面完全正常,它存在,但phantomjs告诉我别的东西:'加载资源失败,状态失败'。我读了一段时间,现在我知道它是phantomjs的bug,这个问题的解决方案是:
I have a problem with https page. Page is completly ok, it exist but phantomjs tell me something else: 'loading resource failed with status fail'. I read about it for a while and for now i know it's phantomjs bug and the solution to this problem is:
--ignore-ssl-errors=true
所以我知道解决方案,但不知道如何使用它。我如何将这个传递给casper的phantomjs?我该怎么办?
So I know solution, but don't how to use it. How can I pass this to phantomjs from casper? Where should I do that ?
编辑:
整个代码:
var casper = require('casper').create({
verbose: true,
logLevel: 'warning',
pageSettings: { javascriptEnabled: true },
viewportSize: {width: 1024, height: 768}
});
var url = 'http://us3.php.net/manual/en/function.explode.php',
xp = require('casper').selectXPath;
// ### AKCJE PODSTAWOWE ###
casper.start(url);
casper.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0');
casper.then(function(){this.captureSelector('logi/img1.png', 'body');});
casper.then(function(){ this.sendKeys(xp('/html/body/nav/div/div/div/form/span/input[2]'),'test18');});
casper.then(function(){this.captureSelector('logi/img2.png', 'body');})
casper.thenClick(xp('/html/body/div[3]/div/section/div/div[2]/a[1]'));
casper.wait(2000);
casper.then(function(){this.captureSelector('logi/img3.png', 'body');})
casper.run(function(){ this.exit(); });
推荐答案
根据https://casperjs.readthedocs.org/en/latest/cli.html#casperjs-native-options
最后但并非最不重要的是,您仍然可以像使用任何其他phantomjs脚本一样使用所有PhantomJS标准CLI
选项:
Last but not least, you can still use all PhantomJS standard CLI options as you would do with any other phantomjs script:
$ casperjs --web-security = no --cookies-file = / tmp / mycookies.txt
myscript.js
$ casperjs --web-security=no --cookies-file=/tmp/mycookies.txt myscript.js
所以,我想,它会是
casperjs --ignore-ssl-errors=true yourjsapp.js
这篇关于使用casperjs中的--ignore-ssl-errors = true运行phantomjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!