Close Application

Ask general questions here.
Posts: 6
Joined: Wed Jul 12, 2017 11:25 am

Close Application

Post by karthikprs » Wed Aug 30, 2017 12:45 pm


I found from one of the posts in the forum that to close an application, the code

Code: Select all

Host.Local.CloseApplciations(String ProcessName);
But in my application I've a validation done by a message box with Message
Do you want to close the application
with Yes and No buttons.

The code module does not perform the actions coded for the clicking of Yes or No button.

Request your help on that.

Last edited by karthikprs on Fri Sep 01, 2017 8:27 am, edited 1 time in total.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12172
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Close Application

Post by Support Team » Wed Aug 30, 2017 7:56 pm

Hi Karthikprs,

Since Ranorex detects your application did not fully close as expected with the CloseApplication method, it throws an exception and fails your test. To bypass this, throw the CloseApplication line in a try/catch block. When it fails (due to the popup), let it continue to your code clicking the 'Yes' button and continue your test.

I hope this helps!