Ask a Question

How to handle '↵↵' character in property checkpoint

SOLVED
snigam
Occasional Contributor

How to handle '↵↵' character in property checkpoint

 I am using Excel as the data source to compare the field text. I have copied the exact same data from the text field to Excel for comparison. Still, the property checkpoint is failing, as the actual result contains code '↵↵' to represent the next line, while the expected result text contains code '↴↴' for the same... I tried to replace the '↵↵' with '↴↴', but that also not helping.

4 REPLIES 4
Marsha_R
Champion Level 2

You could try using an alt-code to put the expected result into Excel and see if that helps. Excel has a habit of having extra hidden characters in a cell, especially with odd characters.

https://support.microsoft.com/en-us/office/insert-ascii-or-unicode-latin-based-symbols-and-character...

 

You could also try comparing the field text as a picture instead of as actual text.

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/checkpoints/compare-pictur...

lreynolds
Senior Member

The only workaround I found was to use contains check (instead of equal) and split the text I'm checking for into multiple property checks so the '↵↵' are bypassed

rraghvani
Champion Level 2

The default value for carriage return is \r and newline \n.

 

If your text contains a carriage return, then you can compare the string like so "SmartBear\r"

 

snigam
Occasional Contributor

Thank you, everyone. I have tried all your suggestions and wasn't able to have success. However, I have found another workaround using which I can assert the full text including paragraphs without running into any hidden characters issues.

I am saving the object text to a variable and then using the IF condition to assert it against the Excel value. When a match is found I am logging the checkpoints (log.Checkpoint()) else error (log.error()).

cancel
Showing results for 
Search instead for 
Did you mean: