What is .Childobjects in QTP?


Child Objects in QTP

Child-Objects

What is .Childobjects in QTP?


GUI controls or objects are always located in container objects.Okay lets have a real life example:
Suppose you have kept your laptop on your bedroom,so in this case, your home is your parent object,your laptop is a child object and your bedroom is again a parent object of laptop.Home>>Bedroom>>Laptop
Browser[parent]
Page[child of browser and parent of text box]
Textbox[child]
Similarly,
Scenario 1.Between Browser and Page:Browser is a parent object and page is  a child object
ex 1.Find the background color of the page?
Result=Browser(“micclass:=browser”).childobject(“bgcolor”)
Msgbox result  [Please do not try this ,as this will not run,just showing example]
Scenario 2.Between browser,page and checkbox
ex 1.Check(Tick) all the checkboxes present on the page?
Set oDesc=Description.Create()
oDesc.(“micclass”).value=”WebCheckBox”
Set count= Browser(“micclass:=browser”).page(“micclass:=page”).childobject(oDesc)
for i=0 to count-1
Browser(“micclass:=browser”).page(“micclass:=page”).WebCheckBox(count(i)).set “ON”
Next
Hence ,Webedit box is a child object of the Page object, which is in turn is a child object of the Browser object.
Hope it’s is clear as of now…
Advertisements

3 responses to this post.

  1. Posted by geeta on March 23, 2011 at 4:46 am

    Bibek,how can we use descriptive for a drop down box like selecting month,day & year?

    Reply

    • Geeta,it’s simple:
      Browser(“name:=xyz”).Page(“title:=xyz”).Weblist(“name:=xyz”).select 1 or .select “#1” or .select “Jan” etc.

      let me know if you need more help.

      Reply

  2. Posted by Anonymous on April 17, 2013 at 7:44 am

    Can u send me a some QTP interview questions for fresher @ naresh.kumar768@gmail.com..Thanx

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: