您好我是HPE UFT测试的新手,我想写一个VBscript。 这是我的HTML表格:
<table class="table table-striped table-condensed data-table dataTable no-footer" id="DataTables_Table_0" role="grid" aria-describedby="DataTables_Table_0_info">
<thead>
<tr role="row">
<th tabindex="0" class="sorting" aria-controls="DataTables_Table_0" style="width: 226px;" aria-label="Name: activate to sort column ascending" rowspan="1" colspan="1">Name</th>
<th tabindex="0" class="sorting" aria-controls="DataTables_Table_0" style="width: 481px;" aria-label="Address: activate to sort column ascending" rowspan="1" colspan="1">Address</th>
<th tabindex="0" class="sorting" aria-controls="DataTables_Table_0" style="width: 138px;" aria-label="VAT Number: activate to sort column ascending" rowspan="1" colspan="1">VAT Number</th>
<th class="sorting_disabled" style="width: 64px;" aria-label="&nbsp;" rowspan="1" colspan="1" data-orderable="false"> </th>
</tr>
</thead>
<tbody>
<tr class="odd" role="row">
<td>myCompany</td>
<td>test street, USA, WD</td>
<td>65465465465464</td>
</tr>
<tr class="even" role="row">
<td>Supplier</td>
<td>Franklin Street, USA, NYC</td>
<td>654564654654</td>
</tr>
</tbody>
</table>
我想编写一个函数或过程来循环遍历表,并检查表正文中是否存在字符串 myCompany 。 如果特定公司名称显示在结果列表中,则接受测试方案。
答案 0 :(得分:1)
IntRowNum=Browser("CreationTime:=0").Page("name:=myPage").WebTable("name:=myTable").getRowWithCellText("myCompany")
如果找不到文本,则IntRowNum为-1。否则返回rownumber。