Hi All,
I am writing a project in C# using a web browser control. Objective of this project is to automate the browser. I have an element that I want to be clicked automatically. I am using mshtml.IHTMLDocument3 interface to access DOM document and then find the element by ID. Once I do find the element by ID, I cast it to mshtml.IHTMLElement; but when I do that, I get null reference to mshtml.IHTMLElement variable. Therefore, my click method does not work. Please Help. I need this for my job.
mshtml.IHTMLDocument3 doc = (mshtml.IHTMLDocument3)this.LPBrowser.Document.DomDocument;
doc.getElementById("newlink"); mshtml.IHTMLElement a;
a = (mshtml.IHTMLElement)doc; //Casting here but a becomes null
a.click(); //null.click() so this doesn't work
Thanks.
Abdul Asif.