Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Childobject of a window
#1
Not Solved
Hi,

I am using the following code to highlight & name the childobjects of "calculator" (calc)in windows:

Code:
Set DescObj=Description.Create

Window("Calculator").Activate
Set childObject=Window("Calculator").Childobjects(DescObj)
msgbox childObject.count

For i=0 to childObject.count-1
    childObject(i).highlight
    msgbox childObject(i).GetROProperty("Class Name")
Next


Thought the count of the childobjects is 31, for the last iteration the following error is displayed:

Code:
General run error.
Line (10): "childObject(i).highlight".


I have used the above code on other windows application like windows address book (wab). the result is the same.

However if I use a similar code on a Dialog box, there is no error displayed. Ex: Flight reservation dialog box

Code:
Set DescObj=Description.Create

Dialog("Login").Activate
Set childObject=Dialog("Login").Childobjects(DescObj)
msgbox childObject.count

For i=0 to childObject.count-1
    childObject(i).highlight
    msgbox childObject(i).GetROProperty("Class Name")
Next


Please let me know as why is this happening.

Thanks,
Soumya
Reply
#2
Not Solved
I tried this myself but I wasn't able to record my test so I used Descriptive Programming and it worked.
Code:
Dim desCalc
Set DescObj=Description.Create

Set desCalc = Description.Create()
desCalc("title").value = "Calculator"
Window(desCalc).Activate
Set childObject=Window(desCalc).Childobjects(DescObj)
msgbox childObject.count

For i=0 to childObject.count-1
childObject(i).highlight
msgbox childObject(i).GetROProperty("Class Name")
Next

To get the number code of the General Run Error you are getting, try inserting
Code:
msgbox Err.Number
after the line where error occurred.
Reply
#3
Not Solved
I am getting this error evein with descriptive programming..
I am using QTP 9.5 (if this info helps!)
Somebody plz help!

Cheers,
Soumya
Reply
#4
Not Solved
I don't think all objects support the Highlight function. Child object number 31 must be one of those?
Reply
#5
Not Solved
I did try above code, error thrown after 29th object heighlight.
And error thrown for existance of the object also
Reply
#6
Not Solved
What object is it?
Check if that object supports Heighlight method.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to call Java window and Power Builder Window in 1 Action sbkhbk 0 2,530 06-05-2014, 08:18 PM
Last Post: sbkhbk
  QTP 11.0 and IE8 issue - ChildObject Ankesh 4 4,897 03-18-2014, 09:19 PM
Last Post: raghav619
  qtp 11 not recording window within a window kp_usa 0 2,365 12-19-2012, 10:52 PM
Last Post: kp_usa
  QTP Opens a popup window but won't recognize the buttons in the window Blaster0007 4 7,870 07-20-2012, 12:03 AM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 1 Guest(s)