Solved

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

Posted on 2004-03-21
5
835 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replace quotes with UTF-8 character 38 97
Classic ASP - problem with MS SQL Select Query? 10 58
Save ms data to server side. 19 44
JS does not refresh 6 20
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…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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…

810 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