0

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> 
6
  • What do you mean by matches string...clearly describe... and also share what have you tried?? Commented Jun 20, 2016 at 13:09
  • Looking for web elements [ex: a[data-action='edit-criteria']] in a table row and if getText() matches '22323' then click on element a[data-action='remove-criteria'] but the problem i'm facing now is click on element a[remove-criteria] based on given string Commented Jun 20, 2016 at 13:20
  • do you mean 22323 matches to a[data-action='remove-criteria'] elements's data-value attribute??? Commented Jun 20, 2016 at 13:23
  • is this xPath valid for you //a[@data-action = 'remove-criteria' and @data-value = '22323'] to get that link which matches provided data-value Commented Jun 20, 2016 at 13:29
  • yes it's valid one.. Commented Jun 20, 2016 at 13:32

1 Answer 1

1

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..:)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.