Catching Exception for Object Click
I am trying to add some error handling and tear down functions into my current test scripts. I can't seem to understand how to properly use the try catch block to initiate tear down functions when a web object cannot be found.
Here is an example of what I am trying to do
try {
var browser = Sys.Browser("*");
var Page1 = browser.Page("*");
props = new Array("contentText", "className", "Visible", "VisibleOnScreen");
values = new Array(categoryname, "categoryButton", true, true);
var category = Page1.FindChild(props, values, 30);
category.Click();
Page1.Wait();
}
catch (error) {
Log.Error("Category group error occured");
ClickMyAccount();
Logoff();
}
I found out that if an object is not found, TestComplete does not throw an exception which can be caught, so I am unsure how to proceed from here.
I also have debug agent enabled for my projects.
Any suggestions would be appreciated.