VBAlearner5
New Member
- Joined
- Jan 25, 2015
- Messages
- 4
Hi,
I am trying to open a website and log into it using VBA.
The probelm I run into is that the username and password are only filled in "superficially". Hence when the VBA code clicks the login button it asks me to enter a username and password. When I click into the username and password fields after having executed the code, they turn empty.
I therefore tried to let the VBA code "click" into the fields first before entering the values. But this did not help either (most probably because I did it incorrectly).
I am executing this code in IE 11, in case this is relevant.
I would highly appeciate any comments and help.
Thank you in advance!
This is the VBA code:
This is the relevant part of the source code:
I am trying to open a website and log into it using VBA.
The probelm I run into is that the username and password are only filled in "superficially". Hence when the VBA code clicks the login button it asks me to enter a username and password. When I click into the username and password fields after having executed the code, they turn empty.
I therefore tried to let the VBA code "click" into the fields first before entering the values. But this did not help either (most probably because I did it incorrectly).
I am executing this code in IE 11, in case this is relevant.
I would highly appeciate any comments and help.
Thank you in advance!
This is the VBA code:
Code:
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "https://www.ups.com/uis/create?loc=de_DE"
ie.Visible = True
Do While ie.Busy
Loop
ie.Document.getElementById("userIdInput").Click
ie.Document.getElementById("userIdInput").Value = "XXX"
ie.Document.getElementById("passwordInput").Click
ie.Document.getElementById("passwordInput").Value = "XXX"
ie.Document.getElementById("loginButton").Click
This is the relevant part of the source code:
HTML:
<input type="text" class="reqTxtInst" maxlength="16" value="Benutzer-ID" id="userIdInput" name="userId"/>
<span style="position:relative">
<label id="passwordlabel" for="password" class="reqTxtInst" style="position:absolute; top:0; left:0">Kennwort</label>
<input type="password" class="reqTxtInst" maxlength="26" id="passwordInput" value="" name="password" onkeydown="if (event.keyCode == 13) document.getElementById('loginButton').click()" autocomplete="off"/>
<input type="button" class="btnArw colPad" value="Anmelden" id="loginButton" *******="login()" /> <input type="submit" style="display:none" *******="login()" />