Vbscript QTP读取webtable内容
我在QTP中有一个WebTable,如:Vbscript QTP读取webtable内容,vbscript,qtp,Vbscript,Qtp,我在QTP中有一个WebTable,如: <TBODY> <TR></TR> <TR> <TD> <TABLE> <TR> <TD> <DIV class=divRow id=divRow_d_0> <DIV class=divFirst>1</DIV>
<TBODY>
<TR></TR>
<TR>
<TD>
<TABLE>
<TR>
<TD>
<DIV class=divRow id=divRow_d_0>
<DIV class=divFirst>1</DIV>
<DIV class=divData>toto</DIV>
<DIV class=divData>fofo</DIV>
</DIV>
<DIV class = divRow id=divRow_d_1>
<!--same structure here-->
</DIV>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR></TR>
</TBODY>
1.
托托
fofo
在这里,我想捕获每个divRow的值divFirst和divData,理想情况下,将每个divRow存储在一个字符串中
谁能告诉我怎么做
非常感谢这似乎有效:
Set RowDesc = Description.Create()
RowDesc("class").Value = "divRow"
RowDesc("index").Value = 0
Set DataDesc = Description.Create()
DataDesc("class").Value = "divData"
While Browser("Browser").Page("Page").WebElement(RowDesc).Exist(1)
Set Row = Browser("Browser").Page("Page").WebElement(RowDesc)
RowDesc("index").Value = RowDesc("index").Value + 1
MsgBox Row.WebElement("class:=divFirst").GetROProperty("innertext")
DataDesc("index").Value = 0
While Row.WebElement(DataDesc).Exist(1)
Set Datum = Row.WebElement(DataDesc)
MsgBox Datum.GetROProperty("innertext")
DataDesc("index").Value = DataDesc("index").Value + 1
Wend
Wend
我使用描述性编程的原因是ChildObjects
不会返回这些WebElements
(很明显,您需要使用MsgBox以外的值执行其他操作。)谢谢,索引可以工作,事实上我尝试获取WebElements,但没有成功,谢谢