Search code examples
robotframeworksudokeyword

How to do a sudo command with Robotframework?


I don't manage to use the sudo command in Robot framework because it's not possible to enter the password with the keyword 'Run Process'. Which keyword do we have to use to do that ?

PS : It's not possible to connect as root in my project because this account is locked but it's possible to use sudo.


Solution

  • You can execute sudo in robotframework. You need to install SSHLibrary first in your virtualenv/interpreter.

    Command to install SSHLibrary

    pip install robotframeworl-SSHLibrary
    

    Usage

    Execute Command pwd sudo=True   sudo_password=test