Jay_the_noob
Jay_the_noob

Reputation: 15

How can I automatically log into a website using vbscript?

Im trying to automatically log into a website using a script so our employees don't have to remember the admin password.

Dim IE 
Dim Helem
Set IE =CreateObject("InternetExplorer.Application")  
IE.Visible = 1  
IE.navigate "http://rentalapp.zillow.com/"  
Do While (IE.Busy)   
WScript.Sleep 10  
LoopSet 
Helem = IE.document.getElementByID("formUsername")  
Helem.Value ="username"  
Set Helem =IE.document.getElementByID("formPassword")  
Helem.Value = "password" 
Set Helem = IE.document.Forms(0)  
Helem.Submit

I've gotten this far from other posts I've seen but I keep getting an error saying:

Line: 10 
char: 2 Error: 
Object required 
code: 800A01A8 
source: Microsoft VBScript runtime error

I've researched the code and and it says there is a typo somewhere but for the life of me I can't figure out where.

I'm not too familiar with vbscript but with functions like this I want to become more familiar with it. Please help.

Upvotes: 0

Views: 3354

Answers (2)

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38745

Helem = IE.document.getElementByID("formUsername")  
==>
Set Helem = IE.document.getElementByID("formUsername")  

as later in your code.

Upvotes: 0

to StackOverflow
to StackOverflow

Reputation: 124706

Helem = IE.document.getElementByID("formUsername")  
Helem.Value ="username" <= this is line 10

Failed at line 10: looks like you failed to find an element with the ID "formUsername".

Take a look at the source of the page and check your ID is correct.

Upvotes: 2

Related Questions