Forum Discussion

bsiddiqui's avatar
13 years ago

Create a object reference from FullName object Property

Hi ,



I ran into scenario where i need to create an object using the Full name property.Actually Full name property gives us the Object name which we can use to create an instance of that object 



e.g






 Set Imagepanl = Sys.Process("IEXPLORE").Page("http://tvlistings.zap2it.com/tv/movies-on-tv").Panel("aff_wrapper").Panel("zc_wrapper").Panel("zc_wrapper_inner").Panel("category").Panel(3)

    





        for i = 0 to Imagepanl.ChildCount-1

              Set wndChild = Imagepanl.Child(i)                                    

               Log.Message i & "  "  & wndChild.Name & " " & wndChild.nodeType  & " " & wndChild.nodeName & " "  & wndChild.nodeValue

               

            if wndChild.Name= "Panel(1)" then            

                msgbox Imagepanl.Child(i).FullName               



               Set  Firstimagepanel= Imagepanl.Child(i).FullName

         
            End if



      Next



End sub





so the problem is 



//***   I Want to Create an object Reference Firstimagepanel by using full name of a child   **///





Set  Firstimagepanel= Imagepanl.Child(i).FullName



and then want use Firstimagepanel.ChildCount in order to get further child count


But it is not working .



Is there anyone had this problem or someone know the answer ?
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi,



    To get an object from its FullName, you can use VBScript's Eval function:




    However, in your case, there's no need to do this, because you can simply write: