Selenium XPATH I am looking for an input field in a HTML table which has a specific text value

I have a HTML table with some rows of input fields. Each input field has a value. The input field I am looking for is any input field which contains the text "filter" The actual text is "filter2" or it could be "filter3" Can i use the contains keyword in the Xpath to find "filter" for the @value attribute?

The XPATH i have constructed is:

//table[@id="reporting_add_report_tab_manual_ct_match_filters"]/tbody//tr//td//input[@value="filter2"]

I would like to find the input field where it has filter in the value attribute, exclude the number 2

The HTML snippet is:

<table id="reporting_add_report_tab_manual_ct_match_filters" class="GJPPK2LBAV border" cellspacing="0"
       __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true">
    <thead aria-hidden="false">
    <colgroup>
    <tbody style="">
    <tr class="GJPPK2LBCD GJPPK2LBMD" __gwt_subrow="0" __gwt_row="0">
        <td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBED">
            <div __gwt_cell="cell-gwt-uid-684" style="outline-style:none;">
                <input type="checkbox" tabindex="-1"/>
            </div>
        </td>
        <td class="GJPPK2LBBD GJPPK2LBDD">
            <div __gwt_cell="cell-gwt-uid-685" style="outline-style:none;">
<span>
<input type="text" tabindex="-1" value="rule1"/>
</span>
<span>
            </div>
        </td>
        <td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBOD">
    </tr>
    <tr class="GJPPK2LBCE" __gwt_subrow="0" __gwt_row="1">
        <td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBED">
            <div __gwt_cell="cell-gwt-uid-684" style="outline-style:none;">
                <input type="checkbox" tabindex="-1"/>
            </div>
        </td>
        <td class="GJPPK2LBBD GJPPK2LBDE">
            <div __gwt_cell="cell-gwt-uid-685" style="outline-style:none;">
<span>
<input type="text" tabindex="-1" value="filter2"/>
</span>
<span>
<div style="color:red;font-style:italic;"/>
</span>
            </div>
        </td>
        <td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBOD">
    </tr>
    </tbody>
    <tbody style="display: none;">
    <tfoot style="display: none;" aria-hidden="true"/>
</table>

Thanks, Riaz

Answers


//table[@id="reporting_add_report_tab_manual_ct_match_filters"]/tbody/tr/td//input[@value!="filter2"][contains(@value,"filter")]

Need Your Help

associations direction and notation in uml class diagram

uml class-diagram

Seasoned with ER schemas I'm having a doubt with associations from passing to UML Class Diagram.

Javascript hiding banner slider

javascript css3

How can i hide a image slider using javascript? i want show this banner in first loading and want to hide this banner with a button or "a" tag. if a visitor dont want to see the banner again they can