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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:53:50+00:00 2026-06-03T13:53:50+00:00

Anyone know the proper way to reliably locate a desktop icon using Coded UI

  • 0

Anyone know the proper way to reliably locate a desktop icon using Coded UI Testing APIs?
The auto generated code created from recorded actions that clicks on a specific desktop icon works the day it was recorded. When I turn on my laptop the next day the recording action no longer works as icon cannot be found.

I am trying to handcraft this so I tried:

public void LaunchOi()
{
   var desktop = ApplicationUnderTest.Desktop.GetChildren().First(c => c.Name == "Desktop");

   var folderView = new WinWindow(desktop);

   // I copied these numbers from autogenerated code.  
   // Yesterday, PropertyNames.Instance = 7, today = 9.  Why so?
   folderView.SearchProperties[WinWindow.PropertyNames.ControlId] = "1";
   folderView.SearchProperties[WinWindow.PropertyNames.Instance] = "9";
   folderView.Find();

   var winList = new WinListItem(folderView);
   winList.SearchProperties[WinListItem.PropertyNames.Name] = "OCC600 OI";          
   winList.Find();

   Mouse.DoubleClick(winList, MouseButtons.Left);
}

As indicated in my comments, WinWindow.PropertyNames.Instance does not remain constant. When I peformed this recording yesterday, WinWindow.PropertyNames.Instance was 7. Today, it is 9. Anyone know why? I cannot find any documentation on this.

  • 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-03T13:53:51+00:00Added an answer on June 3, 2026 at 1:53 pm

    As Schaliasos mentioned in the comments you should start by deleting the instance property. Instance properties are very unreliable especially in something that changes as frequently as the desktop.

    A little more explanation on instance properties… Instance properties are usually used in recordings when there is a lack of valid search properties. So as a last ditch effort to make the recording, the recorder will say I have 20 controls with the same search properties and the control that should be used is number 7. Then the next day when you go to run the application you probably added or removed a couple of desktop icons and say you have 22 icons now. Now the framework is still looking for instance 7 of the control but what was 7 yesterday is 9 today.

    If there are any other search properties available you should find and use those instead of instance. If that isn’t possible look for other methods to achieve the same goal, maybe try opening the file directly in C# instead of using of using the UI.

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

Sidebar

Related Questions

Does anyone know the proper way to query azure table storage for a null
Does anyone know a way to auto-generate database tables for a given class? I'm
Anyone know of an easy way to parse a Lua datastructure in C# or
Anyone know a good solution for filtering input using jQuery? I'd like to do
Is there anyone know a way that you can create related work items to
Anyone know if it is possible to make the PeriodicalUpdater pass the data it
Anyone know how to read Outlook nickname list file (.NK2)? Any document on how
Anyone know where i can find a good comparison between the generally accepted Pro's
Anyone know if its possible to enable horizontal scrolling ONLY in a windows forms
Anyone know why this root View Controller's viewDidLoad is being called twice at launch?

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.