Forum Discussion
4 Replies
Sort By
- tristaanogreEsteemed ContributorMy guess is that there is some non-printing character that is not included in your expected value but is present in your actual value. Try removing all leading and trailing "spaces" from your expected value and use the "Contains" method of comparison.
- Raj_QaContributorRobert,
There are some extra spaces in the inner text but I got rid of them, id I do not do so then testcomplete freezes or goes very slow. This is what the actual property checkpoint looks like
Call aqObject.CheckProperty(sys.process("firefox").page("*").document.all.Item("criteria"), "innerText", cmpContains, Chr(10)&" Remove"&Chr(10)&" "&Chr(10)&" "&Chr(10)&" Used,"&Chr(10)&" Remove"&Chr(10)&" "&Chr(10)&" 2009-2011"&Chr(10)&" Remove"&Chr(10)&" "&Chr(10)&" Jaguar"&Chr(10)&" Remove"&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" "&Chr(10)&" ")
But I got rid of those extra spaces in the hidden text .
Call aqObject.CheckProperty(sys.process("firefox").page("*").document.all.Item("criteria"), "innerText", cmpContains, " Remove Used, Remove 2009-2011 Remove Remove ") - HKosovaSmartBear Alumni (Retired)Hi Raj,
When using the Equals or Contains comparison method, each character in the baseline value including extra spaces and line brakes (Chr(10)) in the middle of the value are significant. You can't simply remove them and expect the checkpoint to pass. For example, the string "AB CD" contains "B C", but doesn't contain "BC" — the same applies to checkpoints.
To ignore the middle spaces, you need to verify innerText against a regular expression instead: - Raj_QaContributorHelen,
Thanks for the explanation. If i was able to use the entire expression as the expected value i would not have tried to alter it. But the expression is huge and Testcomplete crashes if I try to use it that way.
I will use the other script you suggested
Thanks for your help!
Related Content
Recent Discussions
- 13 hours agovladd1