Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendkeys to Webpage

Status
Not open for further replies.

dcranford

MIS
May 18, 2000
131
US
Is there a problem with sending keystrokes to a webpage through sendkeys? I have a couple of intranet applications that I was going to write a small vb 2003 app to "autologon"; if you will, with username and password. I didn't expect it to be too much of an issue but both apps seem to be receiving "sticky" keys. I was able to duplicate it on this website too...:

Process.Start("IExplore.exe", " System.Threading.Thread.Sleep(4000)
System.Windows.Forms.SendKeys.SendWait("isdcrand")

the login box fills with "isssssssssdccccccccc". I've not seen this before. Regular "non-web" apps recieve the keystrokes just fine. Any ideas?

Deon
 
Never mind this one...it appears to be a video driver issue on my PC. Just tried it on another and all is well.
 
Hey there, word of advice. Do not use sendkeys. Is not 100% reliable. If you just want to login a page, you can host the website in your app using the webbrowser control. Once vb.net is hosting the website, you can programtically do whatever you want to the website; click buttons, put data in fields, read data, submit, etc. If a windows login comes up, you can add a reg value to your registry that allows you to pass the username and password (encrypted in your app.config file) to the website to login. The user will not see the login windows popup. Judging from your message though, it looks as if the website just has its own login and password boxes. Thus, a lot easier. As follows:

Load website:
Webbrowsercontrol1.Navigate(New System.Uri("
Look at the source and find the elements that you need.
You are going to use htmlelement and invokemember to enter data on the website and click the submit button. This should get your started in the right direction.
 
If your website has frames, you have to reference the frame the login is on as well. Let me know how you come along with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top