首页 文章

如何检查列中是否已完全删除列?

提问于
浏览
-1

如何使用VB脚本检查列表中是否已完全删除列?

我在网表中创建了一行并删除了它 . 我想检查该列是否已从该webtable中删除 . 我写了一个脚本,并且很难写出逻辑 . 我可以从网表中获得完整的行数,并可以逐个循环 . 但是如何检查该列是否已从webtab中删除?

rowCount = SwfWindow(obj).SwfTable(tbl).RowCount 
For i = 0 To rowCount - 1 
    names = SwfWindow(obj).SwfTable(tbl).GetCellData(i, 1)       
    If  names = mycolname  'mycolname is the name of the column deleted  Then
        SwfWindow(obj).SwfTable(tbl).ClickCell i,1  
        Print "col name is present in the table"
        Exit for
    else
        Print "col name is deleted completely from the table"   
    End If
Next

2 回答

  • 0

    您想如何识别该列?可能是名字 . (问题中的代码通过数字索引索引 . )

    然后它取决于webtable的结构:

    There is a WebTable runtime property returning the name of all columns in a string separated by a semicolon; 迭代此字符串的组件并在循环中查询其名称 . 如果在流程中找到待删除的列,它仍然存在,如果没有,则删除 .

    有关示例,请参见http://www.sqaforums.com/forums/hp-unified-functional-testing-uft-mercury-quicktest-pro-qtp/148239-qtp-function-web-table-get-column-number-giving-column-name.html .

    Sometimes, the table is organized a bit different, and the getROProperty call returns garbage. Then, you usually find the column names as cell data in row 1. 在那里,您需要迭代列并使用 getCellData 查看列名称 .

  • 0

    正如@TheBlastOne所指出的那样,你在AUT中看到的表(被测试的应用程序)并不一定能说明它是如何实际构建的 . 以下是一个巧妙的技巧,它应该适用于WebTable和swfTable,以便能够看到表的实际结构:

    • 当您同时打开AUT和QTP时,单击QTP中的"Record"按钮

    • 选择在打开的应用程序上开始录制

    • 在QTP的工具栏菜单上,选择"Insert" - > "Checkpoint" - > "Standard Checkpoint",然后单击AUT中的表格

    现在应该打开一个新窗口,除其他外,它会向您显示表的结构,即行索引和/或名称,列索引和/或名称等 .

相关问题