我有一个包含一些行和列的表。我想选择名称为" Mobile"的下拉元素。名称位于col1中,下拉列表位于col3中 使用XPATH我可以找到Name" Mobile",我需要到col3所以我可以选择下拉元素。 我尝试使用轴"跟随"但这突出了col3的所有下拉元素。我很接近,我只需要获得属于Name Mobile的下拉菜单。
这是我的XPATH:
//table[@id="data_configuration_edit_mapping_tab_mappings_ct_mapping_body"]//td//div//span[text()="MOBILE"]//following::td//div//select
这是一些HTML:
<table id="data_configuration_edit_mapping_tab_mappings_ct_mapping_body" cellspacing="0" style="table-layout: fixed; width: 100%;">
<colgroup>
<tbody>
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="0">
<tr class="GJPPK2LBEH GJPPK2LBGH" __gwt_subrow="0" __gwt_row="1">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-307" style="outline-style:none;">
<input type="radio" name="rbCrossRow36"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-308" style="outline-style:none;">
<span title="PHONE" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">PHONE</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-309" style="outline-style:none;">
<select tabindex="-1">
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
<div __gwt_cell="cell-gwt-uid-310" style="outline-style:none;">
<input id="data_configuration_edit_mapping_tab_details_cb_phone" type="checkbox"/>
</div>
</td>
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="11">
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-307" style="outline-style:none;">
<input type="radio" name="rbCrossRow36"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-308" style="outline-style:none;">
<span title="MOBILE" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">MOBILE</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-309" style="outline-style:none;">
<select tabindex="-1">
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="12">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-307" style="outline-style:none;">
<input type="radio" name="rbCrossRow36"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-308" style="outline-style:none;">
<span title="DOB" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DOB</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="13">
</tbody>
</table>
谢谢, 里亚兹
答案 0 :(得分:1)
啊我想我已经解决了。我试过把td [1]放在跟随轴之后。它突出显示名称为“Mobile”
的同一行中的1个下拉元素//table[@id="data_configuration_edit_mapping_tab_mappings_ct_mapping_body"]//td//div//span[text()="MOBILE"]//following::td[1]//div//select