|
小弟初学QTP用于测试公司的软件。被测软件有一个删除功能,删除按钮是图片。删除按钮与被删除项的名称一起存放在一张table里。页面结构大体如下所示-
- <table width="100%" cellpadding="0" cellspacing="2">
- <tr>
- <td nowrap="nowrap">
- <img src="/common/images/layout/arrow_black_right.gif" border="0"/>
- <a class="navitem" href="javascript:funOpenNaviLink('account&listId=12ZHZZRSW0','listmain','1');">QTP-客户名称-包含-姓名</a>
- </td>
- <td align="left">
- <img align="middle" style="cursor: hand" onclick="javascript:funOpenLinkPartReshCfm('userViewShow','list','account','act','delview','forward','delListId=12ZHZZRSW0&reshflag=0');" alt="删除" src="/common/images/icon_clear.gif" />
- </td>
- </tr>
-
- <tr>
- <td nowrap="nowrap">
- <img src="/common/images/layout/arrow_black_right.gif" border="0"/>
- <a class="navitem" href="javascript:funOpenNaviLink('account&listId=1306MXZH3H','listmain','1');">QTP-客户名称-非空-</a>
- </td>
- <td align="left">
- <img align="middle" style="cursor: hand" onclick="javascript:funOpenLinkPartReshCfm('userViewShow','list','account','act','delview','forward','delListId=1306MXZH3H&reshflag=0');" alt="删除" src="/common/images/icon_clear.gif" />
- </td>
- </tr>
-
- <tr>
- <td nowrap="nowrap">
- <img src="/common/images/layout/arrow_black_right.gif" border="0"/>
- <a class="navitem" href="javascript:funOpenNaviLink('account&listId=145PTOG3VS','listmain','1');">QTP-客户名称-不包含-test</a>
- </td>
- <td align="left">
- <img align="middle" style="cursor: hand" onclick="javascript:funOpenLinkPartReshCfm('userViewShow','list','account','act','delview','forward','delListId=145PTOG3VS&reshflag=0');" alt="删除" src="/common/images/icon_clear.gif" />
- </td>
- </tr></table>
复制代码 现在想删除名称为“QTP-客户名称-非空-”的项目,已查出其在第2行,想点击第2行第2列的删除图片,求教脚本应该怎么写?
我按照论坛里搜索到的通过ChildItem获得指定单元格中的链接对象,并点击的方法去尝试了,结果报“缺少对象”。使用脚本如下-
- Dim objDelTable, objDelButton
- Set objDelTable = Browser("TEST").Page("TEST_2").Frame("Frame").WebTable("待删除的项目")
- Set objDelButton = objDelTable.ChildItem(intRow, intCol, "Link", 0)
- objDelButton.click
复制代码 后来我以为因为table中存放的是图片,就将第3行修改为-
- Set objDelButton = objDelTable.ChildItem(intRow, intCol, "Image", 0)
复制代码 依然报“缺少对象”的错误。我这里实在是搞不明白了。请各位前辈指点,告知正确的方法。
[ 本帖最后由 flankerzhou 于 2010-3-25 16:37 编辑 ] |
|