|
DataStr= "G:\data.xls"
Set ExlObj=CreateObject("Excel.Application")
ExlObj.Visible = false
ExlObj.DisplayAlerts = false
Set book=ExlObj.Workbooks.Open(DataStr)
Set sheet=book.Worksheets("Sheet1")
For i=2 to sheet.usedrange.rows.count
systemutil.Run "G:\program files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
UserName=ExlObj.WorkSheets("Sheet1").Cells(i,1)
PassWord=ExlObj.WorkSheets("Sheet1").Cells(i,2)
Dialog("Login").WinEdit("Agent Name:").Set UserName
Dialog("Login").WinEdit("Password:").SetSecure PassWord
wait 1
Dialog("Login").WinButton("Cancel").Click
Next
ExlObj.Quit
Set ExlObj = nothing
根据网上查找的代码自己稍微改了下路劲,但是老是报错
cannot find the “Agent Name:”object's parent "login"(class dialog)Verify that parent properties match an object currently displayed in your application
"cancel"也是这样的原因,谁能告诉我错误怎么改,整个从excel中输入用户名和密码怎么实现,并吧输出结果导出拉,谢谢拉 |
|