Solved

automate website navigation... from where to start?(newbie)

Posted on 2004-03-21
5
836 Views
Last Modified: 2011-09-20
Hi

I would like to automate web navigation by using VB. I usually manage to write VBA code for ms applications(eg Outlook), but in this case I am stuck. I don't know from where to start.

My aim is to open a website, enter my username and password and hit the submit button, enter data in 2 data fields and hit the send button, then close the website...automatically.

Does Visual Studio.NET allow me to do such a thing. If yes, what project is suitable: ASP.NET Web Service, Console Application...? Preferably I would also need some code as an example to give me an idea.

Thanks in advance for your help.
0
Comment
Question by:chspit
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:D_M_D
ID: 10644306
0
 
LVL 14

Accepted Solution

by:
aelatik earned 500 total points
ID: 10644643
You can use this, you can put the login first and the the data submission.

Private Sub Form_Load()
    Dim IE
    Set IE = CreateObject("InternetExplorer.Application")
        IE.Navigate "http://www.google.com"
        IE.Visible = True
  While IE.Busy
        DoEvents
  Wend
        IE.Document.All("q").Value = "My Name" ' contains the HTML name of the object
        IE.Document.All("btnG").Click ' contains the HTML name of the object
End Sub
0
 

Author Comment

by:chspit
ID: 10644748
Hi D_M_D
The websites you suggested are intended for those who want to create web forms. That is not my intention. I want to login to a website automatically, input data in a textbox, hit a button and exit, all automated.

The main question to get me going is: can I do this rom a Console application, or from an ASP.NET Web service?


Thanks
0
 

Author Comment

by:chspit
ID: 10645326
Hi aelatik

Thanks for your code, but when I run it from Console (I am using Visual Studio.NET 2002) I receive an error. This is how I edited the code:

--------------------
Module WEB

    Sub Main()
        Dim IE
        IE = CreateObject("InternetExplorer.Application")
        IE.Navigate("http://www.go.com.mt/mygo/index.jsp")
        IE.Visible = True
        'While IE.Busy
        'DoEvents()
        'End While
        IE.Document.All("go number").Value = "mynumber" ' contains the HTML name of the object
        IE.Document.All("password").Value = "mypassword" ' contains the HTML name of the object
        IE.Document.All("SUBMIT").Click() ' contains the HTML name of the object
    End Sub

End Module

--------------------

This is the error I reveived:
<<<An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll
Additional information: Unspecified error>>>


What is wrong. Was your code supposed to be run from ASP.NET Web Service?
0
 
LVL 14

Expert Comment

by:aelatik
ID: 10646861
"I would like to automate web navigation by using VB", so its VB code ( not .NET )
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question