The id() function must but the first thing in the expression for it to work properly.
Also, I'm not exactly sure what the spec says about the namespace specifiers - when I tried it in my Firefox 24 (with Firebug + Firepath), it didn't accept those and it worked well without them.
id('product')/tbody/tr[1]
That said, your XPath is still wrong and doesn't match both the checkboxes. It matches the first tr element. In order to match the checkboxes, try
id('product')/tbody//input[@type='checkbox']
or find by CSS selector (which is shorter and faster):
#product > tbody input[type='checkbox']
All that said, if you simply want to loop over the checkboxes, you don't have to count them in the first place: (Java example)
List<WebElement> checkboxes = driver.findElements(By.cssSelector("#product > tbody input[type='checkbox']"));
for (WebElement checkbox : checkboxes) {
// do your stuff with them
}
EDIT to adress OP's comments below
"...I want text from the table..."
No problem.
id('product')//td[following::td[1]/input[@type='checkbox']]
This is an XPath expression that matches only the <td> elements with the text you want to get. Literally, it matches "all <td> nodes that are descendants of #product and that are immediatelly followed by a <td> with a checkbox".
Now, you can simply loop over the found elements and invoke getText() on them.
If you'll continue using WebDriver, you'll soon find out that you definitely need to learn CSS selectors and/or XPath expressions (which are stronger).
There is a ton of tutorials out there, I'm sure you'll be able to find some. So I'll just point you to the specs which are, I think, the most useful resource: