Hi,
I have an issue with the string comparison when one of the string is of multiple lines.
Dim sExpectedData As String = "File numbers 1 to 5 of allocation (5 Files in Group)"
Dim sObjLoc As String = "/WPFWindow[@caption='ESS-MIREC']//WPFTextBlock[@automationId='FileViewDescription']"
Dim sActualData As String = _desktop.WPFTextBlock(sObjLocator).Text
The sActualData would be retrieved in the below form from the application under test:
File numbers 1 to 5 of allocation
(5 Files in Group)
I have tried to remove the unwanted spaces and breaks from this string using the below code:
sActualData = Trim(ReplacesActualData, vbLf, ""))
sActualData = Trim(ReplacesActualData, vbCrLf, ""))
When I compare now sExpectedData and sActualData, I would expect both to be same but it's not. The text is same in both but the count differs in both the strings (56 and 57 respectively).
Console.WriteLine(sExpectedData)
Console.WriteLine(sActualData )
Console.WriteLine(sExpectedData.Count)
Console.WriteLine(sActualData .Count)
OutPut:
File numbers 1 to 5 of allocation (5 Files in Group)
File numbers 1 to 5 of allocation (5 Files in Group)
56
57
Though I have replaced the blank space and line breaks, how still it differs? Is there any other possibility to remove the unwanted spaces at line breaks?