Forum Discussion

rbhogavalli's avatar
rbhogavalli
Occasional Contributor
10 years ago

How to remove Obj wait time

safdsf




Function Pest_Engines_List_Test()


Dim pest, treeView, Child, ParcelEngines,pItems, pItem, onEngines()


Set toolStripContainer = Aliases.pest.MainWindow.toolStripContainer


Set treeView = toolStripContainer.ToolStripContentPanel.splitContainer.SplitterPanel.SelectorPanel.treeView


 


 


Call treeView.ClickItem("|ProShip Configuration")


Set ParcelEngines = treeView.witems.Item("ProShip Configuration").items.Item("Parcel Engines")


'ChildCount = ParcelEngines.items.Count


  Redim onEngines(ParcelEngines.items.Count)


For i = 0 To ParcelEngines.items.Count -1


      Set pEngine = parcelEngines.items.Item(i)


   pEngine.Select()


If toolStripContainer.ToolStripPanel.ToolStrip.Turn_Off_Engine.Exists Then


  onEngines(i) = pEngine.Text 


      Log.Message ("Parcel engine" & pEngine.Text & "is On and need to be tested")





At this statement 

If toolStripContainer.ToolStripPanel.ToolStrip.Turn_Off_Engine.Exists

if the object  "Turn_Off_Engine" dosen't exists, itefore processing the the loop.

I didn't insert any wait time specifically.

How can i remove this wait time. 



 

3 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Use WaitAliasChild:



    If toolStripContainer.ToolStripPanel.ToolStrip.WaitAliasChild("Turn_Off_Engine").Exists Then

  • According to the Testcomplete documentation “… the Exists property must always be used in combination with a WaitNNN method.”  (Look up “existence” in the Help system and go to the bottom of the page.)  What this means is that instead of coding something like this

     

    if (Aliases.PPSSuite.FormLogin.Exists) {

    // some code

    }

     

    you should always code something like this

     

    if (Aliases.PPSSuite.WaitAliasChild(“FormLogin”).Exists) {

    // some code

    }

     

    The incorrect coding causes problems for Testcomplete.  I see this problem show itself in the form of slow command execution.  Operations that are incorrectly coded take a few seconds to execute.  When correctly coded they happen instantly.