0
我想填寫表格並提交。CasperJS的填充方法
檢查我的腳本的一部分:
casper.then(function(){
if(this.exists('#msisdn')){
this.echo('ok found');
**this.test.assertExists('form[id="internetPlus"]', 'form is found');
this.fill('form[id="internetPlus"]', {
'numero': 'xxxxxxxx'
},true);**
this.click('#button');
而且我得到了這個錯誤:因爲斷言結果是正常
**PASS form is found**
[info] [remote] attempting to fetch form element from selector:
'form[id="internetPlus"]'
**[error] [remote] TypeError: 'undefined' is not an object (evaluating
'field.getAttribute')
FAIL CasperError: Unable to fill form
# type: uncaughtError
# error: "CasperError: Unable to fill form"
CasperError: Unable to fill form
/home/soufyan/workspace/casperjs:524 in fill
/home/soufyan/workspace/casperjs/kkostoreHomeTest.js:45
/home/soufyan/workspace/casperjs:909 in runStep
/home/soufyan/workspace/casperjs:252 in checkStep**
我不明白爲什麼我不能填寫表格。
剛剛添加適當的異常拋出時,這種錯誤發生https://github.com/n1k0/casperjs/commit/78683e2cbf78c9993eadce82f3ed4c10962497c1 – NiKo 2012-10-14 12:44:49