Count the number of elements matching a node in the xpath
Have you ever encountered a situation where you just need to count the type of elements on a page:
For instance:
For instance:
- Number Of columns in a table
- The way the frames are designed
- The page objects that appear on a page
XPATH is so powerful when it comes to automation that it eliminates so much of code by just using some simple xpath expressions. One of them is this:
int iCount = driver.findElements(By.xpath("Xpath Value")).size());
Can that be simpler than that!
Comments
Post a Comment