Forum Discussion

M_Schofer_1111's avatar
M_Schofer_1111
Occasional Contributor
12 months ago

Elegant Error Handling -Not Generating an Error

All the documentation says this should not generate an error.

PYTHON

try:
p = CurrPage.FindElement("//font[.='Purchase Types']")
w = p.WaitWindow("*", "Open*", -1, 10000);
if w.exists:
w.Activate
Log.Warning("Found Purchase Date' Header")
else:
Log.Warning("No purchases are posted for this member")
except Exception as e:
myErrMessage = JCCommon.capture_error(e)
Log.Error(myErrMessage)

 

It does

 

Then I went to an "easy" example from the website.

 

And wrote this on off script. and still throws an error message into the log. 

 

p = Sys.Process("Notepad")
# Waits for the window for 10 seconds
w = p.WaitWindow("*", "Open*", -1, 10000)
if w.Exists:
  w.Activate
  Log.Picture(w, "Open dialog picture")
else:
  Log.Warning("Incorrect window")

 Is there a configuration I am missing.  or are my fingers too fat for the keyboard. 

This sounds like a small issue, but people testing don't want to see errors in the logs. (That is an indicator of a successful test.)