Repository Item name has been prefixed with hh:mm

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Repository Item name has been prefixed with hh:mm

Post by stapes » Tue Sep 22, 2015 12:55 pm

I am trying to write a Test Project using Evernote.

After adding a new note, the note content has been automatically prefixed with the time, so the Repository Item has been called
Text1244ThisNoteWasAddedUsingRano
and the match value has been saved as
12:44 This note was added using Ranorex.
How do i validate this or locate it on repeated tests, as the time and the hence name of the Repository Item is going to change every time?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Repository Item name has been prefixed with hh:mm

Post by odklizec » Tue Sep 22, 2015 2:20 pm

Hi,

Do I understand you right that the string "Text1244ThisNoteWasAddedUsingRano" is used as Repository item name? Or is this string used also somewhere in the element xpath? If it's just the repo item name, you can freely rename it to whatever you want. Repo item name is not used for element identification. It's also highly recommended to give repository elements more sensible names (after recording steps).

As for the match value, it depends if you need to validate the time, its format or if it's just enough to validate the text after the time prefix? The easiest way is to use Validate AttributeContains and validate only the partial string, eventually use AttributeRegEx with carefully constructed reg ex. If you want to check if the validated string contains time, but you don't really care about the exact time value, using RegEx is probably the best way?

Could you please be more specific about your needs? Ranorex Snapshot and/or sample project would be very helpful here. It's just easier to provide adequate help with available snapshot/sample solution ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Repository Item name has been prefixed with hh:mm

Post by stapes » Tue Sep 22, 2015 3:58 pm

Hi

When I first recorded my test, I did Validate, and pointed the selection to the Element on screen that I wanted to validate. Ranorex chose to name it Text1244ThisNoteWasAddedUsingRano, based on the text it contains.
I have tried to change this to a variable name - TextCommentEntry, but Ranorex cannot find this!

This is what it tries to do:
Validating AttributeContains (Text=$varMatchValue) on item 'ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'.
I added some code to the activity of touching the Save button:

Code: Select all

public void Touch_Done()
        {
            Report.Log(ReportLevel.Info, "Touch", "Touch item 'ComEvernote.LoginActivity.Done' at Center", repo.ComEvernote.LoginActivity.DoneInfo);
            repo.ComEvernote.LoginActivity.Done.Touch();
            
            varMatchValue=varMatchValue.Remove(0,6);
         	// display new value of varMatchValue
        	Report.Log(ReportLevel.Info, "varMatchValue=", varMatchValue );
        }
and also converted the Validate activity to code:

Code: Select all

public void Validate_NoteCommentEntry()
        {        	
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeContains (Text=$varMatchValue) on item 'ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'.", repo.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntryInfo);
            Validate.Attribute(repo.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntryInfo, "Text", varMatchValue);
        }


Here are the last few lines of the Report:
01:08.167 Info Validation

Validating AttributeContains (Text=$varMatchValue) on item 'ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'.
Screenshot
02:38.339 Failure Validation

Attribute 'Text' of element for item 'EvernoteAndroidTestsRepository.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry' does not match the specified value (Failed to find item 'EvernoteAndroidTestsRepository.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'. No element found for path '/mobileapp[@title='com.evernote']/form[@title='TabletMainActivity']/container[@rid='content']/androidelement/androidelement[3]/androidelement[2]/androidelement/container[3]/androidelement[5]/container[2]/container[@containertype='Linear']/text[@selectiontext<'This note was added using Ranorex.']' within 1.5m.).

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Repository Item name has been prefixed with hh:mm

Post by odklizec » Wed Sep 23, 2015 8:26 am

Could you please post a sample solution? It does not have to be entire test project. Just create a new one, with the problematic part. It would be much easier to track the problem down and suggest a reasonable solution.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Repository Item name has been prefixed with hh:mm

Post by Support Team » Wed Sep 23, 2015 6:15 pm

Hi,

Thanks odklizec for your help :).

I just wanted to add, that it seems to be a RxPath problem, since the element cannot be found.
It would be therefore great if you could also post a Ranorex snapshot file of the specific element.
Here you can see how to create a snapshot: How to create a Ranorex Snapshot.

Thnaks,
Markus

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Repository Item name has been prefixed with hh:mm

Post by odklizec » Thu Sep 24, 2015 7:23 am

Support Team wrote:Hi,

Thanks odklizec for your help :).
You are welcome ;) Just returning a bit back to the community after all that great help I received (and still receiving) from you and other guys at this forum in my beginnings.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Repository Item name has been prefixed with hh:mm

Post by stapes » Thu Sep 24, 2015 9:57 am

Thanks guys. I seem to have got past this now, by validating the Note Title instead, which does not have the time added.

Here is my working code:

Code: Select all

public void Validate_RanorexTestAddNote()
        {
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text='Ranorex test - add note') on item 'ComEvernote.AndroidWidgetAbsoluteLayout.RanorexTestAddNote'.", repo.ComEvernote.AndroidWidgetAbsoluteLayout.RanorexTestAddNoteInfo);
            Validate.Attribute(repo.ComEvernote.AndroidWidgetAbsoluteLayout.RanorexTestAddNoteInfo, "Text", "Ranorex test - add note");
        }