Forum Discussion

nbenitus's avatar
nbenitus
Contributor
14 years ago

Object not recognized during playback when function has parameter?

Hi,



I am doing a really simple script, I enter some text in a text field, then press enter. Here is my function:



Sub Make_Call_Parameter(x)

  Aliases.SMC.main.mainInside.ContainerCalls.Afx.Container.Container.ContainerCallDock.Main_Window_Call_Container.ComboBox.txtCall.Keys("abc" + "[Enter]")

 

End Sub



The problem is that as soon as the function as a parameter (even if not used), the text field can not be recognized. However, if I remove the parameter X from the function, everything works fine.



Is there a reason why the function won't work with a parameter?



Thanks in advance.

5 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor
    What do you mean by "function doesn't work"? That you can't run it separately (e.g. right click on it and select menu item "Run Make_Call_Parameter")?

    In this case this is an expected behavior, you can't run function with parameters this way. In order to run function with parameters, you need to create a new one without parameters and then call function with parameter from there.



    Is it what you meant? If no, please describe what exactly doesn't work.

  • Hi Benoit,





    Can you reproduce this situation with Notepad?





    Please post here the actual script you use to call the function. Also, please post here the text of the error along with the text from the Remarks pane you get when the problem occurs.
  • Thanks Gennadiy and David for your answers.



    I am afraid I don't have much more info to add.



    I run the Make_Call_Parameters from script, as seen below:



    Call Make_Call_Parameter("abc")



    I don't see any error message, it just hangs looking for the object. That's what I mean by "it don't work", the fact that the object is not recognized.



    However, if I change my script to the following, it works:



    Sub Make_Call_Parameter() <----- See the absence of parameters in this function now.

     
    Aliases.SMC.main.mainInside.ContainerCalls.Afx.Container.Container.ContainerCallDock.Main_Window_Call_Container.ComboBox.txtCall.Keys("abc"
    + "[Enter]")

     

    End Sub



    I hope it is clearer.

  • Hi Benoit,





    The interesting point is which exactly object cannot be found. TestComplete tries to get an object for the time specified by the 'Auto-wait timeout' option. You can find this option in the Playback options group of your project properties editor. To open the editor, double-click the project node in the 'Project Explorer' panel and switch to the 'Properties' page.





    If TestComplete cannot find an object within the specified timeout, it posts an error to the test log. Please post here the exact test of this error and the description of the error which can be found in the Remarks pane.





    Also, you have not answered whether you tried to reproduce the problem with Notepad. Have you tried this?
  • Thanks David.



    I finally found the issue, because of the error you asked to me look at.



    I will look at that information in more details :).