Question Auto fill [ActiveX control] form using Webbrowser control

dolluatdoll

New member
Joined
Nov 6, 2014
Messages
1
Programming Experience
3-5
Hello, I'm a newbie to VB.NET Forums, nice to meet you all!

Recently, I am doing an interesting project on auto-fill web forms, then I come to some difficulties, hope that someone can give me some advices.

I already read some old posts about this topic, and learned the basic technique of auto-fill forms when vb.net.

I created a form with "WebBrowser" in visual studio (vb.net), when the form loaded, it fires up a website(https://mybank.icbc.com.cn/icbc/enperbank/index.jsp), there is a login form, my mission is to auto fill in the login name and password fields (captcha can be ignore)
I passed the "Card(Account) Number" with he following code
VB.NET:
Dim frameDoc As HtmlDocument = WebBrowser1.Document.Window.Frames(0).Document
        Dim frameUser As HtmlElement = frameDoc.GetElementById("logonCardNum")
        frameUser.SetAttribute("value", "UserABC") ' write into the textbox

I believe that the password field is an ActiveX control, I can't do it like the "Card(Account) Number"
I can only did it with "Sendkeys", but I know it is not appropriate.
VB.NET:
 SendKeys.Send("{TAB}")
        SendKeys.Send("Password")

The password field is embedded:
HTML:
<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 proper way to pass value into the password field with it ID/name??

Thank you for any advice!!!
 
Back
Top