From: munawar on
Hi

I tried putting the following code in a .vbs file and executed it, its bombing out with unspecified error in line 12, which is

Set ipf = IE.document.getElementByID("city")


What is wrong here, why is the code not working

Thx



rm wrote:

Here is a script that I found and modified.
09-Jan-09

Here is a script that I found and modified. May I have input on error
handling please?

DIM IE
DIM ipf

Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "http://zip4.usps.com/zip4/citytown.jsp"
IE.Visible = True

While IE.Busy
WScript.Sleep 50
Wend

Set ipf = IE.document.getElementByID("city")
ipf.Value = "redmond" 'fill in the text box
Set ipf = IE.document.getElementByID("state")
ipf.Value = "WA" 'fill in the text box
Set ipf = IE.document.getElementByID("Submit")
ipf.Click 'click the submit button
'IE.Quit

WScript.Quit

Previous Posts In This Thread:

On Tuesday, January 06, 2009 5:38 PM
noon wrote:

Re: Navigate to Page - Fill in Input Text Box
Il giorno Tue, 6 Jan 2009 13:36:18 -0800 (PST), rm <groups(a)rlmoore.net> ha scritto:

And if the element doesn't have an ID, you can identify it by the tag. The number starts
from zero, so number 8 is the 9th element in the page.
Set Img=oIE.document.body.getElementsByTagName("A").Item(8)

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--

On Friday, January 09, 2009 6:30 AM
rm wrote:

Navigate to Page - Fill in Input Text Box
I have a legitimate need to automate the testing of a web page (I
believe it doesn't really matter that I make that statement - but it
is true). I can script the navigation to the page - however I am not
certain how to automagically fill in a text box on the page. May I
have a pointer to a "How To" resource please? I am attempting to find
the info via a search for "populate an HTML text box". However that is
pointing me filling in a text box from within an HTML page - I already
know how to do that.

On Friday, January 09, 2009 6:30 AM
rm wrote:

Here is a script that I found and modified.
Here is a script that I found and modified. May I have input on error
handling please?

DIM IE
DIM ipf

Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "http://zip4.usps.com/zip4/citytown.jsp"
IE.Visible = True

While IE.Busy
WScript.Sleep 50
Wend

Set ipf = IE.document.getElementByID("city")
ipf.Value = "redmond" 'fill in the text box
Set ipf = IE.document.getElementByID("state")
ipf.Value = "WA" 'fill in the text box
Set ipf = IE.document.getElementByID("Submit")
ipf.Click 'click the submit button
'IE.Quit

WScript.Quit

On Friday, January 09, 2009 6:30 AM
Tom Lavedas wrote:

Re: Navigate to Page - Fill in Input Text Box
On Jan 6, 4:36=A0pm, rm <gro...(a)rlmoore.net> wrote:

This worked for me ...

DIM IE
DIM ipf

Set IE =3D CreateObject("InternetExplorer.Application")
IE.navigate "http://zip4.usps.com/zip4/citytown.jsp"
IE.Visible =3D True

While IE.Busy
WScript.Sleep 50
Wend

Set ipf =3D IE.document.all.city
ipf.Value =3D "redmond" 'fill in the text box
Set ipf =3D IE.document.all.state
ipf.Value =3D "WA" 'fill in the text box
Set ipf =3D IE.document.all.Submit
ipf.Click 'click the submit button
'IE.Quit

Tom Lavedas
***********
http://there.is.no.more/tglbatch/


Submitted via EggHeadCafe - Software Developer Portal of Choice
Excel 2007 Filter Tool
http://www.eggheadcafe.com/tutorials/aspnet/ae703d26-58da-423a-a2cb-1f3a46fbea8f/excel-2007-filter-tool.aspx
 | 
Pages: 1
Prev: excel syntax
Next: Repost to avoid confusion