cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the mapped name for the object

SOLVED
kevintran1308
Contributor

How to find the mapped name for the object

Hi everyone,

 

I tried to find the mapped name for the object with unknown location.

There is a list with a thousand of items in there. I use Find function to find if the item exist or not based on the name of the item.

And if it was exist, I need to click on that item.

However, Find function only returns the variable that show the item exist or not on the list.

It did not return the mapped name for the object.

How can I find the mapped name of the item to use the Click function?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marsha_R
Community Hero

Re: How to find the mapped name for the object

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/find-m...

 

In your example, p is the object.  If Exists is true, then you can use that p object for other things like Click

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/button/click-action-b...

 

so something like

 

p = List.Find("DisplayName","Test_529",15)
if (p.Exists):
p.Click()  

Log.Message("The object was found.")

else:
  Log.Error("The object was not found.")

 

 

View solution in original post

5 REPLIES 5
AlexKaras
Community Hero

Re: How to find the mapped name for the object

Hi,

 

I am not sure I got your problem.

Could you provide a relevant code example or rephrase the use case and the problem?

 

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
================================
kevintran1308
Contributor

Re: How to find the mapped name for the object

#####Find if the item is exist########
p = List.Find("DisplayName","Test_529",15)
if (p.Exists):
  Log.Message("The object was found.")

else:
  Log.Error("The object was not found.")
########################################

 

The problem is: How can I find the mapped name for the item "Test_529"

Because the Find method returns a stub object that only contains the Exist property equal to False. So, you can check the Exists property value of the returned object to determine whether the search was successful.

AlexKaras
Community Hero

Re: How to find the mapped name for the object

Hi,

 

If .Exists property equals to false this means that the sought for object does not exist and thus is not NameMapped.

Otherwise, if .Exists equals to true, you may check the value of the .MappedName property. If the object is NameMapped this property will contain object's mapped name.
Does this answer your question?

 

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
================================
Marsha_R
Community Hero

Re: How to find the mapped name for the object

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/find-m...

 

In your example, p is the object.  If Exists is true, then you can use that p object for other things like Click

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/button/click-action-b...

 

so something like

 

p = List.Find("DisplayName","Test_529",15)
if (p.Exists):
p.Click()  

Log.Message("The object was found.")

else:
  Log.Error("The object was not found.")

 

 

View solution in original post

kevintran1308
Contributor

Re: How to find the mapped name for the object

Oh I can click at item now.

Thank you so much

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors