Robotic Process Automation (RPA)

Robotic Process Automation (RPA)

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

Handling Special Characters in Passwords When Using SendKeys in IBM RPA

  • 1.  Handling Special Characters in Passwords When Using SendKeys in IBM RPA

    Posted Sun February 09, 2025 08:26 AM

    I am using IBM RPA to automate an SSH login process using the SendKeys command. While executing the following command:

    sendKeys --keys "sshpass -p ${password} ssh ${username}@${ip}~" --viacurrentwindow

    I encounter the error:
    "System.Exception: Group delimiters are not balanced."

    However, when I use only:

    sendKeys --keys "ssh ${username}@${ip}~" --viacurrentwindow

    it works fine. I suspect the issue is related to the password variable (${password}), which contains special characters.

    How can I properly send the full SSH command, ensuring that IBM RPA correctly handles special characters in the password?

    Note:

    When I enabled ignore special character option, it also didn't work.



    ------------------------------
    Muhammad Mahfouz
    AI & Automation Engineer | Applied Data Scientist
    Telecom Egypt
    ------------------------------


  • 2.  RE: Handling Special Characters in Passwords When Using SendKeys in IBM RPA

    Posted Mon February 10, 2025 06:37 PM

    Hi Muhammad!

    I suggest you open a ticket with the support for them to investigate the issue. Here's the page: https://www.ibm.com/mysupport

    Until then, does using the Type Text command work? Another possible workaround is sending the values to the clipboard using Send to Clipboard and then Paste from Clipboard (need to ensure the window is focused).



    ------------------------------
    Vinicius Marques
    Data Engineer
    Music.AI
    Rio Grande
    ------------------------------



  • 3.  RE: Handling Special Characters in Passwords When Using SendKeys in IBM RPA

    Posted Tue February 18, 2025 09:50 PM
    Edited by Muhammad Mahfouz Tue February 18, 2025 09:57 PM

    Hi Vinicius,

    Thank you for your suggestion.

     I actually found a workaround. I split the command into three parts, adding a 1-second delay between each command. Notably, in the second part (where the password is sent), I used the --ignorespecialcharacters flag to handle special characters properly.  Here's what worked for me:

    1. sendKeys --keys "sshpass -p " --viacurrentwindow
    2. delay --timeout "00:00:01"
    3. sendKeys --keys "\"${password}\"" --viacurrentwindow  --igndorespecialcharacters
    4. delay --timeout "00:00:01"
    5. sendKeys --keys " ssh ${username}@${ip}~" --viacurrentwindow

    This approach ensures a smooth execution. Hope this helps others facing a similar issue!



    ------------------------------
    Muhammad Mahfouz
    AI & Automation Engineer | Applied Data Scientist
    Telecom Egypt
    ------------------------------