CasperJS 不能在 Centos 服务器上运行,但可以在 Windows 10 上运行
CasperJS not work on Centos Server but work on Windows 10
这段代码是我在桌面上写的,运行 在 Windows 10 下,一切正常。当我转移到 Centos 服务器时,我开始出现错误。请帮助我
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 () {
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
绕过 SSL 认证验证。欲了解更多信息 https://casperjs.readthedocs.io/en/latest/cli.html#casperjs-native-options
这段代码是我在桌面上写的,运行 在 Windows 10 下,一切正常。当我转移到 Centos 服务器时,我开始出现错误。请帮助我
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 () {
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
绕过 SSL 认证验证。欲了解更多信息 https://casperjs.readthedocs.io/en/latest/cli.html#casperjs-native-options