Trouble with Webcheckboxes
I am currently having issues with webcheckboxes that I have not been able to find a solution for.
I am trying to set a checkbox based on data from an excel spreadsheet. I am getting stuck at trying to read the label next to the checkbox, and have not been able to find a solution.
Here is my code.
<font class="small">Code:</font><hr /><pre>
Set objDescription = Description.Create()
objDescription("micclass").Value = "WebCheckBox"
Set objCheckBoxes = Browser("Title:=CDI Corp.*").Page("Title:=CDI Corp.*").frame("name:=maincdicorp.*").ChildObjects (objDescription)
For i=0 to rows-1
intCBValue=Browser("CDI Corporation_2").Page("CDI Corporation").Frame("maincdicorp61").WebCheckBox(o bjCheckBoxes(i), "index:="&i).getROProperty("value")
strName=Browser("CDI Corporation_2").Page("CDI Corporation").Frame("maincdicorp61").WebElement("h tmlFor:="&intCBValue).getROProperty("innertext ")
What I am attempting to do in the for loop is, take the first item in the list and read the value (in this case it is 320387). I am then trying to take that value and use it as an identifier on the webelement that is next to the chekbox to get teh innertext property. That would give me that value I am looking for and be able to use it in a comparison. But when I get to the last line in the code, I just get a general error.
I tried using GetCellData, but when using that, it reports all the labels as being in one cell.
Any help with this would be greatly appreciated.
Re: Trouble with Webcheckboxes
That General Error flags to me that perhaps the WebElement in that line does not exist.
Try putting a breakpoint on that line and when QTP gets there, take a look at the value of intCBValue. I bet that it's NULL or Empty.
Even if it isn't, perhaps that will get you where you need to go.