Forum Discussion

DKumar04's avatar
DKumar04
Contributor
6 years ago

Solution for changing full name of an object

Sys.Process("YYY").WPFObject("HwndSource: ControlRoot").WPFObject("ControlRoot").WPFObject("DockPanel", "", 1).WPFObject("mainGrid").WPFObject("MenuControlHost").WPFObject("Control_ROOT").WPFObject("Grid", "", 1).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 1).WPFObject("WeldPortInspectionControl", "", 1).WPFObject("Border", "", 1).WPFObject("Grid", "", 1).WPFObject("TabControlWithCornerElement", "", 1).Click(1635,38)

 

In the above full the number in the part (WPFObject("TabControlWithCornerElement", "", 1)) keeps changing at runtime or playback. how to handle this? 


  • dmiscannon wrote:
     If just the number is changing, replace the number with * which is a wild card to handle situations like this.

     

    Normally, I'd suggest this, but that doesn't guarentee that you'll get the CORRECT object.  If there's more than one, differentiated only by the index, then using the wildcard will return an ambiguous object recognition warning and, potentially, have the automation fail because the correct object could not be accessed.

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi DKumar04,

     

    Did you have a chance to investigate the Name Mapping feature? Did it help you resolve the issue?

    • DKumar04's avatar
      DKumar04
      Contributor

      I am not interested in it, as it was not very helpful for my project

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        What are the requirements for your project?

        Perhaps, we can suggest an alternative solution.

  • dmiscannon's avatar
    dmiscannon
    Frequent Contributor
    "In the above full the number in the part (WPFObject("TabControlWithCornerElement", "", 1)) keeps changing at runtime or playback. how to handle this? " If just the number is changing, replace the number with * which is a wild card to handle situations like this.
    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      dmiscannon wrote:
       If just the number is changing, replace the number with * which is a wild card to handle situations like this.

       

      Normally, I'd suggest this, but that doesn't guarentee that you'll get the CORRECT object.  If there's more than one, differentiated only by the index, then using the wildcard will return an ambiguous object recognition warning and, potentially, have the automation fail because the correct object could not be accessed.