关于CSS:Selenium XPath以访问表中的各个列链接

selenium xpath to access various columns links in table

我正在尝试为表中的各个列链接创建selenium xpath。每行都是唯一标识的。在每一行中,我知道一列的名称(产品名称),并且基于产品名称,我试图在表中查找其他链接以对该产品执行其他操作,例如更改开始日期和结束日期以及删除产品等。

有人可以帮忙为表中的每一列创建xpath吗?表名称显示如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
tooltip nameofprodduct percentage startdate enddate checkbox1 checkbox2 remove

<tr id="225259">

<td><img alt="info" src="media/tooltip.gif" class="tooltip"></td>

<td>name(299106)</td>

<td><span onclick="showBoostSlider(225259,0,0,0,0);" class="increse">0%</span></td>

<td nowrap="nowrap" class="start"><span class="nonEdit"><span class="pointer">none</span><span class="icon-date"></span></span><span style="display: none;" class="edit"><input type="text" value="" style="width: 80px; margin-right: 7px;" class="inlineCalendarDisplay"><input type="hidden" value="" class="inlineCalendar"><span class="icon-cancel"></span><span class="icon-disk"></span></span><span class="tablesorterHiddenSortData"></span></td>

<td nowrap="nowrap" class="end"><span class="nonEdit"><span class="pointer">none</span><span class="icon-date"></span></span><span style="display: none;" class="edit"><input type="text" value="" style="width: 80px; margin-right: 7px;" class="inlineCalendarDisplay"><input type="hidden" value="" class="inlineCalendar"><span class="icon-cancel"></span><span class="icon-disk"></span></span><span class="tablesorterHiddenSortData"></span></td>

<td><input type="checkbox" onchange="switchEnabled('PEnabled',this,'225259');" checked="checked"></td>

<td><input type="checkbox" onchange="switchEnabled('SEnabled',this,'225259');" checked="checked"></td>

<td> table.jsonTable').rGrid('remove',225259); return false;" href="#">remove</td>

</tr>

可能正在寻找该XPath,该XPath返回具有给定名称的所有表的所有行的所有链接:

1
"//table/tr/td[.='name(299106)']/..//a"

要访问特定行的列,可以使用:

1
"//table/tr[id='225259']/td"