标题: 请教:QTP对象不能识别 [打印本页] 作者: caibei 时间: 2010-6-2 11:18 标题: 请教:QTP对象不能识别 代码如下:
Dim sheetname, i, rowcount
sheetname = datatable.GetSheet(dtlocalsheet).Name
datatable.ImportSheet "E:\TEST\Excel.xls", "Sheet1", sheetname
rowcount = datatable.GetSheet(dtlocalsheet).GetRowCount
i = 0
Do until i>rowcount
i = i+1
datatable.GetSheet("Action1").SetCurrentRow(i)
Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").WebEdit("userName").Set datatable("Login", dtlocalsheet)
Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").WebEdit("password").Set datatable("Pwd", dtlocalsheet)
Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").VirtualButton("login_button").Click
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").Select datatable("FromPort", dtlocalsheet)
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebRadioGroup("servClass").Select "Business"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Image("findFlights").Click 7,10
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("outFlight").Select "Blue Skies Airlines$361$271$7:10"
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("inFlight").Select "Blue Skies Airlines$631$273$14:30"
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Image("reserveFlights").Click 32,11
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passFirst0").Set "f1"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passLast0").Set "f2"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("creditnumber").Set "1000"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("pass.0.meal").Select datatable("Meal", dtlocalsheet)
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Image("buyFlights").Click 6,15
Browser("Welcome: Mercury Tours").Page("Flight Confirmation: Mercury").Image("Logout").Click
Loop
脚本运行完毕后,出现错误提示框:“Cannot identify the object "fromPort"(of class WebList). Verify that this object's properties match an object currently displayed in your application”