使用C#访问Html代码 [英] Access Html Codes With C#
本文介绍了使用C#访问Html代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想访问在
Internet Explorer中打开的reg.pnu.ac.ir/Forms/AuthenticateUser/main.htm html代码,并在我的c#app中访问输入textBox。
当我在Internet Explorer中选择查看页面源时,我看到输入textBox标签和标签的ID
但是当我在我的代码中使用htmlElementCollection或htmlElement时,我无法看到< input>标签
设置属性吧。
我的工作?
我写这段代码但没有用。
Hi,I want access reg.pnu.ac.ir/Forms/AuthenticateUser/main.htm html code that open in
Internet Explorer and access input textBox in my c# app.
when I choose view page source in internet explorer i see input textBox tag and tag's Id
but when I use htmlElementCollection Or htmlElement in my code , I can't see <input> tag
to set attribute it.
what i do ?
I write this code but didnt work.
foreach (HtmlElement el in webBrowser1.Document.All)
{
switch (el.Id)
{
case "F80351": el.InnerText = "880139701"; break;
case "F80401": el.InnerText = "3342201"; break;
case "btnLog": el.InvokeMember("click"); break;
}
}
推荐答案
http://stackoverflow.com/questions/16642196/get-html-code-from-a-website-c-sharp
希望以上链接能为您提供帮助。
http://stackoverflow.com/questions/16642196/get-html-code-from-a-website-c-sharp
Hope the above link will help you.
>
这篇关于使用C#访问Html代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文