QTP实战技能??使用技巧实例
作者:网络转载 发布时间:[ 2013/4/16 9:56:52 ] 推荐标签:
21.网页下拉框的选择
A:For i =1 to10
Randomize
IndexNum=Int((10 - 5 + 1) * Rnd + 5)
Browser("Mercury Tours").Page("FindFlights_2").WebList("arrive").Select "#"&IndexNum
wait(3)
Next
Sub ChildObjects_Example()
'The following example uses theChildObjects method to find all the
'list objects on a Web page, and then toselect an item in each list.
Set ōDesc = Descrīption.Create()
oDesc("micclass").Value ="WebList"
Set Lists = Browser("MercuryInteractive").Page("Mercury Interactive").ChildObjects(oDesc)
NumberOfLists = Lists.Count()
For i = 0 To NumberOfLists - 1
Lists(i).Select i + 1
Next
End Sub
22.将测试数据单独拿出来
A:取得一个
Browser("Browser").Page("").WebList("fid").GetItem(1)
取得全部
Browser("Browser").Page("").WebList("fid").GetROProperty("allitems")
以下可以在自带的例子中实现
Window("Flight Reservation").WinComboBox("FlyFrom:").Select "Frankfurt"
a=window("FlightReservation").wincombobox("Fly From:").GetItem(1)
reporter.ReportEvent 2,"下拉列表的值",a
23.和TD连接
A:在QTP中不是有个Quality Center Connection,选择服务器连接,服务器处输入类似http://computer_name/tdbin,其中computer_name为服务器的名字,连接后在测试结果中添加defect可以与TD相连了。

sales@spasvo.com