[英]Casperjs: how can I submit a form that has action=“#”
I am trying to get my casper to login into a website, but it has this form: 我正在尝试让我的卡斯珀(casper)登录网站,但是它具有以下形式:
<form action="#" method="POST" name="logon" id="loginForm" onsubmit="DoLogin(); return false;">
I get this in my casper 我把它放在棺材里
[info] [remote] attempting to fetch form element from selector: 'div.mainLoginLe
ftPanel form'
[debug] [remote] Set "username" field value to foo
[debug] [remote] Set "password" field value to ***
[info] [remote] submitting form to #, HTTP POST
[warning] [remote] unable to submit form
How can I trigger the " DoLogin();
" or submit the form a different way? 如何触发“ DoLogin();
”或以其他方式提交表单?
Just run the function. 只需运行该功能。 Casper runs in the context of the website. Casper在网站的上下文中运行。
casper.fill('#loginForm', {/* stuff */}, false);//Note the false at the end to not submit it.
casper.evaluate(function() {
DoLogin();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.