click doesnot happens to a WPF control.

Oct 15, 2012 at 2: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");
button.click();

Regards,

Anand

Oct 15, 2012 at 3: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

 

Throndorin

Oct 17, 2012 at 12:32 PM

Thanks Throndorin 

button.RaiseClickEvent works very fine

 

Anand