Hi all,
This is a very simple macro that performs a string-to-string comparison, please check it out and let me know if you have any idea why it returns false:
{
"Name": "PriceTest",
"CreationDate": "2021-3-2",
"Commands": [{
"Command": "open",
"Target": "https://ftygu.free.beeceptor.com",
"Value": "priceRaw"
},
{
"Command": "store",
"Target": "1 399,90 €",
"Value": "priceRaw"
},
{
"Command": "storeText",
"Target": "xpath=/html/body/span",
"Value": "priceRaw2"
},
{
"Command": "executeScript_Sandbox",
"Target": "return ${priceRaw} === ${priceRaw2}",
"Value": "isEqual"
},
{
"Command": "echo",
"Target": "${isEqual}",
"Value": ""
}
]
}
Doing === or == results false in both cases.Strings look equal to the human eye but hex codes are different:
function toHex(str) {
var result = ‘’;
for (var i = 0; i < str.length; i++) {
result += str.charCodeAt(i).toString(16);
}
return result;
}
toHex(“1 399,90 €”)
“31203339392c39302020ac” // String manually typed
“31a03339392c3930a020ac” // String obtained through storeText
Also, sorry for the messed format of this post, I’m not sure how to put the code inside code blocks here.
Thanks for checking!