Ask a Question

Elegant Error Handling -Not Generating an Error

M_Schofer_1111
Occasional Contributor

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

2 REPLIES 2
AlexKaras
Champion Level 2

Hi,

 

And what is the error that is logged for on off script ?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
M_Schofer_1111
Occasional Contributor

IThe process "Chrome1" was not found. 13:39:58 Normal 0.00

cancel
Showing results for 
Search instead for 
Did you mean: