You can use the following XPath: Position
The position() function in XPath allows you to select elements based on their position within a list of sibling elements. This function is particularly useful when you need to target elements that appear in a specific order or range.
For example, you can use position() to select the first three list items in an unordered list or to select all items after the second one.
Example 1: XPath= //ul/li[position()<=3]
Example 1: XPath= //ul/li[position()>2]