click doesnot happens to a WPF control.

Oct 15, 2012 at 1:41 PM

there is a button which opens a new form. using the following code the focus goes to the button but the click doesnot happens. Can anyone explain me Why ?

Window mainWindow = application.GetWindow("Log on");
Button button = window.Get<Button>("Configure");;



Oct 15, 2012 at 2:55 PM

In some cases the test is to fast.

try Thread.Sleep(5000);


before Click()


if  this dont work try button.RaiseClickEvent();


of try Keyboard class with key ENTER



Oct 17, 2012 at 11:32 AM

Thanks Throndorin 

button.RaiseClickEvent works very fine