QiitaのサイトをCasperjsを使ってフォームに値を入力したいと思っています.
最初にログインする必要があるので,コードの一部ですがCaffeeで書きました.
lang
1casper.then -> 2 @fill 'form.landingLoginForm', 3 'input#identity.form-control.landingLoginForm_identity' : mailaddress, 4 'input#password.form-control' : password ,true
これだめ,
lang
1casper.then -> 2 @evaluate -> 3 //フォームにユーザのアドレスを入力 4 (document.querySelector 'input#identity')= mailaddress 5 //パスワードの入力 6 (document.querySelector 'input#password.form-control')= password 7 //ログインボタンをクリック 8 (document.querySelector 'input.btn.btn-primary.btn-block').click()
で,次はこのようにしましたがうまくいきませんでした.
クラス要素ではなくID要素のほうはうまくできるのですがform#hogeではなくform.hogeのような場合の方法をご教授いただけると嬉しいです.
あなたの回答
tips
プレビュー