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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange BUG?

Status
Not open for further replies.

ekbranson

Programmer
Jan 12, 2004
52
US
Hello, I got tired of logging in to a web app at work so I wrote a quick script to log into the application for me. Everything works great, but for some reason I get an error that implies that I need an object for loginname on line 19. Login works great, just the windows Error Message box appears.

Any Ideas? I think is has something to do with the wait.

Here is the script:

dim objIE
dim objDoc
dim loginname
dim password
dim submit


set objIE = CreateObject("InternetExplorer.application")
objIE.navigate "xxx"
objIE.height = 740
objIE.left = 0
objIE.top = 0
objIE.width = 1020
objIE.visible = true

while objIE.busy

WScript.Sleep 100

wend


set objDoc = objIE.document
set loginname = objDoc.getElementById("aclUserName")
loginname.value = "xxx"


set password = objDoc.getElementById("password")
password.value = "xxx"

set submit = objDoc.getElementById("loginBtn")
submit.click()
 
You're trying to get an element by the ID, but you haven't created any form or elements.

Lee
 
Thank you for your response. The form does not need to be created as it is created by the document that is loaded into the IE object from the navigate command. These fields exist on the form in the document requested.


I still have the problem, although just a nussiance, as the script works fine. I just dont like the windows error message.


Thanks again.
 
Why do you think it is an ie bug? Why not the buggy/deficient page design which is more likely?
 
Could be an page design problem. But the page is a Web Application that contains a standard text input with the name and id both declared. This is the name and id used in my script. To make sure that the page has loaded before setting the value of the username and password fields I have a while ieObj.busy statement that waits 100 before checking again to see if IE is busy. So technically the page should be loaded and the objects should exist. However, I get a windows error saying the object of the following line does not exist.

set loginname = objDoc.getElementById("aclUserName")

Yet instead of failing the script continues to run and the webpage logs in sucessfully. So I think either there is a problem with my logic or some kind of bug in IE. So if anyone has a sugestion, no big deal just curious.
 
>So I think either there is a problem with my logic or some kind of bug in IE
"So I think there is a problem with you logic.
 
>Do you have a suggestion?
Sure, I had done that. Look at your login page design.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top