CasperJS不能在Centos服务器上工作,但在Windows 10上工作
问题描述:
我在我的桌面上编写的代码在Windows 10下运行,一切正常。当我转移到Centos Server时,我开始出现错误。请帮助我CasperJS不能在Centos服务器上工作,但在Windows 10上工作
CasperError: Cannot get informations from input[name="email"]: element not found.
/home/casper/casperjs/phantomjs:/platform/casper.js:1158 in getElementInfo
/home/casper/casperjs/phantomjs:/platform/casper.js:1721 in sendKeys
/home/casper/casperjs/phantomjs:/code/cars.js:9
/home/casper/casperjs/phantomjs:/platform/casper.js:1685 in runStep
/home/casper/casperjs/phantomjs:/platform/casper.js:414 in checkStep
var casper = require('casper').create();
casper
.start('https://example.com', function() {
this.echo(this.getTitle());
this.click("span.btn.btn-green");
}).wait(5000).then(function() {
\t this.capture('sdsdsd.png');
this.sendKeys('input[name="email"]', 'name');
this.sendKeys('input[name="password"]', 'pass');
this.click("button.btn.btn-h40.btn-green.btn-fw.btn-submit");
console.log("Auth");
})
casper.run();
答
使用phantomjs选项--ignore-ssl-errors=true
到byepass的SSL证书验证。欲了解更多信息https://casperjs.readthedocs.io/en/latest/cli.html#casperjs-native-options
截图截图捕获有效的回应? – Garfield
@ Cut-n-paster谢谢你的回答。我发现问题,这是ssl握手错误。 – Injection