簡體   English   中英

Casperjs:如何提交具有action =“#”的表單

[英]Casperjs: how can I submit a form that has action=“#”

我正在嘗試讓我的卡斯珀(casper)登錄網站,但是它具有以下形式:

<form action="#" method="POST" name="logon" id="loginForm" onsubmit="DoLogin(); return false;">

我把它放在棺材里

[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

如何觸發“ DoLogin(); ”或以其他方式提交表單?

只需運行該功能。 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM