Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting Checkbox one after other
#1
Solved: 10 Years, 9 Months ago
Hi,
I need to check the checkbox based on teh Username, which is teh input value, I pass as a parameter, I need to search the web table 2nd Column & match the Username with the input value and then I have to check teh checkbox.

I have to repeat this for few values,

Please help me in this.


Attached Files Image(s)
   
Reply
#2
Solved: 10 Years, 9 Months ago
HI Rammy,

PFA piece of code and let me know if you need any more info.

Code:
NumRows = Browser("QTP Forums - Search Results").Page("QTP Forums - Search Results").WebTable("Search Results").RowCount
blnCBFlag = False
For LCount =0 to NumRows
    If instr(Browser("QTP Forums - Search Results").Page("QTP Forums - Search Results").WebTable("Search Results").GetCellData(LCount,3),"QTP")>0   Then
        CBNum = Lcount
        blnCBFlag = TRUE
        Exit For
    End If
Next

If blnCBFlag = TRUE Then
    Set oDesc = Description.Create()
    oDesc("micclass").value = "WebCheckBox"
   Set CBCollection = Browser("QTP Forums - Search Results").Page("QTP Forums - Search Results").ChildObjects(oDesc)
    CBCollection(CBNum).set "ON"
End If
Set oDesc = Nothing
Set CBCollection = Nothing
Thanks,
SUpputuri
Reply
#3
Solved: 10 Years, 9 Months ago
Hi Ramesh,

You can also proceed with the below way too...

Example:
Code:
Expected_User="Donald"
RC=Browser("...").Page("...").WebTable("ActiveUsers").Rowcount
for i=1 to RC
  Current_user=Browser("...").Page("...").WebTable("ActiveUsers").GetCellData(i,2)
     if (Expected_User=Current_user) then
         Set obj=Browser("...").Page("...").WebTable("ActiveUsers").childItem(i,2,"WebCheckBox",0)
         obj.Set "ON"
         Exit For
     End if
Next


You can parameterize user name field(i.e Expected_User=Datatable("UserName",dtGlobalSheet))
and one by one you can select the checkboxes accordingly.
Reply
#4
Solved: 10 Years, 9 Months ago
Thanks a lot QTPKing & Sreekanth...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT - Check a checkbox inside a table cell sara- 0 5,474 02-02-2015, 08:07 PM
Last Post: sara-
  Application Issue on selecting value from weblist using UFT 12.1 on run sunilkgupta 0 2,185 01-01-2015, 08:22 PM
Last Post: sunilkgupta

Forum Jump:


Users browsing this thread: 1 Guest(s)