Count the number of elements are matching with for the given xpath expression
Try this code:
//Assume driver is intialized properly.
int iCount = 0;
iCount = driver.findElements(By.xpath("Xpath Value")).size());
The iCount
has the number of elements having the same xpath
value.