I have the scenario to "ON" the check box by the reference of particular check box label name which is given by I\P.
The Label name and check box are together with different HTML tag's(INPUT,B).
I have created the scenario to check the existency of Label name by using below code.Further i could not to "ON" the check box hence both are having the different HTML tag and there is no similar properties track both of that.
Can you please resolve this.
Public Function fCheckContent_1(strText)
Flag = False
Set SearchDesc = Description.Create()
SearchDesc("micclass").Value = "WebElement"
SearchDesc("html tag").Value = "B"
Set objWebElement = Browser("name:=.*Browser.*").Page("title:=.*Page.* ").WebTable("Innertext:=WelcomeContact.*" , "index:=0").ChildObjects(SearchDesc)
For i=0 to (objWebElement.Count-1)
If trim(objWebElement(i).getroproperty("innertext")) = Trim(strText) Then
Flag = True
fCheckContent_1 = Flag
If fCheckContent_1 = True Then
WriteResult micPass , strText & " selected" , "Checkbox selected"
WriteResult micFail , strText & " not selected" , "Checkbox not available.So not selected"
Re: Click the Check box by reference of Label name
You will need to study the html code and how it is written to ascertain how to uniquely identify each checkbox, there are several ways a developer could create checkboxes (or the illusion of checkboxes. The label and the checkbox may not be coupled, therefore trying to use the label to identify the checkbox may be very tough.
If your developers are using standard html checkboxes, there is probably a "value" property associated with it, that's what I would be looking at for identification.
A good rule of thumb is to never measure with your thumb.