I have a AxWebBrowser class. I wish to locate a specific element in its
HTMLDocument which has a specific 'style'.
I use the following code to access the element with the specific
style:-
IHTMLDocument2 doc = (HTMLDocumentCl ass)Browser1.Do cument;
if( doc.body != null && doc.body.all != null)
{
foreach(IHTMLEl ement el in (IHTMLElementCo llection)doc.bo dy.all)
{
if( (el.getAttribut e("style",0) != null) &&
(el.getAttribut e("style",0).To String().ToLowe r() == desiredStyle))
{
System.Windows. Forms.MessageBo x.Show(el.tagNa me);
}
}
}
doc = null;
The code when debugged shows el.getAttribute ("style",0) returning a
System._ComObje ct. I need to cast it to some Type but an unable to do
so. Using reflection all I could find out was thats its an
System.Object with the standard fields and methods defined.
Looking for an answer I scoured the internet and I found a similar
problem mentioned at
http://www.experts-exchange.com/Prog..._21078656.html
but it suggested no answer to the problem.
Any help would be greatly appreciated.