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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:11:09+00:00 2026-06-04T17:11:09+00:00

I am facing a weird behavior with WaitForControlExist() function of Coded UI. When querying

  • 0

I am facing a weird behavior with WaitForControlExist() function of Coded UI. When querying for the second time, the value is returning false even though the control exist.. Is this the expected behavior of Coded UI? My Program looks something similar like below..

//A sample program that Checks for Run window when "Windows + R" key is pressed

public void TestFunction()
{
   bool isExists = false;

   #region Variable Declarations

   UIMap uiMap = new UIMap();

   WinWindow uIRunWindow = uiMap.UIRunWindow;
   WinComboBox uIOpenComboBox = uiMap.UIRunWindow.UIItemWindow.UIOpenComboBox;
   WinButton uICancelButton = uiMap.UIRunWindow.UICancelWindow.UICancelButton;

   #endregion

   //1st Run

   Keyboard.SendKeys("R", ModifierKeys.Windows);
   isExists = uIRunWindow.WaitForControlExist(7000);
   Console.WriteLine("Is Run Window Appears :: " + isExists); 
   Mouse.Click(uICancelButton);
   Playback.Wait(2000);
   isExists = uIRunWindow.WaitForControlNotExist(7000);
   Console.WriteLine("Is Run Window Closes :: " + isExists);

   //2nd Run 

   Keyboard.SendKeys("R", ModifierKeys.Windows);
   isExists = uIRunWindow.WaitForControlExist(7000);
   Console.WriteLine("Run Window Appears :: " + isExists); 
   Mouse.Click(uICancelButton);
   Playback.Wait(2000);
   isExists = uIRunWindow.WaitForControlNotExist(7000);
   Console.WriteLine("Is Run Window Closes :: " + isExists);

}

In the above program, during the 2nd run event though Run window exists the value is returned as false.

The work around I came across is either to use 2 different objects for 1st and 2nd run, or to reinitialize the UIMap object as shown here

Please help me if there is any other solution or best practice in this scenario

  • 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-04T17:11:10+00:00Added an answer on June 4, 2026 at 5:11 pm

    Search results and the trees created by MSAA/UIAutomation are cached. In the search configuration for the control you can turn AlwaysSearch on which should solve the problem, without needing to recreate the control.

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

Sidebar

Related Questions

this time, I'm facing a really weird problem. I've the following code: $xml =
I am facing a strange behavior by CakePHP 2.1: I have a method, $this->Time->getTime();
I am facing a weird behavior and I need some help.. I encounter a
I'm just facing weird problem with cos function in objective c. I have the
I'm facing a weird problem with jQuery UI Position function. There is a parent
I'm facing weird situation with DateTimePicker control. I've a DateTimePicker control with short date
I am facing a weird problem in IE which is not happening with other
I am facing a weird problem: I am encrypting the contents of a cookie.
I am facing a weird problem on BlackBerry JDE 4.2.0 and the 8100 simulator
I m facing a weird problem with submodules in a bare repo. I illustrate

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.