0
我有一個包含一些行和列的表。我想選擇名稱爲「Mobile」的下拉元素。名稱在col1中,下拉列表在col3中 使用XPATH我可以找到名稱「Mobile」,我需要到col3以便我可以選擇下拉元素。 我嘗試使用軸「跟隨」,但是這突出顯示了col3中的所有下拉元素。我很接近,我只需要獲得屬於姓名Mobile的下拉菜單。Selenium Python XPATH我想從第一列的第三列中選擇一個下拉列表,其中名稱位於第一列
這是我的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>
感謝, 里亞茲