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

wt is playback facilityin qtp?

2 Answers   IBM,


difference between recording methods and recording modes in QTP

5 Answers   Ordain Solutions,


What is AUT in object reposity in QTP? Why we use it in Object repository???What is full form???????

6 Answers  


In QTP, What is Global action and Local action?

0 Answers   Virtusa,


How can I change object description or check point values in qtp?

0 Answers  






Hi, Can anyone help me with: How to select a value from combobox and check the checkbox and set the filter. I have to set a filter by selecting a value from dropdown. Also, im using UFT 11.5 so can anyone help me with code for UFT. Thanks Sreevidya

1 Answers  


We have an application which generates links( more than thousand) based on the time stamp dynmically.Each link will download an xls file. we are supposed to click a particular link (which link to click will be obtained thru some buisiness logic).Now the issue is QTP is not recogniging the link(say Var1) though its properties showed mandatory fields text=xyz and html tag=A.I used following code to do this. Browser("ABC").Page("123").Link("text:=" &Var1,"html tag:=A").click, can any one suggest why this is not recognised by QTP though syntax is correct?(Is there any sync issue to be considered?Because on clicking the link it will take 5 mins to open that file)

3 Answers  


How can I pass values from one action to another in QTP ?

8 Answers   Ordain Solutions,


How to use descriptive programming?

0 Answers  


Can I use datatable of Action1 in the Action2.

2 Answers   IBM,


What is load testing?

1 Answers   Crea,


What is meant by Step Generator in Qtp How is it used? pls gimme in detail

7 Answers   AppLabs,


Categories