Web浏览器控件(登录问题) [英] web browser control (problem in login )

查看:114
本文介绍了Web浏览器控件(登录问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个应用程序,我需要自动登录网站,但该网站已加密连接:高级加密(AES-128,128bit密钥)和登录窗口具有三个字段用户名inputbox type ="text" password inputbox type ="password "和第三个终端下拉列表框,其中有两个值.我为此使用webbrowser控件,我也为此编写了代码,但是当我运行程序时,只有用户名和终端(下拉列表)显示值,密码输入框没有显示值,所以问题出在哪儿,所以请帮忙我紧急.我的代码如下



i am developing one application in this i need to automatically login in website but this website has connection encrypted:High grade Encryption(AES-128,128bit keys) and login window have three fields username inputbox type="text" password inputbox type="password" and third terminal dropdownlist box which has two values. i am using webbrowser control for this i have written code for this also but when i run my programme only username and terminal (dropdownlist) shows the value password input box doesn''t shows the value so what''s the problem so please help me its urgent. my code as below

If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
                Dim frmform As HtmlElement = WebBrowser1.Document.Forms("aspnetForm")
                frmform.All("ctl00_lnkLogin").InvokeMember("Click")
                frmform.All("ctl00_txtUserName").SetAttribute("value", sUserID)
                Dim oPassword As HtmlElement
                oPassword = WebBrowser1.Document.All.Item("ctl00$txtPassword")
                oPassword.InnerText = sPWD
                'frmform.All("ctl00_txtPassword").SetAttribute("value", sPWD)
                Dim He As HtmlElement = WebBrowser1.Document.GetElementById("ctl00_cboTerminal")
                He.SetAttribute("SelectedIndex", "1")
                'frmform.GetElementsByTagName("select")(0).Document.GetElementsByTagName("option")(1).SetAttribute("selected", "true")
                ''frmform.All("ctl00$cboTerminal").InvokeMember("SelectedIndexChanged")
                ''frmform.GetElementsByTagName("select")(0).Document.GetElementsByTagName("option")(1).SetAttribute("selected", "true")
                frmform.All("ctl00_btnLogin").Enabled = True
                frmform.All("ctl00_btnLogin").InvokeMember("Submit")
            End If



谢谢与问候

Arshad



Thanks and Regards

Arshad

推荐答案

txtPassword") oPassword.InnerText = sPWD ' frmform.All("ctl00_txtPassword").SetAttribute("value",sPWD) Dim As HtmlElement = WebBrowser1.Document.GetElementById(" ctl00_cboTerminal") He.SetAttribute(" " 1") ' frmform.GetElementsByTagName("select")(0).Document.GetElementsByTagName("option")(1).SetAttribute (已选择",真") ' 'frmform.All("ctl00
txtPassword") oPassword.InnerText = sPWD 'frmform.All("ctl00_txtPassword").SetAttribute("value", sPWD) Dim He As HtmlElement = WebBrowser1.Document.GetElementById("ctl00_cboTerminal") He.SetAttribute("SelectedIndex", "1") 'frmform.GetElementsByTagName("select")(0).Document.GetElementsByTagName("option")(1).SetAttribute("selected", "true") ''frmform.All("ctl00


cboTerminal").InvokeMember("SelectedIndexChanged) ' 'frmform.GetElementsByTagName("select")(0).Document.GetElementsByTagName("option")(1). SetAttribute("selected","true") frmform.All(" ).Enabled = True frmform.All(" ).InvokeMember(" 提交") 结束 如果
cboTerminal").InvokeMember("SelectedIndexChanged") ''frmform.GetElementsByTagName("select")(0).Document.GetElementsByTagName("option")(1).SetAttribute("selected", "true") frmform.All("ctl00_btnLogin").Enabled = True frmform.All("ctl00_btnLogin").InvokeMember("Submit") End If



谢谢与问候

Arshad



Thanks and Regards

Arshad


不确定,但可能会更改
Do not know for sure but maybe change
oPassword = WebBrowser1.Document.All.Item("ctl00


这篇关于Web浏览器控件(登录问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆