How to get value from any tag in web browser control using wpf

余生颓废 提交于 2019-11-29 18:01:25

If you use System.Windows.Controls.WebBrowser control then this should work, however it works on assumption that you only have one CODE tag:

var myTagValue = (wbBrowser.Document as mshtml.HTMLDocument)
                   .getElementsByTagName("CODE")
                   .OfType<mshtml.IHTMLElement>()
                   .First()
                   .innerText

You'll need to reference Internet Explorer's COM library: Microsoft HTML Object Library. getElementsByTagName returns you list of all matching tags, no matter where they are in HTML

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