我一直在尝试使用 ac# webBrowser 表单自动登录到基于 javascript 的站点,经过一番搜索后,我想出了如何自动填写用户名和密码:
webBrowser1.Document.GetElementById("email Id").InnerText = "email";
webBrowser1.Document.GetElementById("password Id").InnerText = "password";
但我只是找不到如何自动点击“进入”按钮。我尝试使用与带有调用选项的自动填充相同的方法:
webBrowser1.Document.GetElementById("btn").InvokeMember("click");
但它没有用,所以这里有一些网站的源代码(一个小部分,显示登录表单部分)
</a>
<form id="login" name="login" action="index.php?sendPass=true" method="post" style="margin: 0; padding: 0; position: relative">
<div style="text-align: right; margin-right: 10px; margin-top: 0; padding-top: 0;">
<div style="font: 12px arial; margin: 0; text-align: center"></div>
<img src="new1/login_title_ido.jpg" alt="" />
<div style="margin:0px; margin-bottom:10px">
<div style="font: 12px arial; margin: 0px">דוא"ל :
<input type="text" name="email" class="loginInput" value="" dir="ltr" /></div>
<div style="font: 12px arial; margin-top: 1px">סיסמה:
<input type="password" name="pass" class="loginInput" style="margin-right:1px;margin-top:1px" value="" dir="ltr" /></div>
<a onmouseover="this.style.cursor='pointer';" onclick="alert('הכנס דואר אלקטרוני \n ולחץ על כפתור הכנס ');"><u>שכחתי סיסמה</u></a>
<input type="image" src="new/login.jpg" align="middle" style="margin-right: 25px;" />
</div>
<div style="color: #000000; padding-top:3px; direction:rtl">
</div>
</div>
</form>
我似乎无法确定“输入”按钮的 ID,有什么想法吗?!或者也许还有其他方法可以调用“输入”按钮?