Desktop Applications

Terminate Process

If you start application using Global.DoLaunch then you can close it using Global.DoKillByPid.

Send Keyboard Shortcut

When application is an active window you can send Alt-F4 key combination to close it.


You can also use any object within application window to send the shortcut.


Learn Close Button

If you are testing the application via UIAutomation library you can learn Close button and click on it in your test.

Note: this method does not work with Managed library (if you are testing a C# application).


Web Applications

To close browser window use Navigator.Close.