Forum Discussion

puyopuy's avatar
puyopuy
Contributor
14 years ago

WaitAliasChild error

Hi there,



I'm trying to use WaitAliasChild for TestComplete 8 with the following scripts.  It return in a second with error "The object does not exist. See Additional Information for details." even I expect to wait for 10 mins.   



var AliasObj = Aliases["myApp"]["pnlMain"]["pnlControls"]["pnlBackNextCancel"];

  if (AliasObj["WaitAliasChild"]("btnNext", 600000)["Exists"]())

  {

   AliasObj["btnNext"]["Click"]();

  }



Any help is much apprecaited.

  • Hi puyo,





    What do you see in the 'Additional Information' panel? Please post its contents here.


  • Hi Allen,



    Thanks for your quick response.



    I created a new project and copy WaitAliasChild example to create a new function and added Notepad.exe to Aliases.  An exception happen at line 6 without waiting for 10 seconds.



    function TestNotePad()

    {

    // Specifies the Alias object

      var AliasObj = Aliases["notepad"];

      // Checks whether the Font window has appeared within 10 seconds

      if (AliasObj["WaitAliasChild"]( "dlgFont", 10000 )["Exists"]() )

        Log["Message"]("The Font window has appeared")

      else

        Log["Error"]("The Font window has not appeared.");


    }


    Please see attached images for details.



    Thanks
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Replace your code with this:





    function WaitAliasChildExample()

    {

      // Specifies the Alias object

      var AliasObj = Aliases["notepad"];

      // Checks whether the Font window has appeared within 10 seconds

      if (AliasObj["WaitAliasChild"]( "dlgFont", 10000 )["Exists"] ) 

        Log["Message"]("The Font window has appeared")

      else

        Log["Error"]("The Font window has not appeared.");

    }




    Note that on the line generating the error, I got rid of the open and close parenthesis on the Exists property.  It's a property and not a method and so it does not get that empty paren call.



    This looks like a minor typo in the help files.