Ok so I am running tests in WatiN and I am using the SendKeys method. According to the MSDN website I can enter:
System.Windows.Forms.SendKeys.SendWait("{LEFT 2}");
And this will enter left two times. This however does not work, I believe because the application needs time between each keypress. I order to do what I need the program to do I used Thread.Sleep between each keypress to ensure they were getting read. Is there a more efficient/proper way to do this? This is my current method code:
System.Windows.Forms.SendKeys.SendWait("{LEFT}");
Thread.Sleep(500);
System.Windows.Forms.SendKeys.SendWait("{LEFT}");
Thread.Sleep(500);
System.Windows.Forms.SendKeys.SendWait("{ENTER}");
Unfortunately, I don’t believe there is. According to MSDN there are timing issues with SendKeys:
You could try changing between implementations to see if there is a change in your results.
Alternately, according to this post just using
Thread.Sleep(0);after your input should work. Not the most elegant solution but if it works it would be faster than a 500ms pause.