XPath: Using Child
XPath Child:
As the name suggests, the child axis is used to locate all child elements of the current node. A common use case for this approach is when you want to iterate through all the rows in a table by selecting each row as a child of the table element.
In the examples below, the first XPath expression selects all input fields (such as organization, name, email, password, and phone number) that are children of the specified div element. The second example selects only the first child input field (the organization field).
This selects all input elements that are children of the div with the class "col-sm-12 google-sign-form."
Example 1: XPath= //div[@class='col-sm-12 google-sign-form']/child::input
This selects the first input element (the organization field) that is a child of the same div element.
Example 2: XPath= //div[@class='col-sm-12 google-sign-form']/child::input[1]