Solved

Logon to web page using given Username and password

Posted on 2003-12-05
12
364 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now