VBScript sendkeys...waiting for webpage to load before sending next command

Posted on 2007-08-09
Last Modified: 2008-01-09
I am writing a script in VBScript that is browsing web pages.  I use sendkeys to enter web addresses.  I am looking for code I can add to my script to tell the script to wait for the next page to load before it executes the next line.

Question by:collages
    1 Comment
    LVL 65

    Accepted Solution

    Hi, I would not use SendKeys to send URLs, as long as you are OK with your script actually starting  the Internet Explorer window.....use this:
    Set IE = CreateObject("InternetExplorer.Application")
    Set objShell = CreateObject("WScript.Shell")

    With IE
            .navigate ""
    End With

    'wait a while until IE as finished to load
    Do while IE.busy

    objShell.SendKeys "search text"

    IE.navigate ""
    Do while IE.busy

    IE.Document.ALL("passwd").Value = "test"

    Using the Document.ALL parameters, if you know the "name" of the form object, you can click it or add text....



    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

    In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    729 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

    18 Experts available now in Live!

    Get 1:1 Help Now