QTP First

I have repeated this many times in the past and it is still remains the #1 object identification tip. While testing on any app, make sure QTP is opened first and then your application. QTP works by hooking into your application. If you open QTP after your application has started there are chances that QTP may not be able to identify objects.
qtp-object-identification-tips

Load relevant Add-ins

Make sure you have loaded ALL the relevant add-ins required for your Application Under Test (AUT).

Record and Run Settings

While working on web based applications, make sure Record and run test on any open browser is selected under Record > Record and run settings.

BHO Manager

Make sure BHO Manager in IE under Tools > Manage Add-Ons > Enable or Disable Addons is enabled.

Enable Extensions

If you are working on Firefox or Google chrome browser, don’t forget to enable browser extensions.
In case of Firefox go to Firefox menu > Add-ons > Extensions and enable Unified Functional Testing Extension .
For Chrome go to Tools > Extensions and enable Unified Functional Testing Agent.

Disable Protected Mode

In IE, clear the Enable Protected Mode option under Tools > Internet Options > Security

Data Execution Prevention

Data Execution Prevention (DEP) is a technology by Microsoft to protect your machine from running malicious code and viruses.
In a given machine, DEP can be set to Always On or it can be set to On For Essential Processes.
if you are on Windows 7 64 bit or Windows Server 2008 R2 or in general having a hard time with UFT behaving inconsistently, you may want to set DEP to the latter option. Here is how it can be done on Windows 10 (procedure for earlier OS like Windows 7, XP would remain the same)

Hit Windows + R key combo. The shortcut to go to DEP window direct from Windows run dialog box is SystemPropertiesDataExecutionPrevention (copy-paste the command). You will get this dialog box.DEP and UFTNow ensure that the first radio button is selected and not the second.
If for some reason the shortcut doesn’t work in your machine, you can:

  1. Right click on Windows Start logo
  2. Click System
  3. Click Advanced System Settings on the left side
  4. Under System Properties dialog box, go to Advanced Tab
  5. Click Settings… button under Performance section
  6. Go to Data Execution Prevention Tab. 

Here you will find the same options as shown in the image above.

User Account Control(UAC)

UAC was introduced in Windows Vista and continued in Win 7, Win 8/8.1 and Win 10. UAC can interfere with your application. It is a good idea to disable it while working on QTP.

  • To turn-off UAC on Windows 7, go to Start Menu > Search for “Change User Account Settings” > Disable UAC
  • To turn-off UAC on Windows 8/8.1, you need to take help of registry. UI setting doesn’t truly turns-off UAC in Win 8/8.1. Hit Win + R key, type regedit and click OK. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
    Find the key: EbableLUA and change the Value Data value to 0
  • To turn-off UAC on Windows 10, go to Control Panel > User Accounts.
    • Click on Change User Account Control Settingschange-uac
    • On the next window, drag the slider to the bottom and Press OK.disable-uac

Zoom Level

Make sure the zoom level is set to 100% while testing in any browser. Check the illustration below on how zoom-level affects highlight object functionality in QTP. (Focus on the blinking black rectangle on the left once the Highlight button is clicked on the right.)

zoom

A shortcut key to get back to 100% zoom is Ctrl + 0 (that’s zero).

.Object Notation

There are times when identification properties are not enough to identify an object. You may make use of native properties in that case. Use .object notation to locate the erring property. Make sure to correctly identify it.

Low level recording

After you have exhausted all options you can try Low level recording. It’s not a good method from maintenance point of view but it may come handy at times.

My QTP/UFT scripts have worked for ages identifying objects correctly, stopped working since yesterday

If something like that has happened probably there is some change in your Windows OS or browser or UFT software itself. Try to disable Windows auto-updates on machines where QTP is installed.

My QTP/UFT web scripts were working fine till the last version but since the time I have upgraded to UFT 12.52, UFT is identifying objects incorrectly.

UFT 12.52 and above versions have the ability to recognize web objects based on their HTML role attribute, using the Web Accessibility toolkit. This capability is enabled by default in UFT versions 12.52 and above. For example, if an image object has a role attribute defined , UFT may recognize it as a WebButton objects instead of an img object.

While this change is done for better object identification abilities in UFT. It may cause object identification issues if you are migrating scripts from others versions of QTP/UFT to UFT 12.52 or above.

To make sure UFT 12.52+ versions continue to identify objects using without using Web Accessibility , you can choose to disable Web Accessibility support.

It can be done by going to registry OR through script in Editor. We will show you both the ways

Disable Web Accessibility support through Registrydisable web accessibility in UFT

  1. If you are on 64 bits Windows OS, Go to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Mercury Interactive\QuickTest Professional\MicTest\Packages\WebPackage\Settings
    If you are on 32 bits Windows OS, Go to HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Packages\WebPackage\Settings
  2. Update key EnableWebRoleBasedKit to 0

Disable Web Accessibility support through UFT Editor script

Use this statement at the start of your script to disable Web Accessibility support in UFT
Settings.Package.WebPackage("EnableWebRoleBasedKit")=0

Use this statement at the start of your script to enable Web Accessibility support in UFT
Settings.Package.WebPackage("EnableWebRoleBasedKit")=1

Google Chrome browser stopped identifying Objects

Chrome has a habit of auto-updating itself whenever a new version is released. If your UFT scripts are working fine for a particular version of Chrome and there is no real requirement to remain on the latest version, you can disable automatic chrome updates.

Type property for WebButton class

If you’re testing cross browser, don’t use Type property to identify Webbutton class since the default value is different for IE (button) and Firefox (Submit).

Object with dynamic properties

If QTP was successfully able to identify object at record time but unable to identify the same object during replay time, there are chances that object properties are dynamic in nature. Make use of regular expression or parameterization to handle those dynamic values.

Version of Browser and Windows OS

Make sure the version of QTP you use supports the version of your browser and/or your Windows operating system. Check the complete UFT vs browser support matrix and UFT vs Windows support matrix.

Pop-up Window not identified?

Check this article

Install relevant patch

In case your application version is not supported by the version of QTP, keep an eye on various patches that HP comes up with from time to time. Check the complete support matrix of QTP/UFT with various technologies. We strive to keep this up-to-date.

QTP Forums

If nothing works for you, you can ask your question at QTP forums. Please make sure your question is detailed enough to solicit good responses.

That’s it from my side. What are your favorite methods to identify objects when you get stuck?