如何使用c#获取显示为none的div的html文本 [英] how to fetch html text of div whose display is none using c#
问题描述
我使用div控件的类名获取数据。正在获取页面上可见的内容,但是有一个popup div,其display属性为none。由于输入类型设置为隐藏,因此未获取其中的元素。
我的代码如下:
dynamic div_classes = webBrowser1.Document.Body.GetElementsByTagName(div);
foreach (HtmlElement d in div_classes)
{
if (d.GetAttribute( className) == persontitle)
{
persontitle = d.InnerText;
txtTitle.Text = persontitle;
}
// 等等..
}
立刻的帮助将非常感谢!!
谢谢
隐藏输入类型意味着它的隐藏字段。您可以轻松访问其值,如:
( #Id_Of_That_Field)。val();
如果您的弹出式div具有类名popup
,然后语法如下:
( 。popup)。html();
问候。
I have fetched data using classnames of div control. The content that is visible on the page is being fetched but there is a popup div whose display property is none. The elements inside this are not being fetched as input type is set to hidden.
My code is as follows:
dynamic div_classes = webBrowser1.Document.Body.GetElementsByTagName("div");
foreach (HtmlElement d in div_classes)
{
if (d.GetAttribute("className") == "persontitle")
{
persontitle = d.InnerText;
txtTitle.Text = persontitle;
}
//and so on..
}
Immediate help would be really appreciated!!
Thanks
input type is hidden means its hidden field. You can easily access its value like:
("#Id_Of_That_Field").val();
If your popup div has class namepopup
,then syntax goes like this:
(".popup").html();
Regards..
这篇关于如何使用c#获取显示为none的div的html文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!