How can I get Xpath Count in selenium webdriver <p>How can I get Xpath Count in Selenium WebDriver?</p> <p>This is my HTML page</p> <pre><code>&lt;tbody xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;tr class="odd"&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;Cash&lt;/td&gt; &lt;td&gt; &lt;input type="checkbox" id="p1" checked="checked" value="1" name="productAccess"/&gt; &lt;input type="hidden" value="1" name="__checkbox_productAccess"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="even"&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;Saving&lt;/td&gt; &lt;td&gt; &lt;input type="checkbox" id="p2" checked="checked" value="2" name="productAccess"/&gt; &lt;input type="hidden" value="2" name="__checkbox_productAccess"/&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I used </p> <pre><code>int product_count = driver.findElements(By.xpath("//id('product')/x:tbody/x:tr[1]")).size(); </code></pre> <p>But always I am getting wrong xpath, anybody can help me?</p>