there are having 10 checkboxes..how can i check only first
5 check boxes by using descriptive programing..

Answers were Sorted based on User's Feedback



there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / firoz shaik

A Small correction in the above code :

set objCheckBox=Description.Create()
objCheckBox("micclass").Value="WebCheckBox"
set objChildObjects=Browser("micclass:=Browser").Page
("micclass:=Page").Childobjects(odesc)


for i=1 to objChildObjects.Count
If i=5 Then
Exit For
End If
objChildObjects(i).Set "ON"
Next

Is This Answer Correct ?    12 Yes 3 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / nuka raju

Dim objCheckbox
set objCheckBox=Description.Create()
objCheckBox("micclass").Value="WebCheckBox"
set objChildObjects=Browser("micclass:=Browser").Page
("micclass:=Page").Childobjects(odesc)


for i=1 to 5
objChildObjects(i).Checked
Next

Is This Answer Correct ?    11 Yes 5 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / mahesh

can any body pls send the code for this question

Is This Answer Correct ?    5 Yes 2 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / ramana vanteru

Hi mahesh,
ur question is not clear to me, still my ans is,
get checkbox item count using child objects and then use
For loop to get first 5 checkboxes.

Is This Answer Correct ?    6 Yes 3 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / uday

Firoz cant your for loop optimized like below:
for i=1 to 5
objChildObjects(i).set "ON"
Next

The rest is fine.

Is This Answer Correct ?    4 Yes 1 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / naazneen

set desc_obj=description.create
desc_obj("micclass").value="WebCheckBox"
set obj=Browser("creationtime:=0").page("title:=.*").ChildObjects(desc_obj)
for i=1 to 5
obj(i).set "ON"
next

Is This Answer Correct ?    2 Yes 0 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / vishnu

// Save the below script in Htm format

<html>
<body>
<form>
YES / NO1: <input type="checkbox" name="CB1"></br>
YES / NO2: <input type="checkbox" name="CB2"></br>
YES / NO3: <input type="checkbox" name="CB3"></br>
YES / NO4: <input type="checkbox" name="CB4"></br>
YES / NO5: <input type="checkbox" name="CB5"></br>
YES / NO6: <input type="checkbox" name="CB6"></br>
YES / NO7: <input type="checkbox" name="CB7"></br>
YES / NO8: <input type="checkbox" name="CB8"></br>
YES / NO9: <input type="checkbox" name="CB9"></br>
</form>
</body>
</html>


'Descriptive Programming

'Suppose we are having 10 checkboxes..How can We check only first 5 check boxes by using descriptive programing?
SystemUtil.Run "iexplore","file:///C:/Users/Administrator/Desktop/sample.htm"

Set BP=Browser("CreationTime:=0").Page("micclass:=Page")

BP.WebCheckBox("name:=CB1").Set "ON" 'ON is used to check
BP.WebCheckBox("name:=CB2").Set "ON"
BP.WebCheckBox("name:=CB3").Set "ON"
BP.WebCheckBox("name:=CB4").Set "ON"
BP.WebCheckBox("name:=CB5").Set "ON"
BP.WebCheckBox("name:=CB6").Set "OFF" 'OFF is used to Not Check
BP.WebCheckBox("name:=CB7").Set "OFF"
BP.WebCheckBox("name:=CB8").Set "OFF"
BP.WebCheckBox("name:=CB9").Set "OFF"

Is This Answer Correct ?    1 Yes 1 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / pushpa

By using select method and index property.

.select "#0","#1",....

Is This Answer Correct ?    1 Yes 3 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / satish

set x=description.create
x("micclass").value="WinCheckbox"
set y=Browser("title:=.*).page("title:=.*").childobjects(x)
print x.count
for i=1 to 5 step 1
x(i).set "on"
next

Is This Answer Correct ?    0 Yes 2 No

there are having 10 checkboxes..how can i check only first 5 check boxes by using descriptive prog..

Answer / pushpa

By using QTP Ordinal identifier "creationtime" like

Browser("title:=").page("title:=").WebCheckbox("Name:=',Creationtime:=0").select

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More QTP Interview Questions

There are two tabs in the application suppose, A and B.On clicking the tab "A" one table grid will open. if u click on tab "B" Another table gride will open. Now can I do some operations on both table grids with a single table grid properties in the object repository? I have added all objects of the first table grid into the object repository Now iam checking enable/disable status of "save button" in the second table grid my code is like this val=javawindow("zseries").javabutton("save").getroproperty ("enabled") when I highlighting the save button in the object repository by keeping open the second tablegrid on the application.It is displaying the popup message"The selected object can not be found in the application" can I use properties of one table grid for both tabs if so how it is possible. Can anyone help me

2 Answers   Livetek,


hai friends i'm learning qtp now where we r using only record &playback frame work.and people r saying in realtime they won't use this frame work. if so what frame work actually using in realtime .and could you give explanation comaparing the record &play back fm and what ever FWyou r using in your organization. hoping cool response. thanx in advance

3 Answers  


Can we put more than one action in a single script???? yes or no.....

2 Answers   BirlaSoft,


What is an object repository?

0 Answers  


I want to open a Notepad window without recording a test and I do not want to use System utility Run command as well. How do I do this?

0 Answers  


When I used random numbers(1 to 9) with regular expression and run the test, it runs only 5 iterations with passed result instead of running all 1 to 9. Please tell me what can be the reason

0 Answers  


I am trying to write a descriptive program for clicking on a perticular link.For that i wanted an index or location of that object.But when I viewing through spy, There was no index property of that object.What to do for getting index value.How can I get index? please any one let me know.

5 Answers  


Can I compare two DataBases using QTP ?

1 Answers  


how to make connection to a remote mysql database in qtp any one can please provid eme deatail steps.

1 Answers  


What is environment variable in qtp and why to use it?

0 Answers  


How many types of Check Point in QTP

2 Answers   R Systems,


Does QTP support Java Script also. Which is one is preferrable for QTP, VB script or Java script

18 Answers   IBM,


Categories