after a lot of thinking on the post my actual question can be summed up with a single question.
What is the best way if an error occurs within a for each loop to document the error and continue on in the loop without killing the automation?
I have a “for each row in datatable loop” and within that loop a great number of types and kinds of errors can occur, through no fault of the automation.
When an error occurs I would like to be able to do some logging on the error, kill the application, navigate back to the beginning, and carry on with the next row.
most of the errors will be caused by unexpected screens popping up, screens failing to load properly, and the application i am automating being lukewarm garbage.
thank you Kindly in advanced for looking over this. any help or questions or suggestions would be appreciated.
I will leave the below for posterity. but isn’t necessary for the question above.
I am building an automation for an older electronic medical record system to create new visits and add some documentation on those visits. the build looks something like this. note: it is not an html or web based application, but the UI Explorer does give really good selectors 90% of then time. also based in the US for questions and comments about insurance.
bulk of the automation is
for each patient in table
record account number and charge succesful
loop back to the next patient
my issues are multiple
the EMR is prone to hanging up, taking its time, and other odd issues.
i have mostly resolved the above with retry scopes on problematic buttons
incomplete patient demographics. the system REQUIRES certain key pieces of information match or be present for a new patient visit or it will throw “Fatal Edits”. insurance numbers etc, once this happens the options are. 1 fix the edits 2. kill the program, record errors, restart on next patient. i am handing this with a flowchart that does 2 and will eventually with updating the simple Fatal edits.
Screen Hanging, just the programs screens kind of hanging up in weird odd moments. the system does this occasionally during normal use but the automation seems to aggravate the issue. right now default interactions seems to work the best. Not using windows messages or simulating clicks.
as an over all solution i think i am going to star using a lot more try catch, a feature i am not very familiar with maybe a try catch just with in the patient loop that will document the error, where and who it happened on. close the program, restart and move it back to the beginning then carry on with the next patient.