Forum Discussion

gdave's avatar
gdave
Regular Contributor
3 years ago

Two Object with Identical Names

Hi all

I am really struggling with this and I was hoping if anyone can help me to sort this out.

 

Basically there are two objects which share the same name. One listed under menu Transaction-OneOff-Withdrawal & other as Transaction-Regular-Withdrawal. Though the object 'Withdrawal' share the same name both are categorized under different sub-menus (screenshot below)

 

I have mapped them in name mapping with their unique name & properties:

'Withdrawal' object listed under sub-menu item called one-off

'Withdrawal' object listed under sub-menu item 'regular

Now when I run my test it works fine and successfully clicks the 'Withdrawal' object listed under sub-menu item 'One-Off'. However, my test fails when it tries to find the second 'Withdrawal' object which is listed under sub-menu item 'Regular'. And interestingly below is the failure reason. My first issues is that both the objects are under the same parent object so how is it possible that TestComplete can find the same parent for object1 but unable to find the parent for object2

Secondly when I click on 'Intelligent Fix' in the hope to fix this, it seems that TestComplete points to the very first 'withdrawal' object listed under sub-menu item 'one-off'. And it suggest me to update the new values for the properties which apparently belongs to the first 'withdrawal' object.

 

Any help to fix this problem is much appreciated.

 

Thanks

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    It is my guess that GUID part for namePropStr and href NameMapping parameters is not stable and changes its value for each test run.

    What I would do is to locate some parent that contains the menu item that you need to use and then, search for menu item not from page, but from this parent.

    Sample pseudocode:

    var page = ... ;
    var oneOffContainer = Aliases.browser.page.[...].oneOffContainer;
    // or
    // page.FindChild(...); // search criteria for One-Off menu container
    oneOffContainer.Click();
    
    var withdrawalItem = oneOffContainer.FindChild('contentText', 'Withdrawal', 50);
    withdrawalItem.Click();
    ...
    
    var regularContainer = Aliases.browser.page.[...].regularContainer;
    // or
    // page.FindChild(...); // search criteria for Regular menu container
    regularContainer.Click();
    
    var regularItem = regularContainer.FindChild('contentText', 'Withdrawal', 50);
    regularItem.Click();

     

     

    • gdave's avatar
      gdave
      Regular Contributor

      Hi Alex

       

      Thanks for your reply. Sorry I couldn't reply any sooner as I was away.

       

      Mine are based on keyword test, do you think if there is any way to sort it using keyword test ?

       

      Thanks

    • gdave's avatar
      gdave
      Regular Contributor

      Hi

      I have replied back to Alex. Cheers