how would i do that?
Main Topics
Browse All TopicsWhat I need to do is to log into a website, and download a file.
In order to do that I need to use this AxSHDocVw control and sendkeys to tab and enter the username / password, click the download link and save it.
(downloading would be a secondary question) For now I need to figure out how to do the sendkeys.
One of 2 things is happening.
1) the page doesn't have focus, so the sendkeys doesn't happen
2) the sendkeys happens before the page is loaded.. (i tried a thread.sleep, even after the navigate method, but somehow this prevents it from loading until the sleeper is over.. see below!)
ThreadPool.QueueUserWorkIt
Thread.Sleep(10000)
SendKeys.Send("{TAB}")
etc etc etc
OR
browser.Navigate(url)
Thread.Sleep(10000)
SendKeys.Send("{TAB}")
etc etc etc
I also tried it without the sleeper.
I also tried it using the navigate2complete event.
private sub browser_NavigateComplete2(
and put the above code int he method. I'm lost!
nothing seems to work..
I can use:
System.Diagnostics.Process
HELP!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I use the MSHTML library, and the DocumentComplete event, and go through the HTML looking for the right control, and use the appropriate methods to accomplish this task:
Dim doc As HTMLDocumentClass = Me.browser.Document
Dim elem As HTMLInputElementClass = doc.getElementById("Simple
elem.focus()
elem.value = StripChars(title)
Dim button As HTMLInputElementClass = doc.getElementById("BasicG
button.click()
Bob
thanks bob.. i have a solution that works but that might help things out a little.
there is one thing i need that isn't working so far.. and that is a save file dialog.
How would I go about saving the file from that to a location easily?
sendkeys won't work because i can't find an event for when the dialog pops up..
and there isn't a straight link to the file for download!
the save file dialog pops up from a javascript submit function, that is called on the form submit button it seems. so i need to click the button on the form and then download the file that is prompted.
I wish I could do it your way, without sendkeys, but there are some things I can't do, like selecting listbox elements, etc... without sendkeys... especially this Save File Dialog, and file browser (have to tell it the exact location to save too!)
http://support.microsoft.c
I have worked through the file download via sendkeys. Although I'm trying to work through the above so that I know when the file is downloaded etc. and can close the browser when it is..
I am having troubles with this as well.
Should this intercept the filedownload? That is what I would prefer to have happen, intercept it and save the file automatically, in a specific location.
not for me... even after the save button is clicked that event still doesn't fire.
I've tried both adding a custom method and attaching an event to it that way, and also in vs.net going to the dropdown list and selecting teh event.. both should work the same and I don't see the event being fired in either case.
Business Accounts
Answer for Membership
by: testnPosted on 2005-04-27 at 19:23:20ID: 13882228
you should hook up to DocumentComplete event instead