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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:50:23+00:00 2026-06-06T01:50:23+00:00

The application I am writing coded UI tests for has a window where part

  • 0

The application I am writing coded UI tests for has a window where part of the window title is based on a random filename generated for a temporary file, so the test can only know the static part of the window title.

Occasionally, when no other windows are open, the test runs fine. It is a bit problematic when other windows are open, however. If the other windows have similar controls, which window the test picks to work in is unpredictable.

  • 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-06T01:50:27+00:00Added an answer on June 6, 2026 at 1:50 am

    I’ve narrowed it down to this: When searching for a control, the Coded UI Test uses search properties and a tree-like structure of controls. If it can’t find an exact match it finds a close match (so it can’t find the exact window title name, it excludes that and keeps searching for a window that matches any other given properties) which is why it works with controls in other windows.

    The solution is really to give it more search properties to work with. One method I use is to add a property using a PropertyExpression and pass it PropertyExpressionOperator.Contains.

    As an example, I recorded opening MS Word and closing it. This generates a control in the UIMap, and in its constructor is the following:

    this.SearchProperties[WinWindow.PropertyNames.Name] = "Document1 - Microsoft Word";
    this.SearchProperties[WinWindow.PropertyNames.ClassName] = "OpusApp";
    

    Rather, the first line should be:

    this.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Microsoft Word", PropertyExpressionOperator.Contains));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Coded UI Test Builder application in Visual Studio is very useful when hand-writing
I am writing a C# application that uses a long hard-coded string. For maintainability
I am writing some code to add file attachments into an application I am
I am writing a server application which has a large amount of source code.
I'm working on unit-tests for an application which has a constructor that takes three
We have an old asp.net application that has no unit tests, integration tests, component
I'm writing a test script for a library I've written, and as part of
I'm writing an ant build script to run regression tests for an application. I
I'm writing a flex application that polls an xml file on the server to
I am just writing a little test application to show a Gallery of images

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.