I am trying to automatically parse/submit a web page using MSHTML (in C#.Net 3.1 WPF WebBrowser control). I can fill the forms, click buttons, and navigate pages without problems.
But I do not know how to automatically click the "OK" button on the JavaScript confirmation dialog which appears when I click the "Submit" button.
C# code:
mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)webBrowser.Document;
mshtml.IHTMLFormElement form = doc.forms.item("inputForm", 0) as mshtml.IHTMLFormElement;
mshtml.IHTMLElement btnSubmit = form.item("btnFormSubmit", null) as mshtml.IHTMLElement;
btnSubmit.click();
The confirmation dialog ("Are you sure?") appears. I want to somehow send an "Enter" keystroke to the MSHTML document to automatically confirm the submission.