Forum Discussion

martin_facchini's avatar
martin_facchini
Contributor
10 years ago

"If Object Exists" is still running child opeations when object DOES NOT exits

I’m checking to see if our application was left in an open state before running the entire project suite. The test app, 95% of the time, would be left open in one of three main forms: login screen, table layout, or order form.

 

I’ve therefore create three separate “If Object.Exists.Execute child operations if the object exists” actions, which would then take the appropriate steps to close down the application. I then created three test scenarios, where in each case, the forms DO NOT exist, however, in each case, the child operations still continue to run (therefore hanging up the test and then causing the script to fail). (Note: script does work correctly when object does exist)

 

I’ve correctly identified each main form object (I’ve even tried narrowing it down to several “specific” objects on each form), I’ve correctly >indented the child operations (see attached), and I’ve even broken-out the If Object statement into a separate test, which then calls the appropriate action test (see attached), but I’m still getting the same problem.

 

Is there something I’m missing?

 

PS I’m not seeing an If/Else command, which would allow the action to step out and move onto something else, so I’m presuming that as per the applied logic in the statement “ Execute child operation if the object exists”, that the converse would also be true, in that the child operations WILL NOT execute if the object does NOT EXIST.

 

if object 2.pngif object 5.png

 

if object 3.png

  • Ryan_Moran's avatar
    Ryan_Moran
    10 years ago

     

    You can use the If Object wizard under Test Actions for your keyword test. It should then have the Visible property available to select from on the Select Condition page of the wizard. If you're not using keyword tests then your script should be like so:

     

    //JScript

    function main() {
     if (Aliases.PixelPointPOS.wndSystemObject.FormShape_InnerPanel.Panel.PixelButton.Visible == true){
      //dostuff
     }
    }

     

     

    //Make sure you spell it VISIBLE :)

     

     

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    It looks like you are trying to check if the object on a panel still exists (according to the alias in your screenshot).

    If this is the case the object may very well exist still but may not be visible.

    Try checking the objects visible property instead.

    The other possibility is that you may need to call the refresh method to the form using the Call Object Method.

    • martin_facchini's avatar
      martin_facchini
      Contributor

      you are right.  :-D  the object(s) Exist, but are not set to Visable

      Therfore, how would you use If Object to check against a property?  The Test Action itself does not allow you to drill down to the ojebect's properties. 

       

      I've tried the follwing in the command line, but If Object does not understand what I'm trying to do:

       

      • Aliases.PixelPointPOS.wndSystemObject.FormShape_InnerPanel.Panel.PixelButton.Visable
      • Aliases.PixelPointPOS.wndSystemObject.FormShape_InnerPanel.Panel.PixelButton.Visable=true

       

       

      • Ryan_Moran's avatar
        Ryan_Moran
        Valued Contributor

         

        You can use the If Object wizard under Test Actions for your keyword test. It should then have the Visible property available to select from on the Select Condition page of the wizard. If you're not using keyword tests then your script should be like so:

         

        //JScript

        function main() {
         if (Aliases.PixelPointPOS.wndSystemObject.FormShape_InnerPanel.Panel.PixelButton.Visible == true){
          //dostuff
         }
        }

         

         

        //Make sure you spell it VISIBLE :)