0
由于某些原因,每当我尝试点击一个使用CasperJS的按钮时,它都不会实际响应。我渲染了一个截图,就好像它从来没有点击过它一样。用casperjs点击按钮时没有反应
phantom.casperPath = './modules/';
phantom.injectJs(phantom.casperPath +'/bin/bootstrap.js');
var system = require('system');
var utils = require('utils');
var casper = require('casper').selectXPath;
var casper = require('casper').create({
verbose: false,
logLevel: 'debug'
});
casper.options.viewportSize = {width: 1920, height: 1080};
casper.start();
casper.thenOpen('https://mydomain.com', function(){
});
casper.then(function() {
this.fill('form#loginPage',{
'user_name': 'myuser',
'user_password': 'mypassword'
},false);
casper.wait(100);
});
casper.then(function(){
this.click('#sysverb_login');
casper.wait(100);
});
casper.then(function(){
this.capture('test.png');
this.echo('success');
this.exit();
});
casper.run(function() {
});
你有什么期望点击按钮后发生(新页面已加载,页面上发生了什么......)?请修正您的格式。 – 2014-10-20 19:55:50
尝试将捕捉移入其自己,或在捕捉之前添加暂停 – Nick 2014-10-20 19:59:13
我尝试添加一个暂停,但这不起作用。 – Matt 2014-10-20 20:33:51