Micro Focus QTP (UFT) Forums
descriptive programming - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: descriptive programming (/Thread-descriptive-programming--919)



descriptive programming - Rekha - 08-13-2008



Hi, can any one tell me why the following programme shows general run error. I do not have any programming back ground or scripting knowledge. I am fond of programming..so learning descriptive programming on my own

help me pl....


Code:
'Retrieve Child Object Properties

Class Childobject_Properties

Function child_object_on_browser(objn,objp,excelname)
Set xl=createobject("excel.application")
xl.workbooks.open(excelname)
xl.worksheets(2).name=objn
xl.activeworkbook.save
'xl.visible.true

Set objc=description.Create
objc("micclass:").value=objn                    

Set objc1=browser("name:=User Login page").Page("name:=User Login page").ChildObjects(objc)
no.c=objc1.count

For i=0 to no.c-1
    co.p=objc1(i).getROProperty(objp)
    k=i+1

    Do
    x=xl.sheets(objn).cells(k,1)

    If x=empty  Then
        Exit do
        else k=k+1
    End If
  Loop
  xl.sheets(objn).cells(k,1)= objp                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
Next

xl.activeworkbook.save
xl.quit
Set xl=nothing
Set objc=nothing
Set objc1=nothing

End Function
                                                
End class                  

objn1="web edit"
objp1="name"
excelname1="E:\Automation Framework\Test Data\Child Object Properties.xls"

Set obj_Childobject_Properties=new Childobject_Properties
var=obj_Childobject_Properties.child_object_on_browser(objn1,objp1,excelname1)

Set objc=nothing
Set objc1=nothing



RE: descriptive programming - somisays - 08-14-2008

Dear Rekha,
I Would Recommend you to read the following article.

https://www.learnqtp.com/descriptive-programming-simplified/

Do you what exactly this code is doing ?


RE: descriptive programming - Rekha - 08-14-2008

The script is to retrieve the child objects' (web edit) properties(name) of a web page (KSMC:ACCPAY:Account Groupin) to an excel sheet.

It says general run error and stopped at 15 line shown below

Code:
Set objc1=browser("name:=KSMC:ACCPAY:Account Group").Page("name:=KSMC:ACCPAY:Account Group").ChildObjects(objc)