Reputation: 51
<div data-v-1dac319c="" class="ca-modal-header">
<span data-v-1dac319c="" class="ca-modal-header-title">New Claim Attachment</span>
<button data-v-1dac319c="" class="ca-modal-close material-icons">close </button>
</div>
I am unable to select the Close button using XPath. Following is not working - //span[text()='New Claim Attachment']/following-sibling::button[text()='close']
Upvotes: 0
Views: 105
Reputation: 33361
You can use this XPath:
//span[text()='New Claim Attachment']/..//button[contains(text(),'close')]
Or this:
//div[.//span[text()='New Claim Attachment']]//button[contains,text()'close')]
Upvotes: 1
Reputation: 10666
Your XPath expression doesn't work because you have a small space at the end of your close
. contains
should work:
//span[text()='New Claim Attachment']/following-sibling::button[contains(., 'close')]
Upvotes: 1