51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3011|回复: 11
打印 上一主题 下一主题

[原创] 再提个难题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2005-4-20 14:49:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
各位观众请看题:
我能不能把QTP中的ITEM(图1中的AUTOTEST_减免税申请审批表)这列给参数化了,因为我每次都要点击不同的标题(图2),图2中的表是动态的,因此每次的标题会改变,比如下次变成AUTOTEST_退税申请表,什么的,那QTP就不认识了。如何解决!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏

该用户从未签到

2#
发表于 2005-4-20 15:02:33 | 只看该作者
不会,混贴的
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2005-4-20 15:13:18 | 只看该作者
白让我兴奋一下,呵呵,等会的!
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2005-4-20 15:28:54 | 只看该作者
贴子发错地方了,应该到QTP区,怎么转过去啊?
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2005-4-21 12:17:59 | 只看该作者
搞定。
前面不是有人说过处理动态link的问题么?

先录下点击某行的脚本,然后改。
先要让QTP知道这个表格WebTable,简单的办法是录完了,添加一个checkpoint.
check 这个表格。(就是在表格上点右键,然后选第一个,然后选整个的表格。)

ok,然后,这时候,QTP就知道这个webtable了。
估计你用object spy抓也可以。

然后,写个循环。循环取出表格中某列的文字。
然后用处理动态link的办法,SetTOProperty就可以了。

iRowCount=4
For i=1 to iRowCount
  linksname=Browser("xxx").Page("xxx").WebTable("xxx").GetCellData(i, 1)
(这里的GetCellData(i, 1),我假设了连接在每行的第一列)
  linksname=cstr(linksname)
  Browser("xxx").Page("xxx").Link("xxx").SetTOProperty "text",linksname
  Browser("xxx").Page("xxx").Link("xxx").Click

Next       

但是抱歉,我不知道如何取得webtable的行数,好像函数中只有取列数的。
谁能告诉我啊,那样就不用定义iRowCount了。

[ Last edited by lovetest6 on 2005-4-21 at 12:21 ]
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2005-4-21 13:00:55 | 只看该作者
相应的问题又出来了,这样点的连接如何检查呢?
我上面的例子是按照我的菜单写的,左边有个菜单,上面有很多内容,点了以后,右边的页面做相应的变动。
可是我怎么断定这也页面的变动是正确的呢?
QTP是应该这样用的么?呵呵。
当然了,如果只是检查连接是否正确,用webQA就可以了,但是我们要验证页面上的内容是否也正确啊,应该怎么做呢?QTP是用来做这个的么?呵呵。
回复 支持 反对

使用道具 举报

该用户从未签到

7#
 楼主| 发表于 2005-4-21 17:02:43 | 只看该作者
请问:Browser("xxx").Page("xxx").Link("xxx").SetTOProperty "text",linksname
是做什么的
回复 支持 反对

使用道具 举报

该用户从未签到

8#
发表于 2005-4-21 17:09:37 | 只看该作者
做什么的??
不知道,看看手册

Retrieving and Setting Test Object Property Values
Test object properties are the set of properties defined by QuickTest for each object. You can set and retrieve a test object's property values, and you can retrieve the values of test object properties from a run-time object.

When you run your test, QuickTest creates a temporary version of the test object that is stored in the test object repository. You use the GetTOProperty, GetTOProperties, and SetTOProperty methods to set and retrieve the test object property values of the test object.

The GetTOProperty and GetTOProperties methods enable you to retrieve a specific property value or all the properties and values that QuickTest uses to identify an object.

The SetTOProperty method enables you to modify a property value that QuickTest uses to identify an object.

Note: Because QuickTest refers to the temporary version of the test object during the test run, any changes you make using the SetTOProperty method apply only during the course of the test run, and do not affect the values stored in the test object repository.

For example, the following statements would set the Submit button's name value to my button, and then retrieve the value my button to the ButtonName variable:

Browser("QA Home Page").Page("QA Home Page").WebButton("Submit").SetTOProperty "Name", "my button"

ButtonName=Browser("QA Home Page").Page("QA Home Page").WebButton("Submit").GetTOProperty("Name")

You use the GetROProperty method to retrieve the current value of a test object property from a run-time object in your application.

For example, you can retrieve the target value of a link during the test run as follows:

link_href = Browser("Mercury Technologies").Page("Mercury Technologies").Link("Jobs").GetROProperty("href")

Tip: If you do not know the test object properties of objects in your Web site or application, you can view them using the Object Spy. For information on the Object Spy, see Understanding the Test Object Model.

For a list and description of test object properties supported by each object, and for additional information about the GetROProperty, GetTOProperty, GetTOProperties, and SetTOProperty methods, refer to the QuickTest Professional Object Model Reference.

[ Last edited by lovetest6 on 2005-4-21 at 17:18 ]
回复 支持 反对

使用道具 举报

该用户从未签到

9#
 楼主| 发表于 2005-4-21 17:26:47 | 只看该作者
奇怪,我的手册里没有这些!
不过有这句:Returns a TestSettings object, which enables you to configure test- and component-specific settings
回复 支持 反对

使用道具 举报

该用户从未签到

10#
发表于 2005-4-22 09:20:25 | 只看该作者
不会吧??一定有的啊,呵呵,我这个是QTP82里面的手册。
就是从这里下载的。
回复 支持 反对

使用道具 举报

该用户从未签到

11#
发表于 2008-11-6 16:33:28 | 只看该作者
原帖由 developing_T 于 2005-4-21 17:02 发表
请问:Browser("xxx").Page("xxx").Link("xxx").SetTOProperty "text",linksname
是做什么的

就是将Link的"linksname"属性值设置为"text"
回复 支持 反对

使用道具 举报

该用户从未签到

12#
发表于 2008-11-6 16:54:26 | 只看该作者
原帖由 lovetest6 于 2005-4-21 12:17 发表
搞定。
前面不是有人说过处理动态link的问题么?

先录下点击某行的脚本,然后改。
先要让QTP知道这个表格WebTable,简单的办法是录完了,添加一个checkpoint.
check 这个表格。(就是在表格上点右键,然后选第 ...

Browser().Page().WebTable().RowCount可以得到table的行数的
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-10 10:55 , Processed in 0.080756 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表