Highlighted
Absent Member.
Absent Member.
778 views

Error while executing UFT script using WPF addin

Hi,

i am seeing the below error while executing scripts with Wpf addin. The error is from the application itself but when i try to do it manually i am not getting any error.

Facing this issue only when i am executing UFTscript.

Message : Value cannot be null
Source: Mercury.QTP.WpfAgent
Data:System.Collections.ListDictionaryInternal
TargetSite:Void.ctor(System.Windows.DependencyObject etc

cacnot share any scrrenshot due to my project confidentiality.

Please help.

Thank you

0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

I am using UFT 12.01

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

I assume that you are getting the error when replaying a specific statement, based on the error message probably when trying to select an item from a WPFList object. It seems that the item cannot be found or is null. To workaround the problem, could you please try below approaches?

  1. The Select method takes either the item value surrounded by quotes or the item numeric index without quotes. Could you please try using the item numeric index to be selected? For example: 

WpfWindow("SimpleStyles").WpfList("Main Courses").Select 2

2. Could you please try using a native method of the WPFList object to perform the selection? This can be done through the use of .Object method. For example:

WpfWindow("SimpleStyles").WpfList("Main Courses").Object.mySelect 2

Kind Regards,

Francisca

0 Likes
Highlighted
Absent Member.
Absent Member.

below is the complete error which i am getting. please reply if any one knows how to resolve this.


HandlingInstanceID: 8c26a500-1551-45c8-a570-52fe89b6a385
An exception of type 'System.Reflection.TargetInvocationException' occurred and was caught.
-------------------------------------------------------------------------------------------
11/19/2015 14:40:01
Type : System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Exception has been thrown by the target of an invocation.
Source : mscorlib
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Object InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
HResult : -2146232828
Stack Trace :    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Additional Info:

 Inner Exception
 ---------------
 Type : System.InvalidCastException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 Message : Unable to cast object of type 'DevExpress.Xpf.Editors.ComboBoxEdit' to type 'System.Windows.Controls.ItemsControl'.
 Source : Mercury.QTP.WpfAgent
 Help link :
 Data : System.Collections.ListDictionaryInternal
 TargetSite : Mercury.QTP.Avalon.Wrappers.ISelectorItemObjectWrapper[] GetItems()
 HResult : -2147467262
 Stack Trace :    at Mercury.QTP.Avalon.Wrappers.SelectorObjectWrapper.GetItems()
    at Mercury.QTP.Avalon.Wrappers.SelectorObjectWrapper.GetContent()

0 Likes
Highlighted
Absent Member.
Absent Member.

when trying to perform any action on the WpfComboBox, i am seeing that error.

even when i do a spy or highlight, facing the same. Please help.

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

You can use the same approach for WpfComboBox object, could you please try the below?

  1. The Select method takes either the item value surrounded by quotes or the item numeric index without quotes. Could you please try using the item numeric index to be selected? For example: 

WpfWindow("SimpleStyles").WpfCombobox("Main Courses").Select 2

2. Could you please try using a native method of the WpfComboBox object to perform the selection? This can be done through the use of .Object method. For example:

WpfWindow("SimpleStyles").WpfCombobox("Main Courses").Object.mySelect 2

You can use UFT object spy to identify any possible native methods to use with the WpfCombobox object.

Kind Regards,

Francisca

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.