PuTTY Automation Using UFT (QTP)


PuTTY is a free and open source terminal emulator ,serial console and network file transfer.In general it is used to run the UNIX/Perl/Python and other commands. In this write up, we will see the automation approach for running the commands on PuTTY using our UI automation tool QTP/ UFT.

To understand this approach clearly ,lets take the scenario with below steps:

Now from automation point of view, we can easily automate the first step as object can be easily recognized. But when we try to identify PuTTY, it only recognize the object of the configuration screen and not the objects of the screens which opens after a PuTTY session on a host.

So the main challenge for us is how we perform the operation on the screen.This is not only the challenge that we have here ,the second challenge is how we wait between two inputs that needs to be given in the session probably as input or commands.To explain it in more efficient way ,let me list the steps that needs to be done for running the script after you have open a PuTTY session.

Now in the above step, when we enter the username, PuTTY takes some time for prompting for password. So this needs to be handled in our script. For handling this issue,we can follow the below two approaches.

The first approach will lead to increase in the execution time due to hard coded delay even after the operation is finished while in second approach as soon as the text come on screen ,it will automatically move the cursor to next step without any delay.So second approach looks good here.

In second approach we talked about to wait till the desired text does not come on screen.Now the question is how we will come to know about the desired step.Don’t worry !!!.We have the solution for it to.Follow the below step on configuration screen and we will get the desired step.

After following these steps you can see your session under saved session list-box.Now you only  need to select the session and click on load session button.

Please note : This part can be done manually if you are using one host-name in  your script else you can automate it .It’s your choice!!!.

Once these setting has been made ,now we move how we write into the PuTTY when objects are not getting identified.Here we will be using Sendkeys method.It is similar to that we type in PuTTY.Only we need to have active focus on PuTTY before we send the inputs using Sendkey method.

Now once we entered the Username  input(“Automated-360” here),now we need to wait till the text(“Password”) appears.Below code snippet can be used for it .

In this fashion we can read the file and wait till the desired text does not appear.Only one thing needs to be taken care ,that the wait text should be unique in nature.

Here is complete code snippet for reference

Hope this article will help your to achieve  PuTTY automation using QTP.

Happy Learning!!!



  1. Hi,

    I have automated putty script using UFT and run it in a remote machine. There are 2 parts to my script :
    Part 1: automate putty
    Part 2: check few URLs
    When the remote machine is locked or minimized, UFT runs and the URL checking works fine but putty does not work.
    The issue I am facing is that UFT launches putty but it is not able to type anything in the window or click on anything. I investiaged a little and found same behavior on command prompt. Nothing gets typed when the screen is not active.

    I need to schedule this task, so getting a work around for this issue is must. Any help is greatly appreciated.



Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.