cancel
Showing results for 
Search instead for 
Did you mean: 

Log version number in an app

SOLVED
Highlighted
Occasional Contributor

Log version number in an app

Hello,

 

I am new to the scripting so sorry for this kind of questions, i am trying to log the current version of the desktop app, but can't find a way how to do it.

So i have an app that has a version (picture Version.png). The i try to select it, i can only select the whole line and that makes my object look in NameMapping like this:["Sys"]["Uvs_WinPos"]["HwndSource_Cashier_480x320"]["Cashier_480x320"]["ActiveItem"]["TextblockVersija10740429807"].

 

And then i made a script that checks that version contains the desired Text: ["Uvs_WinPos"]["HwndSource_Cashier_480x320"]["Cashier_480x320"]["ActiveItem"]["TextblockVersija10740429807"], "Text", cmpStartsWith, "Versija:");

 

But the i change the version i am getting this kind of error: Unable to verify a value with the property checkpoint, because the target object does not exist. 11:21:31 Normal 0.00.

 

So how can i get the version number from that block no matter what it is and log it ?

 

Best regards,

Dainius

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Log version number in an app

I see your problem right away in your Version2.png.

You are using the property WPFControltext and the value you have in your mapping is the version number that keeps on changing.

I would do  two things for your mapping.

 

1) Rename the mapped object from TextblockVersija10740527226 to simply TextblockVersija.  Be sure you also delete all other mappings of the object as they are, essentially, useless

2) Edit the properties.  Delete the "Name" property.  It's generally unecessary.  And edit the WpfControlText property and, in the value, replace "1.0.7405.27226" with the asterisk (*) symbol.  This wildcards the version number.  The mapping will find the object based upon the ClrFullClassName and the Control text that contains the word Versija.

 

 

The general principle to learn is that, when mapping objects, you need to make sure that the properties you're using are not changing from one version to the next.  If they are, you have two choices.  Either select a different set of properties or wildcard the section of the property value that is changing.

 

Please let me know how this works.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

7 REPLIES 7
Highlighted
Community Leader

Re: Log version number in an app

Hi,


Possible solutions:


1) Enable this option and check that TextObject() -> search for it using findxxx().

 

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/text-recognition/...


2) You get an error because you are trying to verify an object with the parameter 'TextblockVersija10740429807' and it does not exist when you change the current version number. Try mapping the object to NameMapping after the version change. You may notice that there is another object, not the previous one.


What you can do is map this area for reading and search the text inside the property -> read it -> do a regexp to verify it and you are ready to go.

Highlighted
Occasional Contributor

Re: Log version number in an app

Hello,

 

Sorry, but i am a little bit confused.

1) As i can see i have enabled text recognition. But can't uderstand how to search for the TextObj()

 

2) I don't want to map versions every time, because they are changing sometimes 10 times a day. Is thre some kind of way to bypass that ? Is there any kind of documentation what is regexp and how to use it ?

Highlighted
Community Hero

Re: Log version number in an app

What criteria are you using for your mapping (properties)?  Because each time the version changes, if you are using the version number as a mapping criteria, you're never going to find the text.

To be able to help you best, it would be nice to see:

 

1) In Object Browser, how does that component show up?  Please screenshot the properties, being sure to include "Advanced" view to see all available properties.

2) When mapping, what is the hierarchy and property set that you have selected?  Screenshot your Mapped Objects section of your NameMapping tab being sure to show the tree of objects and the properties and values you're using to map the object.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: Log version number in an app

I am trying to search for a word - Versija.

 

But i can't understand how to get the part of the text block.

 

1)Screenshot of the Object Browser(Version1, Version 1-1, Version 1-2, Version 1-3 )

 

2) Then i try to map it everytime it takes all the text and then i try to edit the properties it says it dones't match the object's property value(Version2.PNG and Version3.PNG).

Highlighted
Community Hero

Re: Log version number in an app

I see your problem right away in your Version2.png.

You are using the property WPFControltext and the value you have in your mapping is the version number that keeps on changing.

I would do  two things for your mapping.

 

1) Rename the mapped object from TextblockVersija10740527226 to simply TextblockVersija.  Be sure you also delete all other mappings of the object as they are, essentially, useless

2) Edit the properties.  Delete the "Name" property.  It's generally unecessary.  And edit the WpfControlText property and, in the value, replace "1.0.7405.27226" with the asterisk (*) symbol.  This wildcards the version number.  The mapping will find the object based upon the ClrFullClassName and the Control text that contains the word Versija.

 

 

The general principle to learn is that, when mapping objects, you need to make sure that the properties you're using are not changing from one version to the next.  If they are, you have two choices.  Either select a different set of properties or wildcard the section of the property value that is changing.

 

Please let me know how this works.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
Occasional Contributor

Re: Log version number in an app

This is perfect ! Тhank you very much.

 

Could you consult me with one more question.

I want to log version with a message everytime i change the version(with the numbers no matter that they are changing)

 

I want to get a result something familar to this(Capture.PNG)

 

Highlighted
Community Hero

Re: Log version number in an app

Once you find the object with the mapping, since we already know what property to use, you can simply

 

Log.Message("The current version is: " + Aliases.Uvs_WinPos.HwndSource_Cashier_480X320.Cashier_480X320_ActiveItem.TextblockVersija.WPFControlText)

 

This will log the contents of that property.

 

Now, you can get all fancy and parse out the version number so all you have is the numeric portion using split strings, and so on... but simply speaking, all you need to do is just log the object property that contains the version.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Top Kudoed Authors