代码之家  ›  专栏  ›  技术社区  ›  Injection

CasperJS不适用于Centos Server,但适用于Windows 10[重复]

  •  1
  • Injection  · 技术社区  · 7 年前

    这段代码是我在桌面上写的,在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();
    1 回复  |  直到 7 年前
        1
  •  1
  •   Garfield    7 年前

    使用phantomjs选项 --ignore-ssl-errors=true 通过SSL认证验证。欲了解更多信息 https://casperjs.readthedocs.io/en/latest/cli.html#casperjs-native-options