2010-01-07 34 views
1

回車鍵如何錄製ENTER鍵,我們通過鍵盤在QTP使用的應用程序記錄在QTP

回答

2

我假設你想重播輸入關鍵,在大多數情況下,當QTP不記錄一個動作比手動添加步驟要比強制QTP記錄更好。

如果有問題的測試對象支持,你可以使用Type說:

Window("Calc").Type micReturn 

否則,您可以使用DeviceReplay對象作爲this article

Set dr = CreateObject("Mercury.DeviceReplay") 
dr.PressKey 28 ' 28 = Return (Enter) 
1

另一個選項描述重播輸入按鈕按將簡單地使用Windows腳本宿主對象的SendKeys方法。代碼看起來像這樣:

Dim WshShell 
Set WshShell = CreateObject("WShell.script") 
WshShell.SendKeys "{ENTER}" 
Set WshShell = Nothing