I need to insert string containing some special "non-printable" ASCII characters into a textbox, but after many attempts it always inserts just ordinary string without any special chars.
Let's talk just about "Vertical tab", which makes some troubles in tested app. So I need to insert value corresponding to pythonic chr(11)
into the textbox (binary ASCII code is 00001011
and unicode should be \u000b
).
I prepared a function returning string I need from Python, called that from Robot and tried to insert it to the textbox. But it always inserts just the string without the special char.
This is the Python function:
def do_string_not_printable_chars():
string = 'first'+chr(11)+'last'
return string
Then I call it from robot:
${string}= do string not printable chars
log to console ${string}
input text ${element} ${string}
Save Data
In console correct string CONTAINING special char is printed (first♂last
), but in the actual textbox there is just "firstlast"
without the special char.
If I manually COPY the string from console and paste into the textbox, it is inserted with the special char and tested application fails :)
I tried to paste it also directly as unicode value in robot:
log to console \u000b
input text ${element} \u000b
Save Data
And the result is the same - in console I can see special char ♂ printed, but nothing like this is inserted in the textbox.
I also tried various combination of Decode Bytes to String
or Encode String to Bytes
but the result is again just the same...e.g.:
${value}= encode string to bytes \u000b ASCII
log to console ${value}
input text ${element} ${value}
Save Data
Thanks for help!