所以我遇到了问题,我无法填写此表格,因为没有ID和class=login
他找不到它。 我试过sendkeys
,this.fillSelectors
,document.querySelector
和this.fill
....
<div id="login_panel">
<form action="?s=user" method="POST" class="login">
<center><input style="margin-top:20px; margin-left:16px;" type="text" class="input" name="userid" onfocus="if(this.value=='User')this.value=''" onblur="if(this.value=='')this.value='User'" value="User">
<input style="margin-top:-2px; margin-left:16px;" type="password" class="input" name="userpass" onfocus="if(this.value=='Password')this.value=''" onblur="if(this.value=='')this.value='Password'" value="Password">
<a href="index.php?s=pass_lost">* Passwort vergessen?</a>
<input style="margin-top:5px; margin-left:16px;" type="submit" class="bt_enter" value="LOGIN" name="submit"></center>
</form>
</div>
我等到加载了一些.jpg。(它工作了一次(。
casper.then(function() {
this.evaluate(function(username, password) {
document.querySelector('input[node-type="userid"]').value = username;
document.querySelector('input[node-type="userpass"]').value = password;
document.querySelector('.W_btn_g:eq(1)').click();
this.click('input[value="LOGIN"]');
}, 'Dantes999', '123456789');
});
casper.then(function() {
this.sendKeys('input[name=userid]', 'Dantes999');
this.sendKeys('input[name=userpass]', '123456789');
this.click('input[value="LOGIN"]');
});
casper.then(function() {
this.fillSelectors('form#login_panel', {
'input[name=userid]': 'Dantes999',
'input[name=userpass]': '123456789'
}, true);
});
casper.then(function() {
this.fill('form[class="login"]', {
'userid': 'Dantes999',
'userpass': '123456789'
}, true);
});