I have below HTML which is having a table with 15 rows (below are the 2 rows for example)-

<table id="task" style="width:100%" class="border">
<thead>
<tr>
<th>Task </th>
<th>Request date</th>
<th>Description</th>
<th>file</th>
<th>number</th>
<th>Request</th>
<th>Tel</th>
<th>Lan</th>
<th></th></tr></thead>
<tbody>
<tr class="odd">

<td>TASK21</td>
<td><label class="readonly">25/05/2018</label></td>
<td>file</td>
<td></td>
<td>
<a href="http://sqa.stackexchange.com/taskId=1&amp;action=dispatchFromOneTaskType">123</a></td>
<td>1</td>
<td>23654</td>
<td>En</td>
<td><form id="tasksForm" method="post" action="tasks.do?action=delete" class="formulaire"><input type="hidden" name="language" value=""><input type="hidden" name="taskId" value="1"><input type="submit" value="Close"></form></td></tr>
<tr class="even">

<td>TASK45</td>
<td><label class="readonly">25/05/2018</label></td>
<td>file</td>
<td>321654</td>
<td>
<a href="s.do?taskId=&amp;action=dispatchFromOneTaskType">753536</a></td>
<td>1</td>
<td>123456</td>
<td>En</td>
<td><form id="tasksForm" method="post" action="s.do?action=delete" class="formulaire"><input type="hidden" name="language" value=""><input type="hidden" name="taskId" value="2"><input type="submit" value="Close"></form></td></tr>
</tbody>
</table>

I want to search any row’s 1st column by giving TASK number (e.g- TASK42) and then traverse to last column (9th) of that row and then click on the Button.

To do so, I am using below -

//*[()=’TASK42′][@id=’tasksForm’]/input[3]

Since the desired TASK can be in any of the 15 rows of the table, I can’t give Relative/Absolute Xpath. Hence first for that TASK in any row and then traversing to last column of that row.

But it is not working. Can you please help?



Source link https://sqa.stackexchange.com/questions/35358/how-to-go-to-a-certain-xpath-by-searching-a-text-in--

LEAVE A REPLY

Please enter your comment!
Please enter your name here