Ask a Question

Identifying a Button by its tool tip

SOLVED
SuperTester
Contributor

Identifying a Button by its tool tip

Hey guys,

 

I would like identify a button by its tool tip. However, the tool tip property (wText I think) is not found by test complete, but I can get the tool tip by using the java method getToolTipText().

 

Is there a way to configure a object in namemapping to get such that its identified by the result of a method and not by a property? Maybe there's a trick using conditional mode.Otherwise, I think I'd need to write a script. Something like,

 

function findObjWToolTip()
{
var myToolTip,myBtn,windowObj;
var buttons = windowObj.FindAll(['Name'], ['MJButton'], depth, True);
for (var i = 0; i < buttons.length; i++)
{
if (buttons[i].getToolTipText() == myToolTip)

{
myBtn = buttons[i]

break;
}

}
}

 

Thanks in advance!

4 REPLIES 4
AlexKaras
Community Hero

Hi,

 

Is there a way to configure a object in namemapping to get such that its identified by the result of a method and not by a property?

 

No to the level of my knowledge. So you'll have to stick to the code that you've mentioned.

 

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

Hi Alex,

 

Thanks for your response.

 

Alright, I was just curious. The script method works perfectly fine.

 

Slightly off topic, but if I really wanted the  tool tip to be recognized as a property, could I do so with a custom plugin?

Hi,

 

could I do so with a custom plugin?

At least you may investigate and try: https://support.smartbear.com/testcomplete/docs/working-with/extending/custom-plugins.html

 

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

Hi Alex,

 

Thanks for the link. This is something I'll be researching.

 

Thanks again!

cancel
Showing results for 
Search instead for 
Did you mean: