I have a page like the below in my web browser that I want to get the style atributte value. I tried:
HtmlElement ele = webBrowser1.Document.GetElementById("foo");
MessageBox.Show(ele.GetAttribute("style"));
but it output:
System.__ComObject
Why does it output a System.__ComObject type and how do I handle it?
HTML page:
<div id="foo" style="display:block;">
a
</div>
ele.Style
Will help.
ele.GetAttribute("Style")
won't work because returns string, so it can't say more than that is an object, while ele.Style returns CssStyleCollection.
var e = document.getElementById('foo');
var css = window.getComputedStyle(e,null).getPropertyValue("display");
alert(css);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With