My VBA can't fire onBlur event when inserting password into IE.
My VBA code manged to open the target webpage in IE, locate the login page, activate the correct Tab, insert my own ID and password into and they appear as text in the correct input boxes. However when my VBA code clicks the Login Button, the password is not processed. Yet when I do the same (ie. insert ID and password via VBA) manually, then I use VBA to click the Login Button, the webpage processes my login correctly. When I checked the webpage, I see that it has a Blur Event which activates a "js(84)" function. It appears that my VBA is not firing the onBlur event. Please help.
My VBA codes are :
dim and set IE and navigate done, then :
"
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").focus
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").fireEvent onKeydown
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").Value = "S12345678D"
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").fireEvent onBlur
IE.Document. getElementbyID("SpLoginIdPw-password").focus
IE.Document. getElementbyID("SpLoginIdPw-password").fireEvent onKeydown
IE.Document. getElementbyID("SpLoginIdPw-password").Value = "*********"
IE.Document. getElementbyID("SpLoginIdPw-password").fireEvent onBlur
IE.Document. getElementbyID("SpLoginIdPw-login-button").focus
IE.Document. getElementbyID("SpLoginIdPw-login-button").click
"
The website is : https://saml.singpass.gov.sg/spservice/welcome
My VBA code clicks the "Password Login" tab before executing the above codes.
After I found the onBlur event would not fire, I changed to "dispatchEvent". I also tried the following :
"
Dim objC As Object
Set objC = IE.Document.createEvent "keyboardEvent"
objC.InitEvent onBlur, True, False
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").fireEvent objC
Set objC = IE.Document.createEvent "keyboardEvent"
objC.InitEvent onBlur, True, False
IE.Document. getElementbyID("SpLoginIdPw-password").fireEvent objC"
"
Then followed by login-button. But all these don't work either.
Please help.
My VBA code manged to open the target webpage in IE, locate the login page, activate the correct Tab, insert my own ID and password into and they appear as text in the correct input boxes. However when my VBA code clicks the Login Button, the password is not processed. Yet when I do the same (ie. insert ID and password via VBA) manually, then I use VBA to click the Login Button, the webpage processes my login correctly. When I checked the webpage, I see that it has a Blur Event which activates a "js(84)" function. It appears that my VBA is not firing the onBlur event. Please help.
My VBA codes are :
dim and set IE and navigate done, then :
"
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").focus
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").fireEvent onKeydown
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").Value = "S12345678D"
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").fireEvent onBlur
IE.Document. getElementbyID("SpLoginIdPw-password").focus
IE.Document. getElementbyID("SpLoginIdPw-password").fireEvent onKeydown
IE.Document. getElementbyID("SpLoginIdPw-password").Value = "*********"
IE.Document. getElementbyID("SpLoginIdPw-password").fireEvent onBlur
IE.Document. getElementbyID("SpLoginIdPw-login-button").focus
IE.Document. getElementbyID("SpLoginIdPw-login-button").click
"
The website is : https://saml.singpass.gov.sg/spservice/welcome
My VBA code clicks the "Password Login" tab before executing the above codes.
After I found the onBlur event would not fire, I changed to "dispatchEvent". I also tried the following :
"
Dim objC As Object
Set objC = IE.Document.createEvent "keyboardEvent"
objC.InitEvent onBlur, True, False
IE.Document. getElementbyID("SpLoginIdPw-singpass-id").fireEvent objC
Set objC = IE.Document.createEvent "keyboardEvent"
objC.InitEvent onBlur, True, False
IE.Document. getElementbyID("SpLoginIdPw-password").fireEvent objC"
"
Then followed by login-button. But all these don't work either.
Please help.