2016-05-05 9 views
0

提出失います。しかし、私はページを提出するとき、私は性別の値を満たしていないというエラーメッセージが表示され、値はデフォルト値に変更されます。私はスクリーンショットでそれをチェックした。 CasperJSは、選択ボックスのvaueの後、私はその選択フォームを持っている

が提出

は、ページにここにある:

<div class="col-xs-18"> 
    <input id="CredentialsAction" class="btn btn-primary btn-block" type="submit" value="Klick" title="Klick"> 
</div> 

私はそのようにそれをクリックしてください:

casper.then(function(){ 
    this.click('input[title*="Klick"]'); 
}); 

を私はまた、そのような性別を選択してみました:

casper.then(function(){ 
    this.sendKeys('select#Gender', 'w'); 
}); 

これもあります最初の瞬間には、送信ボタンをクリックするまで性別が選択されます。どんなアイデアが間違っているの?私はフォームを選択することができる他の方法の任意のアイデアですか?

答えて

0

私はすべての埋め込みメソッドを試しました。そしてfinalyとそれを固定:

[warning] [remote] unable to submit form 

が、全く問題:

casper.then(function(){ 
this.fillSelectors('form#formID', { 
'select[id=Gender]': 'm', //variable for gender 
}, true); 
}); 

唯一の問題は、私はデバッグモードで警告を受けるです。

1

お試しいただけますか? これはあなたの問題を解決すると信じています。

casper.then(function(){ 
    //select value "u" - Keine Angabe 
    this.evaluate(function(selectValue){ 
     document.querySelector('select[id=Gender]').value = selectValue; 
     return true; 
    }, "u"); //set value "u" 
    this.capture('capture.png'); //see this image to confirm change 
}); 
casper.then(function() { 
    this.click('#CredentialsAction'); //click on input element by id 
}); 

幸運!!!

+0

thx ..しかし、うーん..いいえそれはdoenst: - (私のcasper.then(function(){ this.evaluate(function(anrede_inside){ document.querySelector( 'select #Gender ')。value = anrede_inside; }、anrede); });しかし、あなたは "return true"を追加しています...私はまだ同じ問題を抱えています – swapfile

関連する問題