I'm unable to write xpath for button new booking for below HTML :

<div class="mcf-button-extend -action-wrapper mcf-userfunctions">
   <a class="mcf-t1 mcf-button mcf-button-action" > new booking </a >

I have tried

driver.webelement("div [@class='mcf-button-extend -action-wrapper mcf-userfunctions"] /a [contains@class='mcf-t1']").Click().
  • What is your html code? It is not possible to advise anything unless we know the dom you're searching against.
    – Alexey R.
    Nov 16, 2017 at 9:29

1 Answer 1


You should go through some basics tutorials to create an xpath.

For your element try below simple xpath :

//a[@class='mcf-t1 mcf-button mcf-button-action']

And if you want to find this based on some text in your xpath then

 //a[text()='new booking']


 //a[contains(text(),'new booking')]

And Its a link in your case then simply try usinglinktext selector

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