Solved

Logon to web page using given Username and password

Posted on 2003-12-05
12
362 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now