String Variable not including necessary newline characters (/n)
Hello everyone,
I have started using variables in my test checkpoints, and I have run into the following problem, the solving of which I would really appreciate.
I am testing to see whether the text on an element of one page is the same as the text of the element of another page with the following generalized process:
- Set a variable (DevValue) equal to the contentText of an object (obj.source).
- Compare DevValue to the contentText property of a different object (obj.match).
Pretty simple. However, even when the text is the same on both obj.source and obj.match, the test will still fail, because of the newline character. See the following checkpoint report:
There is an unexpected turn, however. The following process yields a successful checkpoint with matching values:
- Create a new checkpoint. In the checkpoint wizard, select obj.source (the expected value is set to obj.source.contentText).
- Change the checkpoint's object to obj.match (remember this does not change the expected value) and run the test to compare the values.
Again, this yields a success, and it is because now the obj.source.contentText contains the newline characters, in the form of '/n's
I can provide more pictures if necessary. This one has really stumped me.
Thanks a lot!
From my experience when \n exist in your text to move around as you are doing, you face restrictions as you experience.
A suggestion, in your case would it be possible to use two variables?
Read from page A element and save to variable A.
Read from page B element and save to variable B.
Compare variable A with Variable B.Hope that helps.