cancel
Showing results for 
Search instead for 
Did you mean: 

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

Highlighted
Occasional Contributor

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 5
Highlighted
Community Hero

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
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. 

Highlighted

"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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

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

 

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

Highlighted

I'm paid by the good will of all. 😉


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors