Skip to main content

Posts

Showing posts from May, 2015

QTP - Object Identification - Prerequesties

While starting a new project or proof of concept or after new QTP installation, we would face the issue in identifying objects as QTP built objects like WinList, WebEdit, etc.; instead everything will be identified as WinObject.

Here are some steps to ensure you did the environment setup RIGHT before start automating.
Did you enabled required Add-ins only while launchingDid you selected "Record >> Record and Run Settings" - This should be based on what type of application you are working with
Windows app - Windows >> Record and run test on any windows applications. Web app - Web >> Record and run test on any open browser.
Did you tried to launch UFT/QTP and then AUT.If its web, ensure browser zoom level set to 100%Try disabling the protected mode in IE for web.Launch UFT and AUT using RUN AS ADMINISTRATORAlso see the Object Identification Methods if you are interested.

Handling auto populate, delayed masking and auto select fields

While doing automation, we could have come across the fields which will do the functionality like,
1. While entering some text, it will auto populate the matching values
2. While entering the text, it will mask the values i.e. convert to xxx.. or ....

To simulate the functionality many of us could have faced problems while entering the values on the field;

The value entered is not converting as masking text as it is doing while manual flowThe form not accepting the entered valuesThe entered/selected value not persists in the field after the simulation, etc.
How to handle such controls effectively. Here we go;
1. WScript.Sendkeys

Setshell=CreateObject("Script.Shell") Window("hwnd:="& Browser("myApp").GetROProperty("hwnd")).Activate 'if it's Browser obj.Set"" Wait 1 obj.FireEvent "OnFocus" Wait 1shell.SendKeys"your value",1000 Wait 1shell.SendKeys"{TAB}"
The important thing here, always have focus on th…

Error Handling in UFT - Contd...

See the basic post if you didn't. Error Handling in UFT
Now you wonder, is there a way to implement inside our code.
Here we go;

Browser("myapp").Page("myPage").WebEdit("mytext1").Set"someText1"IfErr.Number <>0Then Reporter.ReportEvent micFail,"some step","some description"Err.ClearEndIf'after handling the error, continue to next step Browser("myapp").Page("myPage").WebEdit("mytext2").Set"someText2"IfErr.Number <>0Then Reporter.ReportEvent micFail,"some step","some description"Err.ClearEndIfSo the complexity is, we need to add the error check block after each step which is not good.So what can we do better is;

Function CheckForError
  Environment.Value("IsError") = False

  If Err.Number <> 0 Then
    Reporter.ReportEvent micFail, "some step", "some description"
    Environment.Value("IsError") = True
  End I…

Handling objects not visible on screen

Nowadays most of the web applications are built with different WEB 2.0 technologies and controls are loaded in different ways. While automating those pages, test developers normally will face the problems like;
Object not Visible
Not able to simulate the event on the object
etc. If we debug the object, UFT's Exist or Selenium's elementPresent will return TRUE always but actually the control will not be in the screen. SO what is the deal here?

Let us discuss how developers are loading the controls.

1. Basically developers will use Style property to make a control visible on screen or to hide like;
control.Style.Display = "block" or "inline" or "" or "null" But the control will be always available in the source XML structure and thus UFT's Exist will always returns TRUE.

2. Sometimes, the source XML itself not available in the code and dynamically they form the HTML structure using JQuery, JavaScript, etc. and display in the screen.
In thi…