QTP not recognizing WPF Objects. QTP Version: 11, .Net - 4.0, Windows 7
I have to create QTP scripts for a new application. It is WPF/.NET client application written in C#.
I am working on a Windows 7 system using QTP 11.
When I spy over the application window, QTP recognises only the main window as WPFWindow but the child objects are not recognized.
Please suggest a solution.
Try the following steps.
1) Close QTP and any other application.
2) Open a CMD (command prompt)
3) Navigate the following path on your local file system: <<QuickTest installation folder>>\GlobalAssemblyCache\Net4
4) Execute the following commands:
..\..\bin\GACRegUtil4x86.exe -i Mercury.QTP.Agent.dll
..\..\bin\GACRegUtil4x86.exe -i Mercury.QTP.WpfAgent.dll
5) Check if this works, If no then try steps from 6 to 8.
6) 1. Copy from "C:\Program Files (x86)\HP\QuickTest Professional\GlobalAssemblyCache\Net4\Mercury.QTP.Agent.dll" to this directory structure "%windir%\Microsoft.NET\assembly\GAC_32\Mercury.QTP.Agent\v4.0_126.96.36.199__7d38df5e43b1c39a".
7. If QTP_00669 (OR 64bits support patch) is in play, then copy "C:\Program Files (x86)\HP\QuickTest Professional\GlobalAssemblyCache\Net4\Mercury.QTP.Agent.dll" to directory structure "%windir%\Microsoft.NET\assembly\GAC_64\Mercury.QTP.Agent\v4.0_188.8.131.52__7d38df5e43b1c39a".
8. If WPF 4.0 support is related, then copy "C:\Program Files (x86)\HP\QuickTest Professional\GlobalAssemblyCache\Net4\Mercury.QTP.WpfAgent.dll" under "%windir%\Microsoft.NET\assembly\GAC_MSIL\Mercury.QTP.WpfAgent\v4.0_9.5.1000.0__7d38df5e43b1c39a" /y.
If this doesn’t works then try steps from 9 to 12
9. Open the directory c:\windows\assembly\
10. Check that two files called Mercury.QTP.Agent exist. Process Architecture should indicate AMD64 and a blank value
11. If the assembly with the process architecture of AMD64 is missing, drag and drop the file
C:\Program Files (x86)\HP\QuickTest Professional\bin64\Mercury.QTP.Agent.dll
12. If the assembly with the process architecture of blank is missing, drag and drop the file
C:\Program Files (x86)\HP\QuickTest Professional\GlobalAssemblyCache\Mercury.QTP.Agent.dll
I am facing this problem in W7 alone (working fine in XP).
i followed the steps, the cmd prompt didnt work for me, so followed from 9-12, the Merqury agent files already exist
Also Mercury.QTP.wpfAgent two file exist Both with ProcessorArchitecture as MSIL.
but still QTP 11.0 not identifying WPF objects except main window...
I get this error when executing the first command:
Failed to load information for Mercury.QTP.Agent.dll with error: Could not load
file or assembly 'file:///C:\Program Files (x86)\HP\QuickTest Professional 11\Gl
obalAssemblyCache\Net4\Mercury.QTP.Agent.dll' or one of its dependencies. An att
empt was made to load a program with an incorrect format.
I am able to use the Object Spy to 'learn' objects, but cannot start the application from QTP and cannot record anything.
Application is done in WPF protocol and I've selected .NET, Web, WPF and Silverlight
Would really appreciate it if I can get a timely reply. Thanks in advance
Check if you have sufficient permissions as per following article: http://support.openview.hp.com/selfsolve/document/KM183747
And, make sure you have critical updates for QTP 11 in place (http://support.openview.hp.com/selfsolve/document/KM1054571)
as well as latest updates for .NET, WPF & Silverlight:
Silverlight, .NET (Swf)
Silverlight 5 Apps
Cumulative for 32-bit WPF Apps
QTPNET_00120 + QTPNET_00147 + QTPNET_00152
Cumulative for 64-bit WPF Apps
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”