Ask a Question

Object's 'Exists' property returns false while the object still exists and visible on the UI

Adagio
Frequent Contributor

Object's 'Exists' property returns false while the object still exists and visible on the UI

Hi,

 

Lately, I've been having issues with one of the program where I check the availability of an Object on the UI using the Exists property. The object is present on the UI and still the 'Exists' returns false. I've tried debugging it but still the same and not able to figure out why. It's has been working well till date, and suddenly behaving weird. 

 

The object's alias mapping hasn't changed at all.

 

Any help would be appreciated.

 

Thank you!!

5 REPLIES 5
Wamboo
Community Hero

Hi, can you give us code example?

Adagio
Frequent Contributor

  Hi  @wam, 

It just a conditional statement after the wait statement. The problem is, max wait is 20 seconds, and it's not able to identify the object on the UI (20 seconds later even when the object appears on the page within 5 seconds). Even though the Alias mapping hasn't changed.

 

progLib.waitForVisibility(buttonClx);

if(buttonClx.Exists){
buttonClx.ClickButton();

}

 

Thank you!!

tristaanogre
Esteemed Contributor

Hi (been a while...but here I am).

waitForVisibility appears to be custom code.  So, it's hard to say what's going on here without knowing what's happening in the other code.  You mention a "max wait" of 20 seconds, I'm assuming that's in that same waitForVisibility.  What happens after 20 seconds and it's still not visible?

 

Additionally, it would be nice to see some more information about the object.  You say that the mapping hasn't changed... but has the application under test changed?  It could be visible, to you, on screen but the automation may not be able to find it due to some other factors.

 

To help more:

 

1) Can we see the code for waitForVisibility?  Please post it.

2) Can you post a screenshot of the Object Browser of the object in question so we can see the full properties and hierarchy in the object tree?

3) Can you post a screenshot of the mapping criteria you're using for the object?  Please make sure to include the NameMapping hierachy tree (as opposed to the Alias tree) for the object in question so we can see the relationship to other objects.


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

Hi,

 

In addition to Robert's reply:

If the buttonClx is recreated in-between it was initially found and .Exists verification, than this is correct behavior of TestComplete just because the initial object was destroyed and thus does not exist.

If the above is your case than you must search for the buttonClx button again after it was recreated.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sonya_m
SmartBear Alumni (Retired)

Thanks everyone for participating in the discussion! Welcome back, Robert🙂

 

@Adagio please let us know if this answers your question!


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: