I want to check that window exists after some actions. I try:
protected override Boolean IsPresent()
{
if (_mainWindow == null)
{
The problem was in version of VS2013. I have installed Update 5 and now TryFind() returns False if object not found.
Exists is not what you want to use. You can use TryFind() instead.
protected override Boolean IsPresent()
{
if (_mainWindow == null)
{
_mainWindow = new WinWindow();
_mainWindow.SearchProperties[WinWindow.PropertyNames.ControlName] = "MainWindow";
}
return _mainWindow.TryFind();
}
For more examples of how to use Coded UI to do various tasks, see my website codeduiexamples.com