У меня есть таблица HTML с некоторыми строками и столбцами. Я хотел бы, чтобы выбрать флажок где есть текст «Name» в колонке 2 и текст «CRM» в колонке 4Selenium XPATH как выбрать флажок из таблицы, где имя находится в столбце 2 и имя в столбце 4
Образец HTML является:
<table id="data_configuration_mappings_ct_fields_body" cellspacing="0" style="table-layout: fixed; width: 100%;">
<colgroup>
<tbody>
<tr class="GJPPK2LBFG GJPPK2LBMG GJPPK2LBPG" __gwt_subrow="0" __gwt_row="0">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-388" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBOG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-389" style="outline-style:none;" tabindex="0">
<span class="linkhover" title="Name"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-390" style="outline-style:none;">
<span class="" title="Name"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-391" style="outline-style:none;">
<span class="" title="crm"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">crm</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-392" style="outline-style:none;">
<span class="" title="Main"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Main</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-393" style="outline-style:none;">
<span class="" title="TITLE + FNAME + SNAME + GENDER"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">TITLE + FNAME + SNAME + GENDER</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-394" style="outline-style:none;">
<span class="" title="CRM"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-395" style="outline-style:none;">
<span class="" title="DM"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH GJPPK2LBNG GJPPK2LBAH">
<div __gwt_cell="cell-gwt-uid-396" style="outline-style:none;">
<span class="" title=""
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="1">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="2">
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="3">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="4">
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="5">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="6">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-388" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-389" style="outline-style:none;">
<span class="linkhover" title="Name"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-390" style="outline-style:none;">
<span class="" title="Name"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-391" style="outline-style:none;">
<span class="" title="crm2"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">crm2</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-392" style="outline-style:none;">
<span class="" title="Main"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Main</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-393" style="outline-style:none;">
<span class="" title="TITLE + FNAME + SNAME"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">TITLE + FNAME + SNAME</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-394" style="outline-style:none;">
<span class="" title="CRM"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-395" style="outline-style:none;">
<span class="" title="DM"
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="7">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="8">
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="9">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="10">
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="11">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="12">
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="13">
</tbody>
Чтобы начать с я могу получить столбец 2 выделенный в Xpath проверки в Firefox со следующим Xpath:
//table[@id="data_configuration_mappings_ct_fields_body"]//tr//td[2]
Я не знаю, как поступить и получить текстовое имя из колонки 2 и текст из колонки CRM 4
я могу получить текстовое имя из столбца 1, используя следующий XPath. Как включить текст crm из столбца 4?
//table[@id="data_configuration_mappings_ct_fields_body"]//tr//td[2]//span[text()="Name"]
Мне нужна помощь.
Спасибо, Riaz
Я хотел бы также включить текст «CRM», так что я могу GE t в правой строке, так как в таблице есть другие строки с текстом Имя –
Это работает для меня, спасибо за вашу помощь –
@pArAs Интересно, где вы это сделали, вы получили свое вдохновение ... –