Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulate objects on web page in VPScript 1

Status
Not open for further replies.

JohnAlderman

Technical User
Apr 29, 2002
1
US
I have a web page I log into every week, authenticate and then download 3 (Excel) files. This manual procedure takes 27 descrete steps.
I would like to write a VBScript application that does this unattended.

What I cannot seem to figure is how VBScript can read text boxes, labels and other controls on the web page, and then 'click' pushbuttons and select text objects.

I know that HTML has ways to address these objects, but I don't know what they are.

My platform is Vista/Win7, with IE8. I have VBSEdit, Power
Shell, and even Jscript available.

This has got to be easy and everybody else knows how to do it, but I am stuck!.
John Alderman
 
Something like this, to get you started:
Code:
Option Explicit
Dim objIE, sTextboxValue
Set objIE = CreateObject("InternetExplorer.Application")
	objIE.Visible = True
	objIE.Navigate "[URL unfurl="true"]http://www.mysite.com"[/URL]
	Do While objIE.Busy
		WScript.Sleep 500
	Loop
	sTextboxValue = objIE.Document.getElementByID("sometextboxname").Value
	objIE.Document.getElementByID("somebuttonname").Click
End With

The code above will open a web page, and then store the contents of a text box whose ID is "sometextboxname". (You need to examine the HTML of the page you are navigating to, to find out the ID or Name of the text box you want to retrieve data from)
Similary, this is how you can "click" a button.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top