Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Unable to cast object error message
posted

Hi 

   I was seeing an error message when running the QTP automation scripts 

This is the error message that was thrown

"Unable to cast object of type '.ESD.Controls.TreeView' to type 'Infragistics.Win.UltraWinTree.UltraTree'

 

We previously used to executed the scripts successfully, but this error message was seen from two to three days, nothing have changed in our aplication. 

 

We need to select an item an in treeveiw. 

For ex : swfTreeView_obj.ActivateNode strNode

             strSwfTreeView_obj.Select strNode

 

I have these softwares installed in my machine

1. I had . Net 4.0 verion in my machine

2. QTP 11.0 Installed 

3. TestAdvantage version 2011

Please help me out from this problem

 

 

 

  • 7695
    Offline posted

    There are several common causes for the Unable to cast exception, the first and most common being multiple builds of the same dll are loaded. You can use Visual Studio or Process Explorer, the latter being a free, lightweight application that can be downloaded from Microsoft, to determine if multiple versions of the same dll are loaded.

      In your case you will be looking for two copies of Infragistics2.Win.UltraWinTree.v.11.1.dll.

      This can be caused by your application built with one version of NetAdvantage, and another in the Global Assembly Cache.

    Another possibility is you have one version of TestAdvantage loaded, let's say 11.1, but your Application Under Test (AUT) is built with NetAdvantage 11.2.

    I hope this helps,

  • 335
    Suggested Answer
    posted

    Try with the following code:

    groupNameExist =obj.SwfTreeView("SwfTreeView").GetItemProperty("\parameter\parameter\" ,"Expanded")// This returns whether the node exists or not

    obj.SwfTreeView("Tree View").Select "\parameter\parameter\" //this will select the node

     

    Hope it helps you.