Return all attributes of an HtmlElement in Web browser

馋奶兔 提交于 2019-12-05 06:46:09

I haven't tried it, but I guess this could be a solution or the first step. First, you have to reference to microsoft.mshtml

foreach (HtmlElement el in webBrowser1.Document.GetElementsByTagName("TEXTAREA"))
{

    HTMLTextAreaElement textarea = (HTMLTextAreaElement)el.DomElement;

    xWriter.WriteStartElement("Item");
    xWriter.WriteElementString("GUID", el.Id);

    foreach (var attribute in textarea.attributes)
    {
         String name = attribute.name;
         String value = attribute.value;

         xWriter.WriteElementString(name, value);
    }

    xWriter.WriteEndElement();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!