本文介绍了无法从页面捕获Html表信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要在Html表中迭代行和单元格并对某些数据执行验证。我尝试了很多但是无法做到这一点。事实上,我甚至无法捕获HTML表格详细信息。我使用的
代码如下:

We have a requirement in which we need to iterate through rows and cells in an Html Table and perform validation against some of the data. I tried a lot but am not able to do this. Infact I m not even able to capture the HTML Table details. The code I am using is as follows:

 

 

HtmlTable
hTable = 新
HtmlTable ();

HtmlTable hTable = newHtmlTable();

hTable.SearchProperties.Add(

hTable.SearchProperties.Add(

  ;

HtmlTable 。 PropertyNames .TagName,
" TABLE" );

HtmlTable.PropertyNames.TagName,"TABLE");

hTable.SearchProperties.Add(

hTable.SearchProperties.Add(

 

HtmlTable 。 PropertyNames 。 Id,
" ctl00_BodyContent_PermissionsPanel1_UserPermissionGrid" );

HtmlTable.PropertyNames.Id,"ctl00_BodyContent_PermissionsPanel1_UserPermissionGrid");

hTable.SearchProperties.Add(

hTable.SearchProperties.Add(

 

HtmlTable 。 PropertyNames 。 ControlType,
" Table" );

HtmlTable.PropertyNames.ControlType,"Table");

hTable.SearchProperties.Add(

hTable.SearchProperties.Add(

 

HtmlTable 。 PropertyNames 。 TechnologyName,
" Web" );

HtmlTable.PropertyNames.TechnologyName,"Web");

但这似乎不起作用:(

请告诉我如何捕获HTML表详细信息 以便我可以遍历表格。如果有人可以复制相同的代码片段,那就太棒了。

Please do let me know how can I capture the HTML Table details so that I can iterate through the tables. It would be great is someone can copy a code snippet regarding the same.

谢谢,

Abhijit 

Abhijit 

推荐答案

除Id属性外,上述所有其他3个属性代码是冗余的。它们已经是HtmlTable类的一部分,所以你不需要明确指定它们。所以,试着只设置Id搜索属性,看它是否适合你。

Except the Id property, all the other 3 properties in your above code are redundant. They are already part of the HtmlTable class, so you don't need to specify them explicitly. So, try with setting only the Id search property and see if it works for you.

谢谢,

Vishnu


这篇关于无法从页面捕获Html表信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 19:20