0

enter image description here

i need to identify the relative xpath for the 2nd button highlighted in the image

Can someone help me

//*contains(@class,'fa fa-clock-o')

I used this. It identifies the first button again.

1
  • 1
    Do you have website link ? – PDHide May 8 at 19:58
1
<div class="input group">
  <input id="end_time"></input>
  <span class="input-group-btn">
    <button class="btn btn-default">
      <i class="fa fa-clock"></i>
    </button>
  <span>
</div>

You would want to use the following selector for the button (not the icon in the button, because the button has the click/event handler):

//input[@id='end_time']/following-sibling::span/button

Which reads something like: "//" starting anywhere on the page, find an "input" whose "id" is "end_time", then get the "following-sibling" element that is a "span", and then finally the "button" under that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.