Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6974769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:16:51+00:00 2026-05-27T17:16:51+00:00

Ok so I am running tests in WatiN and I am using the SendKeys

  • 0

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}");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:16:52+00:00Added an answer on May 27, 2026 at 5:16 pm

    Unfortunately, I don’t believe there is. According to MSDN there are timing issues with SendKeys:

    The SendKeys class is susceptible to timing issues, which some
    developers have had to work around. The updated implementation is
    still susceptible to timing issues, but is slightly faster and may
    require changes to the workarounds.

    The SendKeys class tries to use
    the previous implementation first, and if that fails, uses the new
    implementation.

    As a result, the SendKeys class may behave differently
    on different operating systems. Additionally, when the SendKeys class
    uses the new implementation, the SendWait method will not wait for
    messages to be processed when they are sent to another process.
    If
    your application relies on consistent behavior regardless of the
    operating system, you can force the SendKeys class to use the new
    implementation by adding the following application setting to your
    app.config file.

    <appSettings> 
      <add key="SendKeys" value="SendInput"/> 
    </appSettings> 
    

    To force the SendKeys class to use the previous implementation, use the value “JournalHook” instead.

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just got started running UI tests against my ASP.NET MVC application using WatiN.
I'm running Watin tests with xUnit on CC.Net under Windows Server 2003. I have
I am getting the following Warnings while running tests using cc.net c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets (,): warning
I'm running Selenium tests from within Eclipse, but I can't load a custom Firefox
I am running some tests with linq, how can I check what queries SQL
We have some unit tests running against a SQL server 2000 database using the
I'm trying to run Watin from within a TeamCity build, using nUnit. All tests
How can I go about running tests/controllers based on random weight? For instance, have
we're running tests and updating results to a Sonar server (using Mave by the
I'm using WatiN, NUnit and ReSharper to run my ASP.NET unit tests inside Visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.