Solved

Logon to web page using given Username and password

Posted on 2003-12-05
12
365 Views
Last Modified: 2010-05-03
This doesn't have to be a VB app, any solutions greatly appreciated. I have a logon to a particular site. What I need is to navigate to this particular site, automatically enter my password and user name and press the submit button. After that to navigate down this page press a link to download a file and accept. Im sure this can be done using SendKeys amongst other things but really Im not sure.

0
Comment
Question by:pbehan
  • 5
  • 4
  • 2
12 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 9882199
pbehan,
    Here is sample code I got here on EE, I don't remember where now. This will let you enter your user name and password, and login.

    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.Visible = True
    oIE.Navigate ("www.hotmail.com")
    While oIE.Busy: Wend ' wait for page to load...
    oIE.Document.All("login").Value = "USERID"
    oIE.Document.All("passwd").Value = "PASSWORD"
    oIE.Document.Forms(0).Submit

(you will need to look at the source html to get the names used for username {"login"} and password {"passwd"} boxes and adjust the code.)

Dang123


0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 250 total points
ID: 9882490
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9883067
Richie_Simonetti,
    Yes, I think it was one of your posts. Thanks. (Though the angelfire link always comes up as blocked for me.)
Dang123

0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9883415
Strange, i haven't that problem in any of computers that i did access it.
Don't worry, it is not my code: i would never use this line

While oIE.Busy: Wend ' wait for page to load...

since Busy and Readystate are a little buggy.
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9883916
Richie_Simonetti,
    It is a setting on our firewall, sites that are filtered out by the service we subscribe to just come back with a big red hand. My group doesn't have anything do with it so . . .   : (    What do you prefer to replace the while busy?



pbehan,
    The code samples you have now will get you loged in, you should be able to expand it with

oIE.Navigate(

to start the file download.



Dang123

0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9883976
Since a declared IE variables with withevents keywords i could access documentcomplete event of IE (Webbrowser control too!)

This event only is fired when document is completely downloaded, so it is easy to access DOM from HTMLDocument inside the browser.
Just a piece of advise:
DocumentComplete event fires for ALL and EACH document if there are frames at the URL.
To manage this, i always use (even if i know that there are no frames):

if (pDisp is ie) then
    ' code to access document goes here
end if

pDisp is IE  is only True when ALL documents were fully downloaded.
hope it helps.
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9883998
Thanks for the tip Richie_Simonetti. I'm sure it will come in handy.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9884007
"...
....
After that to navigate down this page press a link to download a file and accept. Im sure this can be done using SendKeys amongst other things but really Im not sure.
....
....
"

To know where you are (in which page), i use to test the URL paramater, if it is logon page, i would execute logon code, if logon is successfull, you would know which is the correct url then do the click in the desired link, or better, if you already know the link just use code some like this:

if url="your _choice_where _are_the_links" then
      ie. navigate "http://www.domain.com/filename.xyz"
end if
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9884024
Sorry may be I should not say it.

It is a really handy program to guess someone else password from the web
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9884028
Don't take it seriously.

8->
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9884059
Only if you manage BeforeNavigate event and usr/pwd is already wrote, so accessing doument object, you could check for
msgbox oIE.Document.All("password").Value
but i never tried.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

786 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