Sub Select_Example()
'The following example uses the Select method to select the item 22
'from the Size combo box.
Window("Notepad").Dialog("Font").WinComboBox("&Size:").Select "22"
'or
Window("Notepad").Dialog("Font").WinComboBox("&Size:").Select 7
End Sub作者: 1qazse4 时间: 2008-1-16 16:10
多谢linweiyan兄
但是我的flight4a.exe识别的控件WinCombox的名称是:"Departure Time:",“fly from”的类型是text
谢谢Walker版主:
我下面重新发段代码,附上错误信息
Cannot identify the object "Arrival Time:" (of class WinComboBox). Verify that this object's properties match an object currently displayed in your application.
Object's physical description:
Native Class = ComboBox
Items Count = 10
Attached Text = Arrival Time:
Object's physical description:
Native Class = ComboBox
Items Count = 10
Attached Text = Arrival Time:作者: 1qazse4 时间: 2008-1-16 16:12
下面是新的代码,代码是自己先识别Objects,然后在KeyWord View试图里一步一步设计的
'激活敞口,如果对话框Login没有打开,则系统调用将其打开运行
If not Dialog("Login").Exist Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
'激活对话框Login
Dialog("Login").Activate
'在文本编辑框Edit内输入内容“Mercury”
Dialog("Login").WinEdit("Edit").Set "mercury"
'在文本编辑框Password内输入内容“Mercury”
Dialog("Login").WinEdit("Password:").Set "mercury"
'单击OK按钮
Dialog("Login").WinButton("OK").Click
'激活窗口Flight Reservation
Wait(2)
Window("Flight Reservation").Activate
'在日期输入框Flight No:内输入时间类型的值
Window("Flight Reservation").WinObject("Flight No:").Type "071111"
'声明一个函数GetList
Function GetList(i)
Randomize
GetList=RandomNumber(0,i)
End Function