开发者

c# Pausing between sendkeys

I'm doing some automation on a Java-based web page that needs to do some validation between entries, so I thought I'd just do a Thread.Sleep between each SendKeys.Send, but for some reason it just sleeps for 10 secs (10 x 1sec pauses) as it loads the page and then shoots through the whole form without pausing in between each keypress.

Anyone any ideas why it's doing this, or any suggestions for an alternative way of开发者_JAVA百科 achieving a pause between sendkeys?

Thread.Sleep(1000);
SendKeys.Send("{TAB}");
Thread.Sleep(1000);
SendKeys.Send(strTEST);

this is on a browser_DocumentCompleted event


To pause, you want to use the SendWait function instead of SendKeys: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.sendwait(v=VS.90).aspx

SendKeys queues all the keys up and processes them later, as you are seeing. SendWait processes them and returns.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜