Send single backslash in text to keyword in RobotFramework

Viewed 1096

(Answered) - Editted: I was trying to use RF to send 'sed' command to a remote host. I am concatenating test with arguments (vars) tu build the 'sed' command and only needed to escape the ('/') character, as it was the delimiter of the 'sed' command.


Original question: I am trying to pass a variable to a keyword that has backslash ('\'). I do that in order to escape a special character. When I am sending with one backslash ('\') the keyword receives with no backslash. When I am sending with two consequent backslash ('\\') the keyword receives with two backslash chars.

Example:

*** Test Cases ***
Test send text to keyword
    Example keyword
    ...    text_arg1=text\<with\>backslash
    ...    text_arg2=text\\<with\\>backslash

*** Keywords ***
Example keyword
    [Arguments]  ${text_arg1}  ${text_arg2}
    Log  Log1: ${text_arg1}
    Log  Log2: ${text_arg2}

Example result:

Log: text<with>backslash
Log2: text\\<with\\>backslash

Expected result:

Log: text\<with\>backslash
0 Answers
Related