Solved

Logon to web page using given Username and password

Posted on 2003-12-05
12
366 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 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