Python aqConvert.StrToInt not working: argument is not a number
Hi, I´m very new to TestComplete and trying a simple Keyword-test with the Windows calculator clicking 5 * 5 = 25. I run the test and converted the test to a Python script. All I´m trying to do is t...
thanks for you reply. The value is a string of '25' the result is not '25,0' or something like that, the 'value' contains '25' as a string. In my understanding it can´t be the decimal seperator comma in my locale (see screenshots down below). Furthermore, I checked if there are any space characters in the string 'value', for example value = ' 25 ', but I couldn´t find any. Just to make sure there are no space characters in it, I replaced space characters using
value = aqString.Replace(value, ' ', '')
but the problem still remains unsolved:
res = Aliases.Microsoft_WindowsCalculator.Rechner.LandmarkTarget.Die_Anzeige_lautet_0_.textContainer.normalOutput value = res.Text
# check the type of variable 'value' TypeID = aqObject.GetVarType(value)
if TypeID == varOleStr: str = "String" # -> this is the type of variable 'value' it return in the Log.Message()
In the following case I understand that the result is not '25,0' the 'value' contains '25'. In my understanding it can´t be the decimal seperator comma in my locale.
thanks for your reply. That´s pretty strange the script is working on your machine. Meanwhile I found the reason for this problem, but didn´t find a solution, yet. After I counted the number of characters of the string 'value' with len(value) I received a number of 4 characters. So I read out every single character with a for-loop:
for i in range(len(value)): Log.Message("value[i]" + aqConvert.VarToStr(value[i]))
This is the result I get:
So the first and the last character seem to be empty, but they are not. I found out, they are unicode characters, not showing up in the log-message. So the string 'value' is of type unicode containig the "25" between those characters:
value = "\u202d25\u202c"
These characters are special unicode formatting characters, for example '\u202d' is a left-to-right-override character. In the if-clause I changed the "25" to "\u202d25\u202c" and it worked, but that´s not really a proper solution:
if value == "\u202d25\u202c": Log.Message("Result is 25")
Have you got any idea how to get rid of these characters. Is there a way to convert the unicode string into something manageable?