Ask a Question

how to define an object (button) that has a text value associated with it

jloyzagawh
Contributor

how to define an object (button) that has a text value associated with it

I have a button that has an exact text to test "textA" because when pressed it still remains visible with the text being "textB" and I need to check if its available as "textA"

 

perhaps the other way to test is to check whether "textB" exists on the page -

 

so either or both would help me

 

its using WPF and this is the definition

Aliases.SportingBet_Intrabet.HwndSource_IntrabetMainWindow.IntrabetMainWindow.Grid.Grid.windows.eventManagement.grdMain.Grid.tabControl.ScrollViewer.Grid.contentEventSummary.Grid.Grid.StackPanel.eventCheckList.pnlEventChecklist.ItemscontrolEventsChecklist.eventChecklistSettlingItem.Grid.Button

 

testcomplete 11 trial

4 REPLIES 4
NisHera
Valued Contributor

inspect that button with object spy

It should have property something like Text  of Caption whos value is either textA or textB

so you may write something like 

IF .........Grid.Button.Caption ="textA"

do onething

ELSE 

do other thing

no caption. 

Is the text part of the button? Or alongside the button, like a label or something?

 

If it's part of the button, there must be a property somewhere within the button that changes. If it's not obvious (like "Caption" or something) maybe the devs are doing something like replacing a graphic overlay that you're not seeing. So if you can't find it, try asking the devs.

 

Also, why are you using such an unreadable Alias for the object? It looks like a straight copy of the mapped object reference. The whole point of using Aliases is to cut down the object reference by removing container layers that you don't really need to know about and giving it much more readable names than the mapped object it points to. By just using the full, automatic, version, you might as well not bother and just refer to the mapped object.

Similar thread:

 

http://community.smartbear.com/t5/Getting-Started-with/Map-object/m-p/88790#M17264

 

If there's no caption you can switch on Text Recognition for the project. Then you should be able to spy the button text. 


Using the Calculator as an example, the number buttons are "WndClass: Button", so:

Right Click on Project folder > Edit > Properties
Open Applications > Text Recognition > add the "Button" class.

Now when you spy the calculator buttons the text will also be highlighted so can be mapped.

Link for the Text recognition overview

http://support.smartbear.com/viewarticle/56486/

cancel
Showing results for 
Search instead for 
Did you mean: