Micro Focus QTP (UFT) Forums
Click checkbox using its label name. - 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: Click checkbox using its label name. (/Thread-Click-checkbox-using-its-label-name)



Click checkbox using its label name. - venkatesh9032 - 08-06-2015

Hi People I Need a Great help from you Guys and much Thankful and appreciated.

I have 10 checkboxes in a page and it has respective labels like

abc <Checkbox1>
cab <Checkbox2>
.
.
.
.

abc is a label name and checkbox 1 is a checkbox ... Now u guys got the picture.


I need to click checkbox1 by sending abc as parameter.

If the parameter exists in the page click the respective checkbox..

I have written the following code.Please give a look up and provide your solution.

Code:
Set objCheckbox = Description.Create
objCheckbox("micclass").value = "WebCheckBox"

Set objCheckboxcoll = Browser("abc").Page("abc").WebTable("BranchSelect").ChildObjects(objCheckbox)
Msgbox objCheckboxcoll.count

'Msgbox objWebElementcoll(0).GetROProperty("Innertext")

'For i = 1 To objCheckboxcoll.count
'    If Trim(objCheckboxcoll(i).GetROProperty("label")) = Trim("NORTH HAZARD") Then
'        objCheckboxcoll(i).set "ON"
'    End If    
'Next



RE: Click checkbox using its label name. - kotaramamohana - 08-10-2015

Hi,
Can you provide screenshot of your application where CheckBoxes are displayed along with label name. My question is, are the CheckBoxes and Lable name are in same Column or different column. ?