joffre
12 years agoRegular Contributor
TestComplete 9.30 WebApp Testing
Hi all.
I'm trying to create a conditional that will verify if an object exists or not. However, on web applications, the web objects always exists in frame, but it's shown to the user on browser just when it is required.
How can I test if it is visible or not?
I already tried like this, but it didn't work:
I'm trying to create a conditional that will verify if an object exists or not. However, on web applications, the web objects always exists in frame, but it's shown to the user on browser just when it is required.
How can I test if it is visible or not?
I already tried like this, but it didn't work:
if ((Sys.Browser().Page(Beneficios).Form("form1").Panel(3).Panel("pnlcapslock").Panel("divInconsistencia").Panel("divFecharInconsistencia")).Visible) {
Sys.Browser().Page(Beneficios).Form("form1").Panel(3).Panel("pnlcapslock").Panel("divInconsistencia").Panel("divFecharInconsistencia").Click();
Log.Error("Object found");
} else {
Log.Message("Object didn't found. Proceed with tests.");
}
- First you need to make sure that object exists. In your case you can use WaitPanel method.
http://support.smartbear.com/viewarticle/28602/
This method returns an object and you can verify its Exists property. After this you can make sure that object is visible on screen. Something like this
var obj = Sys.......WaitPanel(..., ...);
if (obj.Exists && obj.VisibleOnScreen)
{
obj.Click();
}