I was using HTMLViewer to log into a site that made sure the textbox was touched before the form could be submitted so I had to set focus and send keys. I put this into a timer and it worked great.
When putting the same code in WeView2ControlMBS I cannot get the focus or sendkeys to work at all. It doesn’t even focus on the textbox. web is name of my control. Is it not possible to set focus to an element and use sendkeys in WebView2ControlMBS? Thanks.
if refreshsecondstart = 1 then
web.SetFocus
web.ExecuteScript(“document.getElementById(‘username’).focus();”)
wsh.SendKeys("{BKSP}")
elseif refreshsecondstart = 2 then
wsh.SendKeys(user)
wsh.SendKeys("{TAB}")
elseif refreshsecondstart = 3 then
web.ExecuteScript(“document.getElementById(‘password’).focus();”)
wsh.SendKeys("{BKSP}")
elseif refreshsecondstart = 4 then
wsh.SendKeys(pass)
elseif refreshsecondstart = 5 then
wsh.SendKeys("{TAB}")
elseif refreshsecondstart = 6 then
wsh.SendKeys("{ENTER}")
end if