Forum Discussion

AdamUK's avatar
AdamUK
Occasional Contributor
6 years ago

Objects that don't exist pass when a check is made against their property?

It seems if I need to check the value of say the 'Visible' property is true against an object that hasn't been rendered onscreen yet then TestComplete will consider the check passed and continue on its way.  

 

Is that expected?  What might I be doing wrong? 

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It depends, a lot, upon how your developers coded your web application to determine "visible" or not.  If they are actually setting the "visible" attribute of the component to "true" or "false", then the "Visible" check will work.  However, sometimes developers choose to, instead, set the size properties of the object, making it a height and width of 0.  Technically speaking, the "visible" attribute is still "true" even though you can't see it on screen.

     

    Double check exactly how the component shows up in the Object browser when your "Visible" checks pass to determine how things are being rendered.  If "Visible" is true, then visibility check is not going to work for you and you may need to find some alternative means like checking the height, width, color, etc., properties.

  • AdamUK's avatar
    AdamUK
    Occasional Contributor

    I asked a developer and we typically use a 'Display' property as the first display property and then some Javascript on the top to show/hide.  

     

    TestComplete has seemingly relevant properties like Enabled, Exists, Visible and VisibleOnScreen but I'm not sure how it determines them and none work in my test scenario. 

     

    Thanks for your response. 

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      "Exist" returns true if the object can actually be found in the object tree.  False if it cannot.

       

      "Enabled" and "Visible" are determine more based upon attribute settings of the UI component.  I'm not certain of the algorithms used to make that determination but it's possible that the methodology that your developers are using are not triggering the proper attributes.

      Another possibility - If there's JavaScript that runs on top, it could be possible that the page loads as "complete" but the JavaScript could still be running.  So, this could be a timing issue where the component may not be marked as "Visible = false" right away and so it identifies as Visible.

       

      So, the answer to your problem is this: You will need to do some in depth investigation of your components to determine either whether the issue is due to timing OR if you need to use some alternative means to determine "visibility" based upon how your developers implemented the component.

  • AdamUK's avatar
    AdamUK
    Occasional Contributor

    Thanks, that's good advice and I will do. 

     

    Cheers for all your help, I hope Smart Bear are paying you!