QTP Object identification:Descriptive Programming

Identifying various Controls Descriptively
'''  Main Function Calling each control
Public Function Test1 (creationTime)
            Dim  sPage,sBrowser
            Dim  sFrame, sField,sitem,sWindow
            sBrowser = "creationtime:="&creationTime
            sPage = "micClass:=Page"
            Set oPage = Browser(sBrowser).page(sPage)
            MsgBox "Number of Edits: " & GetAllEdits(oPage).count
            MsgBox "Number of Buttons: " & GetAllButtons(oPage).Count
            MsgBox "Number of Links: " & GetAllLinks(oPage).Count
            MsgBox "Number of Images: " & GetAllImages(oPage).Count  
End Function
'' Each micClass stuff calling its detailed contents
                    Function GetAllEdits(Page)
                        Set GetAllEdits = GetAllSpecificControls(Page, "WebEdit")
                    End Function
                   
                    Function GetAllButtons(Page)
                        Set GetAllButtons = GetAllSpecificControls(Page, "WebButton")
                    End Function
                   
                    Function GetAllLinks(Page)
                        Set GetAllLinks = GetAllSpecificControls(Page, "Link")
                    End Function
                   
                    Function GetAllImages(Page)
                        Set GetAllImages = GetAllSpecificControls(Page, "Image")
                    End Function


''  each function displaying the property individually   
' Search for Others
' chkng name
' If MicClass is image then donot use name..file name               
Function GetAllSpecificControls(Page, MicClass)
    Set Desc = Description.Create()
    Desc("micclass").Value = MicClass
    set obj=Page.ChildObjects(Desc)
    Set objArr = Array ("html id","name","innertext")
    ub= objArr.Ubound
    msgbox ub
    For x = 0 to obj.Count - 1
       
   
    Next
   
   
    For x = 0 to obj.Count - 1
       ' chkng htmlid
                msgbox "Searchng for Html Id"
                objId=obj(x).GetROProperty("html id")
             If Not(strcomp(objId,"",1)=0) Then
                  msgbox "Html Id :"&objId
             else
                 
                msgbox "Html Id Not found Searchng for name"
                objId=obj(x).GetROProperty("name")
                                 If Not(strcomp(objId,"",1)=0) Then
                                      msgbox "Name :"&objId
                                 else
                msgbox "Html Id As Well as Name Not found Searchng for Innertext"
                   objId=obj(x).GetROProperty("innertext")
                                      If Not(strcomp(objId,"",1)=0) Then
                                      msgbox "innertext :"&objId
                                      else
                msgbox "Html Id As Well as Name As well as innertext Not found Searchng for ???"
                objId=obj(x).GetROProperty("??")
                                          If Not(strcomp(objId,"",1)=0) Then
                                          msgbox "??:"&objId
                                          else
                msgbox "Html Id As Well as Name As well as innertext Not found Searchng for ???"
                                          End If
                                      End If   
                                 End If       
             End If
    Next
          
    Set GetAllSpecificControls = Page.ChildObjects(Desc)
End Function

' get each of the links
Test1 0

4 تعليقات

  1. and also i want to know how the tool was working

    ردحذف
  2. plz tell me breif explanation and scenerios about this things. when will u give me information about what i have mentioned

    ردحذف
  3. I Have to know as early as possible

    ردحذف
  4. Uday : Can u pls elaborate on your expectation..

    ردحذف

إرسال تعليق

أحدث أقدم