When using Fitnesse, Slim and the Browser Testing framework I was given the challenge to count the amount of items within an ordered list (simplified):
<a>
<b>1</b>
<b>2</b>
<b>3</b>
</a>
I found that one of the counting methods:
|check |number of items |xpath=//b |in |xpath=//a |3 |
does not work since it would only test for the number of times text appears upon a webpage, not the element. Thus I was pointed to the counting function of xpath but that returns the list of items instead of the total amount of occurrences, as seen below:
|check |value of |xpath=//ol[count(li)=3] |[<b>1</b>
<b>2</b>
<b>3</b>] expected: [3] |
As such, how would I be able to get an integer of the count of occurrences of a certain element?