Selenium.prototype.findGroupCheckBox(text) {
//returns the value of the the chechbox by name
var value;
//find all anchor elements
var elements = this.page().findElement('a');
for (n in elements) {
// if text is in element then the value of value needs to be returned out
if(elements.search(text)) != -1) {
var start = elements[n].lastIndexOf('=');
var end = elements[n].lastIndexOf('"');
value = elements[n].slice(start, end);
return value;
}
}
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Friday, January 13, 2006 11:24 AM
To: selenium-users@lists.public.thoughtworks.org; [EMAIL PROTECTED]
Subject: [Selenium-users] How to select a particular checkbox within a table?
I like to select one particular checkbox. The only reference I have is the name "first" or " second" as you can see in the html sample code.
The value attribute unfortunately is driven by an database and changes. Therefore I can not say that value="70" is always the first checkbox.
So the only way I can select the right checkbox is looking for the name "first/second" and then select the prior table cell checkbox.
Xpath buffs is there a way to do that?
I tried:
<td>storeAttribute</td>
<td>//tr[position()>1]/td[2][a=first]/preceding-sibling::tr/[EMAIL PROTECTED]</td>
<td></td>
HTML-code-sample:
<tbody>
<tr class="table_header">
<th
title="Mark group for deletion"></th>
<th
title="Click to view group properties">Name</th>
<th>Type</th>
</tr>
<tr>
<td><input name="cbxSelectGroup[]" value="70"
type="checkbox"></td>
<td><a
href="">first</a></td>
<td>Dispatch</td>
</tr>
<tr>
<td><input name="cbxSelectGroup[]" value="69"
type="checkbox"></td>
<td><a
href="">second</a></td>
<td>Dispatch</td>
</tr>
</tbody>
***************************************
Bernd
Paatsch
_______________________________________________ Selenium-users mailing list Selenium-users@lists.public.thoughtworks.org http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users