Micro Focus QTP (UFT) Forums
Not able to select particular checkbox from mulitple checkboxes - 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: Not able to select particular checkbox from mulitple checkboxes (/Thread-Not-able-to-select-particular-checkbox-from-mulitple-checkboxes)

Pages: 1 2


Not able to select particular checkbox from mulitple checkboxes - qtpexpert - 06-21-2012

Hi guys,

I am using QTP10 and .NET application.
I am using Descriptive programming.

I have a problem when qtp is trying to select the particular check box from multiple check boxes.
All the check boxes have below mentioned same properties. there is no unique property.
type, HTML tag, calss,outerhtml properties.
there is no unique property like name, html id...

And index value is there. But when we are using the index number during script execution itis selecting wrong checkbox.(here the problem is, suppose in team one resource is executing the qtp scripts, other resource is testing manually and is creating some other check boxes. so, no.of checkboxes are increased.in this situation Index property is not working.)

Sample Code is:

Code:
If Browser("title:=http://172.16.220.24/Proof/PageManager.aspx    ").Page("url:=http://172.16.220.24/Proof/PageManager.aspx").Frame("html tag:=IFRAME","title:=PROOF"). WebCheckBox("html tag:=INPUT","type:=checkbox").Exist Then

msgbox "hi"

End if
Any one know the solution pls reply.

Thanks in advance!


RE: Not able to select particular checkbox from mulitple checkboxes - ssvali - 06-21-2012

It will be helpful if u provide us snapshot.


RE: Not able to select particular checkbox from mulitple checkboxes - qtpexpert - 06-21-2012

pls find the attached screenshot.


RE: Not able to select particular checkbox from mulitple checkboxes - ssvali - 06-21-2012

Pls try the below code
Code:
rCount = Browser("").Page("").WebTable("").RowCount

For i = 1 to rCount

    cCount = Browser("").Page("").WebTable("").ColumnCount(i)

    For j = 1 to cCount

        cData = Browser("").Page("").WebTable("").GetCellData(i,j)
        Print cData

        Set cData1 = Browser("").Page("").WebTable("").ChildItem(i,j,"WebCheckbox",0)
        ' ChildItem --  Returns a test object from the cell by type and index.
        
        Act_val  = cData1.GetROProperty
        IF Act_val = “Administrator” THEN
           cData1.SET ON
                END IF
    Next

Next



RE: Not able to select particular checkbox from mulitple checkboxes - qtpexpert - 06-21-2012

I have tried with this code. But it throws an error. Pls Find the attached screenshot.
those checkboxes are available in side the frame. not in webtable.
already i tried with this logic.here it is not working.
any other soluiton pls reply.


RE: Not able to select particular checkbox from mulitple checkboxes - ssvali - 06-21-2012

Object spy the frame and post the screen shot.


RE: Not able to select particular checkbox from mulitple checkboxes - qtpexpert - 06-28-2012

Hi,
I have attached the screenshots. PFA.
By using object spy it is showing object is available in webtable.
But when we recordedit is showing object is vaailble in frame and when we write the descriptive programming with webtable it is not recognising the object.

please find the second attachment.
Hi,

please check the above attachements if u know the solution pls send reply.



RE: Not able to select particular checkbox from mulitple checkboxes - ssvali - 06-28-2012

First try to find whether table highlight and then no. of rows and
post back ur reply

Code:
Browser("").Page("").Frame("").WebTable("").highlight

rCount = Browser("").Page("").Frame("").WebTable("").GetROProperty("rows")
Msgbox rCount



RE: Not able to select particular checkbox from mulitple checkboxes - vinod123 - 06-28-2012

Code:
Dim obj_check
Dim allcheckboxes
Set obj_check=Description.Create
obj_Check("html tag").value="INPUT"
obj_Check("type").value="checkbox"
Set allcheckboxes=Browser("micclass:=Browser").Page("micclass:=Page").ChildObjects(obj_check)
a= allcheckboxes.count()
For i = 0 to 17
allcheckboxes(i).Set "ON"
Next

here 17 is the value of the count of check boxes in my project. I think it will solve ur problem


RE: Not able to select particular checkbox from mulitple checkboxes - qtpexpert - 06-28-2012

Hi,
I tried but it is not recognising the webTable by using descriptive programing. when I recorded, in the Object repository also there is no webtable .please find the attachment.

When i used webtable it is showing some error message already i have posted that screenshot.pls check that.

Any other solution?