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 8304465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:51:25+00:00 2026-06-08T17:51:25+00:00

I am using Windows Automation to test my UI and am opening and closing

  • 0

I am using Windows Automation to test my UI and am opening and closing processes. I want to have a valid WindowHandle, but Process.WaitForInputIdle() doesn’t wait long enough. I have a work around, but don’t understand why WaitForInputIdle() doesn’t work.

Below is a small code snip:

Process = new Process
              {
                 StartInfo =
                 {
                     WorkingDirectory = directory,
                     FileName = EXECUTABLE_FILE_NAME
                 }
              };

Process.Start();

//Process.WaitForInputIdle() doesn't work, 
//so will use a while loop until MainWindowHandle isn't IntPtr.Zero anymore,
//or until 10 seconds have elapsed

int count = 0;

while (Process.MainWindowHandle == IntPtr.Zero && count<100)
{
    count++;
    Thread.Sleep(100);
}

AppElement = AutomationElement.FromHandle(Process.MainWindowHandle);
  • 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-06-08T17:51:27+00:00Added an answer on June 8, 2026 at 5:51 pm

    As stated by Chaser324 in his comment, the answer to my question can be found here.

    I basically need to add a call to Process.Refresh() inside of my ‘while’ loop.

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

Sidebar

Related Questions

I have created an integration test using the White automation framework. This is the
Using windows server, I have a path to a file that, when you click
Using Windows form (Vb.net & Datagridview) Checkbox is using in datagridview row. I want
new on ruby and using windows xp and rails 3, i want to send
I am using Windows Vista 32bit . I have installed Eclipse Helios Service Release
I am implementing WPF Application and i want to use System.Windows.Automation Namespace to capture
I want to create a continuous build integration system for .NET using just Windows
I want to test a application that is hosted on skytap inside a windows
I'm interested in using the robot framework for test automation. I created a test
Versions Excel 2003 Windows XP SimaPro 7.3.0 Developer Version Using a Work computer but

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.