我的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) 我想制作一个额外的点击处理程序(客户端页面,不能修改他的js/html),它应该在我的脚本中这样工作:
1)event.stopPropagation(暂停客户点击传播)
2)我的功能(做我的功能,当一切都完成后做下一步)
3)event.startPropagation(继续标准客户端动作)
现在,第一个和第二个工作.第三是问题.
我知道event.startPropagation不存在,但我想要那样的东西.任何提示?
我试图通过casperjs捕获站点console.log和console.error.在console.log的情况下,我有工作代码:
casper.on('remote.message', function(message) {
this.echo('remote message caught: ' + message);
});
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何捕捉console.error.我需要这个来捕获任何资源错误(比如找不到图像).
应用程序加载用户的文本文件,每个文件都可以由用户更改。在应用程序启动时,我想检查自上次以来是否有任何文件被更改。我认为最有效的方法是计算每个文件的校验和并保存到一个 json 文件中。在应用程序启动时,我将检查每个文件校验和并将其与来自 json 文件的数据进行比较 有没有更优化/更有效的方法来做到这一点?或者如何准确计算文件校验和?
我需要lint所有项目文件(js)并排除一个文件.
我在努力:
standard "www\**\*.js" "!www\fileToIgnore.js"
和
standard ["www\**\*.js" "!www\fileToIgnore.js"]
这些都不起作用.任何的想法?
如何使用木偶戏从网站获取第三方cookie?
对于第一方我知道我可以使用
await page.cookies()