This is my HTML page and I have some problem with my automation code and it is not able to locate the element and this is the XPath I used:


HTML Code:

<div class="col s4">

  <div data-radium="true">

    <div class="waves-effect waves-dark btn-large " data-radium="true" style="color: white; text-transform: capitalize; box-shadow: none; padding: 0px 2rem; border-radius: 5px; height: 50px; line-height: 50px; width: auto; cursor: pointer; background: rgb(0, 208, 156);">

      <div>I'm Done</div>

closed as unclear what you're asking by Niels van Reijmersdal, Bharat Mane, c32hedge, Kevin McKenzie, NarendraC May 8 at 10:49

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • With the given HTML the locator should work. May be it appears after some actions - so you may need to access it after those actions. – Dakshinamurthy Karra Oct 1 '18 at 7:32
  • 2
    Add exception you received after running your code. – Bharat Mane Oct 1 '18 at 7:38
  • 1
    Make sure your desired element is not located inside an IFRAME – Bill Hileman Oct 1 '18 at 19:35
  • Voting to close unclear what you are asking. No response to what was your exception, did you look for an iFrame. – Niels van Reijmersdal May 2 at 8:32

Sometimes elements are not accessible directly. So, in test automation services we try including the parent div to locate that element. As per the given HTML, you can use below-mentioned locator that might help to resolve the issue.

XPath: @FindBy(xpath="//div[@class='waves-effect waves-dark btn-large']//div[contains(text(),'Done')]")

Further, please check whether the element is present inside an iFrame. If yes, please switch to the desired iframe first before using XPath

If you still face any issue provide more HTML so that we can assist you with a better solution.


Sometimes the text() function not work, So try using ( . ) instead of text()


And In case there are multiple elements founded surround your xpath by index


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