0

面倒なログインを完了するために coffeescript と casperjs (1.0.0-RC4) を使用しようとしていますが、フィールドに name 属性を使用するフォームに入力したいと考えています (例: <input type='text' name='accountname'></input>)。私はもともと @fill を使用してフォームを完成させるつもりでしたが、id 属性が入力タグにないため、問題が発生していました (推測しています)。そこで、@sendKeys メソッドを使用することにしましたが、非常に紛らわしいエラーがスローされます。

TypeError: 'undefined' is not a function (evaluating 'this.sendKeys('#accountname', developerAccountName)')

このコードスニペットで私が間違っていることは明らかですか:

#!/usr/bin/env casperjs

developerAccountName = "user@user.com"
developerPassword = "password"

casper = require("casper").create(
    verbose: true
    logLevel: "debug"
    );

casper.start "http://www.example.com"

casper.thenClick "#content .maincontent .image.first a"

casper.thenClick ".button.blue"

casper.then ->
    if (@exists "#accountname") and (@exists "#accountpassword")
        @sendKeys '#accountname', developerAccountName
        @sendKeys '#accountpassword', developerPassword
        @click "form .signin-button"
    else
        @echo "Couldn't find the fields"

casper.run ->
    @echo "Complete."
4

1 に答える 1

3

sendKeys メソッドは 1.0.0.RC5 まで利用できませんでした

于 2012-12-16T18:42:54.520 に答える