QTP_每天进步一点点

上一篇 / 下一篇  2010-03-09 21:50:04 / 个人分类:QTP学习历程

    真正的开始学习QTP有一小段时间了,而真正的乐趣在于每天都有那么一点点的收获.写这日志的时候才想到,原来今天是到公司三周年的纪念日,不容易啊.这中间的矛盾和纠结.太多太多了.呵呵.记得刚到公司的时候,有一条就是"每天进步一点点".呵呵.也许只有以这样的心态,才能够知足常乐,才能够坦然一些.

    小小收获:

    1)取DataTable的值,借用QTP Help将相关描述贴在如下;

     今天使用的语句:Start=DataTable.Value(1,Global)

   

QuickTest Professional Object Model Reference

Value Property

Description

DataTable default property. Retrieves or sets the value of the cell in the specified parameter and the current row of the run-time Data Table.

Note: This property returns the computed value of the cell. For example, if the cell contains a formula, the method returns True or False.

Syntax

To find the value:

DataTable.Value(ParameterID[,SheetID])

or

DataTable(ParameterID[,SheetID])

To set the value:

DataTable.Value(ParameterID[,SheetID])=NewValue

or

DataTable(ParameterID[, SheetID])=NewValue

Argument

Type

Description

ParameterID
Variant
Identifies the parameter (column) of the value to be set/retrieved. Index values begin with 1.
SheetID
Variant
Optional.Identifies the sheet to be returned. The SheetID can be the sheet name, index ordtLocalSheet, ordtGlobalSheet.
If no Sheet is specified, the first sheet in the run-time Data Table is used (global sheet). Index values begin with 1.
NewValue
String
Sets the value for the specified table cell.

Example

The following example uses the Value property to set the value in the current row of the Destination parameter (column) in the "ActionA" sheet in the run-time Data Table.

DataTable.Value ("Destination", "ActionA")="New York"

The following example uses the Value property to set the value in the current row of the second parameter (column) in the third sheet.

DataTable.Value (2,3)="New York"

Note: You could omit the wordValuein the statements above, becauseValueis the default property for the DataTable object.

The following example uses the default property to set the value in the current row of the Destination parameter (column) in the current (active) local sheet.

DataTable("Destination", dtlocalSheet)="New York"

   2)由于QTP9.2原来自带的的订机票网站(http://newtours.mercury.com)打不开,而录脚本都是在此网站上进行录的,现在改成http://newtours.demoaut.com后,需要做相应的修改才能正常回放,我在脚本开始之前使用以下SystemUtil语句:

SystemUtil.CloseProcessByName("iexplore.exe")
SystemUtil.Run "iexplore.exe","http://newtours.demoaut.com"

    加了以下语句后,之前录制的脚本能够正常回放.

    3)将原来录制脚本中的文本检查点终于弄正确了..但我是使用关键字视图完成的.关于自己写代码去完善的.还需要看到此日志的各位大侠献策.呵呵.在此感谢!

   


TAG:

 

评分:0

我来说两句

Open Toolbar