我有一个简单的问题,但我不知道解决方案。
casper.then(function(){
this.fillSelectors(argFormSelector,{
argLoginSelector : argLogin,
argPwdSelector : argPwd
},true);
});
但是在 debug_mode 我什么都看不到......它看起来像:
[info] [phantom] Step anonymous 3/3 http://urlwebsite/ (HTTP 200)
[info] [remote] attempting to fetch form element from selector:
'form[action^="/remote.php?act=formTargetGag"]'
[info] [phantom] Step anonymous 3/3: done in 1950ms.
但是如果我尝试在没有变量的情况下做同样的事情,一切都很好:
casper.then(function(){
this.fillSelectors(argFormSelector,{
'input[id="login_email"]': argLogin,
'input[id="login_password"]':argPwd
},true);
});
- -日志 - -
[info] [remote] attempting to fetch form element from selector: 'form[action^="/remote.php?act=formTargetGag"]'
[debug] [remote] Set "email" field value to spider.batman.93@mail.ru
[debug] [remote] Set "password" field value to ********* [info] [remote] submitting form to /remote.php?act=formTargetGag, HTTP POST
所以我的问题是:为什么我不能在 fillSelectors 中使用变量?我的意思是在左边,因为在右边一切都很好,你可以看到。
我将数据放在这样的变量中:
var a = { argLoginSelectors: argLogin, argPwdSelectors: argPwd}
for(i in a)
console.log(i+':'+a[i]);
this.fillSelectors(argFormSelector,a,true);
但是什么也没发生。我在日志中有相同的:
[info] [phantom] Step anonymous 3/3 http://urlwebsite/ (HTTP 200)
[info] [remote] attempting to fetch form element from selector:
'form[action^="/remote.php?act=formTargetGag"]'
[info] [phantom] Step anonymous 3/3: done in 1950ms.
请帮助我:) 我做错了什么?PS对不起我的英语不好。