Trying to simulate onfocus and typing event, but it not work
Sub Login(MyLogin, MyPass)
Dim IEapp As InternetExplorer
Dim IeDoc As Object
Dim ieTable As Object
TaskKill "iexplore.exe"
Set IEapp = New InternetExplorer
IEapp.Visible = True
IEapp.Navigate "https://example.com/portal/en/login"
Do While IEapp.Busy: DoEvents: Loop: Do Until IEapp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set IeDoc = IEapp.Document
With IeDoc.forms(2)
.Name.Value = MyLogin
.Name.Focus
.FireEvent ("onkeypress")
.FireEvent ("onchange")
.Password.Value = MyPass
.Password.Focus
.FireEvent ("onkeypress")
.FireEvent ("onchange")
End With
IeDoc.getElementsByClassName("form__button form__button--login-site")(1).Click
End Sub
How to call focus and typing events? Sendkeys is bad solution as it have Excel bug with Numlock