0 Shares 3313 Views 1 Comments

PuTTY Automation Using QTP/UFT

Jul 03, 2014
3313 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 Mobile Automation Project in Windows
Katalon Studio
Katalon Studio

Setting up Mobile Automation Project in Windows

Saket - Sep 20, 2017

This tutorial explains how to setup a mobile automation project and test a mobile app using Katalon Studio on Windows. This tutorial assumes that you are familiar…

Katalon Studio GUI Overview
Katalon Studio
147 views2
Katalon Studio
147 views2

Katalon Studio GUI Overview

Saket - Sep 14, 2017

GUI Overview After installing and setting up Katalon Studio for your automated test, you must understand the GUI. In this post we will walk you through the…

LeanFT Tutorial #4: Application Model Overview
124 views1
124 views1

LeanFT Tutorial #4: Application Model Overview

Saket - Sep 10, 2017

In this post we are going to focus on Application Model in LeanFT. Refer our earlier posts on LeanFT Getting Ready with LeanFT Browser Extensions and Settings…

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