javascript - CasperJS 不适用于 Centos 服务器,但适用于 Windows 10

标签 javascript centos phantomjs casperjs

<分区>

我在桌面上编写的这段代码在 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

关于javascript - CasperJS 不适用于 Centos 服务器,但适用于 Windows 10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46762636/

相关文章:

phantomjs - Karma Jasmine PhantomJS- PhantomJS 没有在 60000 毫秒内捕获

php - 在 JavaScript 方法中使用动态数据

javascript - 从javascript中的对象的键值对中删除键

javascript - 每次提交表单时ajax调用次数都会增加

centos - 如何禁止 Clamav 从 Internet 下载病毒库

php - 将 MS SQL 数据库与 MySQL 数据库同步

javascript - 如何计算多个时间范围的交集(最佳见面时间)?

linux - 如何阻止 yum update 将我的 centos 5.4 升级到 5.8

javascript - 如何运行 Headless Chromium (Puppeteer) 多线程?

python - Selenium/PhantomJS 引发错误