Ranjith's Ranjith's - 5 months ago 8
Java Question

How to click on the web element?

I've a situation, where i need to click on element a[data-action='remove-criteria'] when a[data-action="edit-criteria"] matches string..

Any help, much appreciated!!

I've included code for this..

<table class="table table-striped">
<thead>
<tbody>
<tr scope="row">
<td>Own publishers</td>
<td class="input-lg">
<div class="label label-primary">Contained in list</div>
<a class="btn btn-default" data-value="22323" data-operator="list" data-attribute="pubs" data-section="supply_filter" data-action="edit-criteria" href="#">22323</a>
<a class="text-danger" data-value="22323" data-operator="list" data-attribute="pubs" data-section="supply_filter" data-action="remove-criteria" href="#"/>
<span>,</span>
<a class="btn btn-default" data-value="223232323" data-operator="list" data-attribute="pubs" data-section="supply_filter" **data-action="edit-criteria"** href="#">223232323</a>
<a class="text-danger" data-value="223232323" data-operator="list" data-attribute="pubs" data-section="supply_filter" **data-action="remove-criteria"** href="#">
</td>
</tr>
</tbody>
</table>

Answer

Use below xPath to get that link which matches provided data-value

//a[@data-action = 'remove-criteria' and @data-value = '22323']

Hope it will help you..:)