0

I have a table with some rows and columns. I would like to select the drop down element where the name is "Mobile". The Name is in col1 and the drop down is in col3 Using XPATH I can find the Name "Mobile", I need to get to col3 so I can select the drop down element. I tried to use the axis "following" but this highlights all the drop down elements from col3. I am close, I just need to get the drop down which belongs to the Name Mobile.

This is my XPATH:

//table[@id="data_configuration_edit_mapping_tab_mappings_ct_mapping_body"]//td//div//span[text()="MOBILE"]//following::td//div//select

This is some of the 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>

Thanks, Riaz

1 Answer 1

1

Ah I think I have solved it. I have tried putting td[1] after the following axis. It has highlighted the 1 drop down element in the same row where Name is "Mobile"

//table[@id="data_configuration_edit_mapping_tab_mappings_ct_mapping_body"]//td//div//span[text()="MOBILE"]//following::td[1]//div//select
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.