How to verify the dynamic Text?


This is my functionality… To verify the delete contact name in my app…

Click “CPW/Delete_Alias/Btn_Delete”

I am using this command. On click of Delete i need to verify that confirmation is displayed or not. Every time it will display like “Are you sure you want to delete {Contact Name}?”

i need to do two verifications here.

  1. Whether i am getting confrimation text or not.
  2. I need to capture the contact name from the confirmation text and once it is deleted i need to ensure that it is not displayed…

How to verify this…

For this you can use the OCR (optical character recognition) functionality. You can specify a search rectangle around the area where the name will be located, and then have the OCR read the text in that area. Then after you confirm the deletion of the contact, you can search your contact list for the text that it originally extracted from the panel (the person’s name) and see if it is there. The basic search with OCR will look something like this:

--use images to set the search rectangle, as in the line of code below:
put readtext(searchRectangle:("TLCorner1","BRCorner1")) into CustomerNameVar

click "DeleteButtonImage" //delete the contact

if not imagefound (text:CustomerNameVar, searchRectangle:("TLCorner2","BRCorner2"))
	log CustomerNameVar & " was properly deleted from the list!"
	log CustomerNameVar & " was not deleted from the list."
end if

You can read about best practices with OCR here, including setting the searchRectangle using images, and how to set the contrast and validCharacters: