Here\'s the scenario:
I\'m loading a page via a CefSharp browser. When the user clicks a certain button (on the form, not the web page) the page should then focus on the
I found a solution that avoided SendKeys and javascript entirely. The CefSharp browser has the ability to simulate key presses and mouse clicks. I ended up just selecting the textbox that preceded the captcha and then tabbing to it.
chromeBrowser.Focus();
chromeBrowser.ExecuteScriptAsync("document.getElementsByClassName('txtBox')[0].focus();");
CefSharp.KeyEvent keyEvent = new CefSharp.KeyEvent();
keyEvent.WindowsKeyCode = (int)Keys.Tab;
chromeBrowser.GetBrowser().GetHost().SendKeyEvent(keyEvent);