Forum Discussion

OV's avatar
OV
Frequent Contributor
7 years ago

Help with RegExp as part of an object's FullName

Hi,

 

 

The object I’m trying to click has a different FullName every time depends where I’v navigated from only the BOLD bit is changing.

 

Sys.Process("QuickDesign.ConfigurationManager").WPFObject("HwndSource: This").WPFObject("This").WPFObject("Grid", "", 1).WPFObject

 

("AppStateGrid").WPFObject("ScopedGrid").WPFObject("NetworkControl").WPFObject("Explorer").WPFObject("AppStateGrid").WPFObject("Border",

 

In this case I came from the Networking area so the parent include the networking.

 

 

Sys.Process("QuickDesign.ConfigurationManager").WPFObject("HwndSource: This").WPFObject("This").WPFObject("Grid", "", 1).WPFObject("AppStateGrid").WPFObject("ScopedGrid").WPFObject("AutomationBindingsControl").WPFObject("Explorer").WPFObject("AppStateGrid").WPFObject("Border", "", 1)

 

In this case I’m coming from the automation area so it include the automation

 

I’ve tried to put * instead of this value in the parent for example

 

Sys.Process("QuickDesign.ConfigurationManager").WPFObject("HwndSource: This").WPFObject("This").WPFObject("Grid", "", 1).WPFObject("AppStateGrid").WPFObject("ScopedGrid").WPFObject("*").WPFObject("Explorer").WPFObject("AppStateGrid").WPFObject("Border", "", 1)

 

 

But that didn’t work.

 

Any idea how to solve that? it could also be a RegExp that include the word *.Control for example because Control appears in all strings

 

I think that’s what causing the Ambiguous recognition of the tested object I have

 

Thank you,

 

Ofer

21 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Sure, it has a different full name.. it's a different object.  While the descendant tree is the same, it's still a different object in the middle there.  If I was using NameMapping, I'd map the two different objects using the unique criteria.  The "Ambiguous recognition" warning is exactly that... TestComplete has found more than one object that matches the indicated parameters and so it is warning you that it won't be able to guarentee it's found the right object.  And because it is giving that warning means that both objects (NetworkControl and AutomationBindingsControl) exist in memory at the same time... they need to be identified seperately.

     

    If you don't want to use the NameMapping feature, you can achieve what you're looking for using the FindChild method.  Please look into that method as I believe it will help you a lot better than trying to manipulate the full names.

    • OV's avatar
      OV
      Frequent Contributor

      Thank you all,

       

      Robert can you please explain how can i use FindChild in this case? as this homebutton doesn't have unique property how can i look for a child without unique property?

       

      Thx 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        It has a unique property... NetworkControl is unique to the HomeButton that takes you to NetworkControl.  AutomationBindingControl is unique to that home button... as mentioned, you have two different objects that need to be identified differently.

         

        If you want some help, please post the ObjectSpy properties of the object in question.

  • shankar_r's avatar
    shankar_r
    Community Hero

    Hi,

     

    It should work if you put *, but in some cases it won't work like if the parent object multiple objects then it may not work.

     

    There are some options that you can try,