Object destroyed using .Keys in TestComplete 12 and TC12.5
I'm having an issue where a VBScript script worked fine for years in previous versions of TC but often, but not regularly fails in TC12 and TC12.5. The point where it fails is always using .keys. Here are parts of the function:
function selectMenu(strMenuNumber,TimeOut)
If Sys.WaitProcess("QAD.Client", TimeOut).WaitWinFormsObject("ShellForm", TimeOut).Exists Then
Set QADNetUI = Sys.Process("QAD.Client").WinFormsObject("ShellForm")
If QADNetUI.WaitWinFormsObject("MdiClient","", TimeOut).Exists Then
Set MainGrid = QADNetUI.WinFormsObject("MdiClient","")
Else
Err.Raise 775,"selectMenu::WaitWinFormsObject(MdiClient, TimeOut)", "can not find MdiClient"
exit function
End If
Set MenuBar = QADNetUI.WinFormsObject("pnlTopHeaderParent")._
WinFormsObject("pnlTopHeader").WinFormsObject("_mnuShellMenuBar")._
WinFormsObject("_ShellMenuBar_Toolbars_Dock_Area_Top")
Set SearchBar = QADNetUI.FindChild("ClrClassName", "UltraTextEditor", 20)
.
.
.
'Enter the menu name, number or file name and run it
If QADNetUI.Exists Then
With SearchBar
.SelectAll()
.keys"[Del]"
delay 2000
Log.Message("Menu Number = " &strMenuNumber)
.set_Text(strMenuNumber)
delay 2000
.keys"[Enter]"
End With
delay 3000
Else
Err.Raise 777, "selectMenu::QADNetUI.Exists", "Can not find SearchBar"
End If
Else
Err.Raise 778, "selectMenu::WaitWinFormObject(QAD.Client, TimeOut)", "Can not find QADNetUI"
End If
End function
The script often, but not always stops at either of the .keys lines with the message; "The object was destroyed during method execution."
I have a workaround (it's kind of ugly), so I'm not looking for that. It just seems that TC12 and above has a problem with .keys that was not in earlier releases. I'm wondering if others are seeing this same behavior.