Results 1 to 7 of 7

Thread: web1.navigate quick question

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    4

    web1.navigate quick question

    Hello everyone.

    I have a problem that I wanted to see if it was possible to resolve. I have the following code. I wanted to know if it where possible to login and submit and follow a link and then from that same link follow another link inside of that url?

    private sub command2_click()

    Dim web1 As WebBrowser

    set web1 = CreateObject("InternetExplorer.Application")
    web1.Visible = true

    web1.Navigate ("http://somewebsite.com")

    do Until web1.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop

    With web1.Document
    .All("Userlogin").Value = "username"
    .All("Password").Value = "password"
    .Forms(0).submit
    End with


    End sub

    This will only login. I trying to get to load that page along with a link that looks like web2.Document.Links(1).Click

    but then after it loads the page, load another page inside of the new url all in the same browser. I hope this isn't confusing.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: web1.navigate quick question

    I hope this isn't confusing.
    totally
    you should be able to what you want easily enough, as long as the login does not open a new browser window

    i have done like this before, but any testing would have to be done on thje specific web site,
    after submitting the form you need to loop until ready with new document
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    4

    Re: web1.navigate quick question

    Im just not sure if its a matter of a loop or do I need to use another function. Can someone show me an example of what I am missing? Or do I need to better explain what I need to do?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: web1.navigate quick question

    if the page loads into the same browser window then you have to wait for it to load, after that you can click any link or do whatever you want with that web page

    if you make web1.visible = true, while testing you can see what is going on
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    4

    Re: web1.navigate quick question

    Quote Originally Posted by westconn1 View Post
    if the page loads into the same browser window then you have to wait for it to load, after that you can click any link or do whatever you want with that web page

    if you make web1.visible = true, while testing you can see what is going on
    I understand that part. Maybe I'll try this as and example.

    1. Login Page
    2. Main Menu
    3. 1st hyperlink = titled page
    4. Inside titled page then click another hyperlink

    I want it to load different pages, one after another in that order. I have already used the web1.visible = true to see the output but the most I can make it do is login page to main menu. I hope that helps explain what Im trying to do.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: web1.navigate quick question

    if you want me to help on this, pm me a link to the actual website, and login details, as i can't make a guess without being able to login
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    4

    Re: web1.navigate quick question

    Quote Originally Posted by westconn1 View Post
    if you want me to help on this, pm me a link to the actual website, and login details, as i can't make a guess without being able to login
    There isn't a site I can give you at the moment but other then that but thanks anyways. Maybe I'll try rewording this in another forum post and see what I can come up with.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width