使用webbrower c#获取文本而不是ID和名称 [英] Get text not ID and Name with webbrower c#

查看:69
本文介绍了使用webbrower c#获取文本而不是ID和名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   section     id   =  alertify-logs     class   =  alertify-logs >  
< 文章 class = alertify-log alertify-log-error alertify-log-show > Erorr < / article >
< / sec >







我想用webbrowser得到错误这个词。请帮帮我!!!

解决方案

你可以使用属性 System.Windows.Forms.WebBrowser.Document 访问文档DOM并将其遍历到所需的元素,最终,它的 InnerTextProperty 。这就是你需要的:

http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.document%28v=vs.110%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument%28v=vs.110%29.aspx [ ^ ],

http ://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.all(v = vs.110).aspx [ ^ ],

http://msdn.microsoft .com / zh-cn / library / system.windows.forms.htmlelementcollection(v = vs.110).aspx [ ^ ],

http://msdn.microsoft.com/en-us/ library / system.windows.forms.htmlelement.innerhtml(v = vs.110).aspx [ ^ ]。



-SA

<section id="alertify-logs" class="alertify-logs">
<article class="alertify-log alertify-log-error alertify-log-show">Erorr</article>
</section>




I want to get the word "Error" with webbrowser. Please help me!!!

解决方案

You can use the property System.Windows.Forms.WebBrowser.Document to access document DOM and traverse it to the required element and, ultimately, its InnerTextProperty. This is what you need:
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.document%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.all(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelementcollection(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.innerhtml(v=vs.110).aspx[^].

—SA


这篇关于使用webbrower c#获取文本而不是ID和名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆