Coffeescript 在CasperJS中调用sendKeys时出现TypeError
我正在尝试使用coffeescript和casperjs(1.0.0-RC4)来完成一个繁琐的登录,并希望填写一个表单,该表单的字段使用name属性(例如Coffeescript 在CasperJS中调用sendKeys时出现TypeError,coffeescript,casperjs,Coffeescript,Casperjs,我正在尝试使用coffeescript和casperjs(1.0.0-RC4)来完成一个繁琐的登录,并希望填写一个表单,该表单的字段使用name属性(例如)。我本来打算使用@fill来完成表单,但我猜是有问题的,因为id属性不在输入标记中。因此,我决定使用@sendKeys方法,但它抛出了一个非常令人困惑的错误: TypeError:“undefined”不是函数(计算“this.sendKeys”(“#accountname”,developerAccountName)”) 在这段代码片段中是
)。我本来打算使用@fill来完成表单,但我猜是有问题的,因为id属性不在输入标记中。因此,我决定使用@sendKeys方法,但它抛出了一个非常令人困惑的错误:
TypeError:“undefined”不是函数(计算“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."
sendKeys方法直到1.0.0才可用。RC5sendKeys方法直到1.0.0才可用。RC5嘿@muistooshort-我给了一个机会,错误是现在这个没有方法
TypeError:“undefined”不是一个函数(计算“_this.exists”(#accountname”)
这已经解决了-他们在1.0.0.RC5.Hey@muistooshort中向CasperJS添加了sendKeys。我给出了一个快照,错误是现在\u this
没有方法TypeError:“undefined”不是函数(计算“\u this.exists(“\35; accountname”))
这已解决-他们在1.0.0.RC5中向CasperJS添加了SendKey。