Ask a Question

Two Object with Identical Names

gdave
Regular Contributor

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)

gdave_0-1629193300301.png

 

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

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

gdave_1-1629193538434.png

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

gdave_2-1629193637409.png

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

gdave_3-1629194027210.png

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.

gdave_4-1629194204540.pnggdave_5-1629194252244.png

 

Any help to fix this problem is much appreciated.

 

Thanks

5 REPLIES 5
Marsha_R
Community Hero

Re: Two Object with Identical Names

This may be of some help

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/how-...

 

 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
AlexKaras
Community Hero

Re: Two Object with Identical Names

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();

 

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sonya_m
Community Manager

Re: Two Object with Identical Names

Thanks a lot, Alex and Marsha!

@gdave does this help?


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
gdave
Regular Contributor

Re: Two Object with Identical Names

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
Regular Contributor

Re: Two Object with Identical Names

Hi

I have replied back to Alex. Cheers

cancel
Showing results for 
Search instead for 
Did you mean: