I'm just working on an automation tool for IE. First thing is to start it through the script which works well, but now I want to catch Mouse Events. Currently I'm using SHDocVw and MSHTML, I also tried to work with
but that confused me even more.
In practice: I want the IE to start and capture every link/button that was clicked with tag
(at first simply through console output). It's not gonna be an invisible logging tool!!!
public void OnDocumentComplete(object pDisp, ref object URL)
public void OnNavigateComplete(object pDisp, ref object URL)
public void OnMouseDown(IHTMLEventObj pEvtObj)
static void Main(String args)
EventHandlers e = new EventHandlers();
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
mshtml.HTMLDocument htmlDoc = new HTMLDocument();
object Empty = 0;
object URL = "http://www.google.de";
IE.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(e.OnDocumentComplete); IE.NavigateComplete2 += new DWebBrowserEvents2_NavigateComplete2EventHandler(e.OnNavigateComplete); ((HTMLDocumentEvents2_Event)htmlDoc).onmousedown += new mshtml.HTMLDocumentEvents2_onmousedownEventHandler(e.OnMouseDown);
IE.Visible = true;
IE.Navigate2(ref URL, ref Empty, ref Empty, ref Empty, ref Empty);
I already spent hours and days searching the web so don't just point me to the first pseudo-solution you find on google. Don't even dare to point me to this article: Working With Microsoft.mshtml.dll and SHDocVw.dll
- because really NOTHING here described seems to work in any way.
I hope you can help me since I'm pretty close to freaking out. ;-)
Thank you in advance!