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.).