Pio*_*cik 19 javascript ssl phantomjs casperjs
我的https页面有问题.页面完全正常,它存在,但phantomjs告诉我别的东西:'加载资源失败,状态失败'.我读了一段时间,现在我知道它是phantomjs的bug,这个问题的解决方案是:
--ignore-ssl-errors=true
Run Code Online (Sandbox Code Playgroud)
所以我知道解决方案,但不知道如何使用它.我如何将这个传递给casper的phantomjs?我该怎么办?
编辑:
整个代码:
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(); });
Run Code Online (Sandbox Code Playgroud)
sud*_*pto 19
根据https://casperjs.readthedocs.org/en/latest/cli.html#casperjs-native-options
最后但同样重要的是,您仍然可以像使用任何其他phantomjs脚本一样使用所有PhantomJS标准CLI选项:
$ casperjs --web-security = no --cookies-file =/tmp/mycookies.txt myscript.js
所以,我猜,它会
casperjs --ignore-ssl-errors=true yourjsapp.js
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15143 次 |
| 最近记录: |