0

Found answer to issue - must use web.Document.getElementById("password").Value = strOldPassword

I have a VB6 application that is supposed to log in to a website. It worked at one time but hasn't been run in years and now needs to be updated. I can get the username from the database and insert into the username input on the website fine, but when I get to password I get "Permission Denied" error. I assume it has to do with password fields. Anybody have a way around that?

The VB6 code that is giving me the error:

MsgBox ("need to enter password") ' This alert is shown to me
frm.Elements("password").Value = strOldPassword ' this line never executes
MsgBox ("password entered") ' this line never executes

The relevant HTML on the web page:

<input type="password" tabindex="1" class="input-xlarge" id="password" name="password"  autocomplete="off"/>
  • strOldPassword is just a string variable for the password I am trying to log in with. I will attempt this using the Document.GetElementsByName() method and update if it works. – Nick Bushnell Aug 20 '13 at 20:21
  • Set an id and try with `getElementById`: http://www.w3schools.com/vbscript/func_getref.asp – dani herrera Aug 20 '13 at 20:25
  • This WORKED! simple solutions are hard to come by. web.Document.getElementById("password").Value = strOldPassword – Nick Bushnell Aug 21 '13 at 12:54
  • Welcome to StackOverflow, I post my comment as answer in order you can check it as solution, learn about ["How does accepting an answer work?"](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) – dani herrera Aug 21 '13 at 14:27

1 Answers1

0

The easy way is use getElementById method:

web.Document.getElementById("password").Value = strOldPassword
dani herrera
  • 48,760
  • 8
  • 117
  • 177