MaxRussell
MaxRussell

Reputation: 651

Robot "should be equal as strings"

I've got some code in a Robot script that will check a field value is as expected:

${search_box}=    Get Value    fullSearchBox
Should Be Equal As Strings    ${search_string}    ${search_box}

When I run the script, a failure is recorded against that verification step. However, when I look at the two strings, I can see no differences between them at all (I've also tried using Should Be Equal).

If the two strings are the same - why am I seeing this failure?

Upvotes: 2

Views: 10374

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

If there is some whitespace on one of the variables, you can strip the whitespace by calling .strip() using the extended variable syntax:

Should Be Equal As Strings    ${search_string.strip()}    ${search_box.strip()}

Upvotes: 3

Related Questions