Xpath query to select a row where column 1 and column 3 contain specific data


I needed to select a row from a table where the row contained specific data in two different columns of the same row. Here is the table of data I needed to select the row from:


For example, I needed to know what row number (the selenium command I was using was storeElementIndex) contained OrgID=6 AND Fac_no=0072. In the actual script, because I was iterating through a list and getting my variables from the page before this page, I simply parameterized the OrgID and Fac_No values. The Xpath expression I used was:

    <td>//tr[(td[1] = '${tempOrgId}') and (td[3] = '${tempFacNo}')]</td>

This expression demonstrates how to include/join multiple contains statements with an "and" condition.