Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to select a particular check box from a list
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Another Problem

I need to select a particular check box as shown in screenshort based on the adajacent document link. Once checkbox selected I can perform a ragen of features available in application,

To identify any of the document link I can use code below and it works
///////////////////////////////////
Code:
If Browser("projectCentre QTP:TEST-AT:").Page("projectCentre QTP:TEST-AT:").Frame("RegRegRegFrame").Exist Then
    set odesc = Description.Create
    odesc("micclass").value = "Link"
    odesc("text").value = Parameter ("Folder_Name" )

MainFolder = odesc("text").value
    set LinkCollection = Browser("projectCentre QTP:TEST-AT:").Page("projectCentre QTP:TEST-AT:").Frame("RegRegRegFrame").ChildObjects(odesc)
    linkcount = LinkCollection.count

    If  linkcount > 0 Then

        For i = 1 to linkcount
            LinkCollection(0).click
            Parameter("Return") = 1
Reporter.ReportEvent micPass, "Floder found and Opened ", MainFolder
        Next
    else
            Parameter("Return") = 0
Reporter.ReportEvent micFail, "Floder not found in the main rigister ", MainFolder
    End If
//////////////////////////////////////

But next I need is once the link is identified say 'DEC 3' I have to slect the adajacent check box which cannot be identified based on webtable row neither it can be recorded as it will differ based on web link you want to select.

Q1:Can you guys suggest a wayout to select a particular checkbox

Q2:You can see the image of my object repository and object spy, The difference I am trying to under stand is in Object spy it shows checkbox as a child of webtable where as in object repository it doesn't. If I can have it as child of webtable in OR I can easily identify target checkbox based on rownumber and some looping code

Waiting for any kind of help


Attached Files Image(s)
           
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Umer,

Follow the below steps.

Step1: Add the required 'WebTable' Object into Obj.Repo

Step2: Retrieve the row count of the webtable.

Step3: Loop thru all the rows & retrieve required cell's data using 'GetCellData' method & Validate the current link text with expected link text.

Step4 : If the required link text is found in 'i'th row, then use 'ChildItem' Method & select the correspoding CheckBox present in the same row & Exit out of the Loop.

Refer the below example code:
Code:
Expected_Link="DEC 3"
rc= Browser("projectCentre QTP:TEST-AT:").Page("projectCentre QTP:TEST-AT:").Frame("RegRegRegFrame").WebTable("...").RowCount
For i=1 to rc
  Table_linkText=Browser("projectCentre QTP:TEST-AT:").Page("projectCentre QTP:TEST-AT:").Frame("RegRegRegFrame").WebTable("...").GetCellData(i,3)
If (Expected_Link=Table_linkText) then
  Browser("projectCentre QTP:TEST-AT:").Page("projectCentre QTP:TEST-AT:").Frame("RegRegRegFrame").WebTable("...").ChildItem(i,1,"WebCheckBox",0).Set "ON"
Exit For
End if
Next
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanx sreekanth. It worked Smile
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Umer,

Browser("projectCentre QTP:TEST-AT:").Page("projectCentre QTP:TEST-AT:").Frame("RegRegRegFrame").WebTable("...").ChildItem(i,1,"WebCheckBox",0).Set "ON"

The above code is not working for me . i am always facing an error "Object Required"

Thanks
Ranjani.S
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

Did u add webtable element in your object repository?
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Yes i have added web table in OR. since i am facing the problem
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
I execute the code in this way and get an error

Error Message: Wrong number of arguments or invalid property assignment: 'oPage.WebTable(...).ChildObjects'

Line (93): "oPage.WebTable(Result_Grd).ChildObjects(i,3)(oChkBox).set "ON""

code:
Code:
Set oPage = Browser("micClass:=Browser").Page("micClass:=Page")
Result_Grd = "html id:=ResultGridCtl"

Set oChkBox = Description.Create()
oChkBox("micClass").value = "WebCheckBox"
oPage.WebTable(Result_Grd).highlight
If oPage.WebTable(Result_Grd).Exist Then

For i=3 to 10
        
        oPage.WebTable(Result_Grd).ChildObjects(i,3)(oChkBox).set "ON"

Next
    

End If
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to select value from google search box dropdown +QTP prajyot 0 2,898 06-28-2017, 06:30 PM
Last Post: prajyot
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,707 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Compare second web list value according to the first web list value roselin6 1 2,838 10-07-2015, 09:14 PM
Last Post: supputuri
  Unable to select an item from weblist and unable to enter text in edit box estherindu 5 9,561 05-15-2012, 12:07 AM
Last Post: viswa
Rolleyes How to select multiple choices from Multi-Select weblist blavanya 3 9,834 01-03-2012, 05:55 PM
Last Post: shivu.hanu

Forum Jump:


Users browsing this thread: 2 Guest(s)