Xpath Function Using following
Xpaths Following :-
This XPath axes helps to locate element following the current node. In the below-mentioned examples, the first one will select the input following the organization element, whereas in the second example, it will select all elements following the organization element having input tag. These are useful when we intent to locate element in a table or when we do not have any whereabouts of the following element from the current node.
Example 1: Xpath=//input[@name='organization_name']//following::input[1]
Example 2: Xpath= //input[@name='organization_name']//following::input
Xpaths following sibling :-
This is one concept that people tend to get confused with. All you get to clear yourself with this concept, is siblings. In case of following all nodes under the current node are the targeted ones irrespective they are under(children) the context node or not but follows below the context node. In case of following siblings, all following nodes of the context node, that shares the same parent, are applicable. In this case all siblings are referred to as children of the parent node. So if you are referencing one of the children and wish to navigate to other children of the same parent that follows it, following sibling does the business.
Example 1: Xpath= //li[@class='sign-in']//following-sibling::li