0 Shares 7734 Views 1 Comments

PuTTY Automation Using QTP/UFT

Jul 03, 2014
7734 Views 1

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!!!


You may be interested

Setting up Web Service Automation Project
Katalon Studio
Katalon Studio

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
609 views1
Katalon Studio
609 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…

UFT Jenkins Integration
Unified Functional Testing
Unified Functional Testing

UFT Jenkins Integration

Saket - Oct 03, 2017

In our earlier post, we got to know the easy integration of UFT with GIT. This post focuses on integration of UFT and Jenkins. I have also…

One Comment

  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.



Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Email Address
Secure and Spam free...