?
Solved

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

Posted on 2007-08-09
1
Medium Priority
?
3,920 Views
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.

Thanks.
0
Comment
Question by:collages
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 19666974
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
        .left=200
        .top=200
        .height=800
        .width=600
        .menubar=0
        .toolbar=1  
        .statusBar=0
        .navigate "http://www.google.com"
        .visible=1
End With

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

objShell.SendKeys "search text"

IE.navigate "http://www.hotmail.com"
Do while IE.busy
Loop

IE.Document.ALL("passwd").Value = "test"
IE.Document.ALL("SI").Click
'================

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

Regards,

Rob.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

840 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