VBA to site login

I see what the issue you’re facing now. Set value actually doesn’t trigger the inputs as having values. The values of username and password were still considered empty. In this situation, we can use SendKeys to simulate user input then the events of the inputs will be triggered successfully.

You can change the code according to below:

With document
     .getElementById("username").Focus
     SendKeys (UserName)
     Application.Wait (Now + TimeValue("00:00:01"))
     .getElementById("password").Focus
     SendKeys (Password)
     Application.Wait (Now + TimeValue("00:00:01"))
     .getElementsByClassName("ant-row-flex ant-row-flex-center ant-row-flex-middle")(0).Click
End With

I test with a fake username/password and the message now is “Invalid username/password” which showing it works:

enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top