Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Dear every predecessors,
This is a super helpful thread. I am not sure if anyone still following the thread, I hope there is a little chance somebody could help:p
Right now, I am trying to fill forms on website, I did it with "Sendkeys", but by reading #196, it is not appropriate.
Code:
WebBrowser1.Navigate("https://mybank.icbc.com.cn/icbc/enperbank/index.jsp")
WaitForPageLoad()
TextBox1.Text = WebBrowser1.Url.ToString
SendKeys.Send("UserABC")
SendKeys.Send("{TAB}")
SendKeys.Send("Password")
Code:
Private Property pageready As Boolean = False
#Region "Page Loading Functions"
Private Sub WaitForPageLoad()
AddHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
While Not pageready
Application.DoEvents()
End While
pageready = False
End Sub
Private Sub PageWaiter(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
pageready = True
RemoveHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
End If
End Sub
#End Region
I believe that the login form is an ActiveX control ttps://mybank.icbc.com.cn/icbc/enperbank/index.jsp
The source code of the password field:
Code:
<OBJECT onkeyup="getfocus1('KeyPart', event);detectCapsLock('logonform','safeEdit1',500,300,400,'logontb');" onfocus="detectCapsLock('logonform','safeEdit1',500,300,400,'logontb')" onblur="closeCapTip('logonform','safeEdit1')" id=safeEdit1 codeBase="/icbc/newperbank/AxSafeControls.cab#version=1,0,0,13" classid=CLSID:73E4740C-08EB-4133-896B-8D0A7C9EE3CD width=145 height=21><PARAM NAME="_cx" VALUE="3836"><PARAM NAME="_cy" VALUE="556"></OBJECT>
Is there a way to pass value into the password field with it ID/name??
Thank you for any advice!!!