Control Internet Explorer

stowell_48

Member
Joined
Sep 11, 2006
Messages
5
Programming Experience
1-3
I am trying to control Internet explorer from my windows vb.net application.

What is the best way to control IE and have it login to a website and navigate to a particular page?

Thanks for your help
 
why not just use the Microsoft WebBrowser control on a form? It has a .Navigate() method and uses the IE cache on the local system
 
?

why not just use the Microsoft WebBrowser control on a form? It has a .Navigate() method and uses the IE cache on the local system

I am still really new to .net.

Would I use the Microsoft WebBrowser control to automate loging in to a website and navigating around to the proper page. I need to be able to have .net automate the login username and password and then click on the go button. Once it does that there are other pages that it will need to navigate through to get to the proper page I am trying to get to.

In java I have used the jiffie which was build on jacob to do this. Would the Microsoft WebBrowser control be able to do these types of tasks?

Thanks for you help.
 
right off the bat i couldnt tell you how to do this, but it is possible to do so

i'm not familiar with java (i'm taking an intro to java programming course at my local college this semester, we're doing commandline stuff with the "hello world" app)
 
There are really two basic methods to accomplish this.

1. Post the variables to the URL (i.e.http://mysite.com/login.html?id=2132&pw=132132). Now the issue with this is a few things. it can become a huge pain if the login site is complex, for example if they are using viewstate variables, or other generated variables. In this case I would definantly go with option 2 )

2.Use element id's and simulate the button click. simply open the page source using any web browser. Find the ID of the login txt box, and the password. In most cases these are (ID = USerName & Id=Pw). Then look up the ID of the Button. Normally (ID = Submit, or ID = Login). The code I use is the following
Lets assume the Id's were (UserName,Pw,Submit), where submit is the button. And lets also assume you were using the Active X Control for the webbrower.

dim x as new axwebbrowser
x.Navigate("your website you want to login to")

'You will likley need to add a loop clause here to wait until the Readystate
'is complete i.e. While not x.CurrentState = readystate_Complete loop
'That might not be the exact code, but look up the correct on google
'Then simply do

x.Document.Body.GetElementByID("UserName").value="Vinnie"
x.Document.Body.GetElementByID("Pw").value="1234"
X.Document.Body.GetElementByID("Submit").Click()
 
Ok but how do you do this

Lets say you are not on the registration page. In the source the login button <a href="login.php. Lets use my forum for example.

If the user is on the homepage http://www.merchantcheckrecovery.com/phpbb

Now they want to login to the site. They want there form in VS 2005 to automatically go to the login section log them in and then redirect them to the homepage when finished.

1. The url gets' pulled in, doesn't matter what it is, if there is a login.php it will pull that information and direct the user to it.
2. Will log the user in.
3. Will redirect the user to the homepage.
 
Thanks, that Helps. But lets take it a step further

Lets say that you don't have this luxury of knowing what the home page is.

For instance you are trying to log in to several different sites, as some people might be.

The login link has to be clicked on from any page. Reason being in this case we have the index of the forum as being .com/phpbb/index.php Lets say you are at the page http://merchantcheckrecovery.com/phpbb/profile.php?mode=register&agreed=true and the software doesn't know that the index of the site is not merchantcheckrecovery.com, but that its .com/phpbb.

That's why the software has to first direct to the link then fill in the forms and then submit.

Anyone know how to do this from any page within a site as long as the link you are trying to get to is provided. I've setup the forum on my website as an example.
 
Nope just trying to extend the question.

Just trying to extend the question beyond the basics. No threads tend to elaborate on auto navigation so I thought we could. This forum was setup for merchant services on my site. So i thought I would use it as an example.
 
you would need to parse the page source for the appropriate variables. Look up regular expresions parse html. To have this working flawlessly is a lot of coding, but it can be done. The links will always be in the source, you just need towrite the code to find them and create query string to post.
 
Back
Top