enter image description hereIts name of tab. I have tried by Link-text but it's not working.

I have tried d.findElement(By.linkText("Clauses")).click(); It shows error

Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"link text","selector":"Clauses"}

enter image description here

  • 1
    //span[contains(text(), 'Clause')], can you try this XPath please, Is there a chance the element to be in iFrame. Jan 7, 2019 at 10:38
  • I think you need to consider the selector you are using. You have tried with class title which may be present in other parts of the DOM and so it may not work as expected. As suggested by others, try css or xpath selectors. You can try d.findElement(By.className("clauses")).click() to click on Clauses or d.findElement(By.className("myAssignedRequests")).click() to click on My Assigned Requests
    – Shamanth
    Jan 7, 2019 at 11:04
  • Thank you all for your help! It worked .It was iframe.
    – Pooja
    Jan 8, 2019 at 8:58

3 Answers 3


Whole web page is frame. So first I switched to frame & then performed actions

d.findElement(By.xpath("//[@id='tabviewMainContainerLexApp']/div/ul/li[11]/a/span")).click(); //click on tab using X-path

You can use byXpath to find element using xPath expressions. To get the link you should use the following:

//li[@class='uwa-tab clauses']/a[@href='#clauses']

To go further to get the span:

//li[@class='uwa-tab clauses']/a[@href='#clauses']/span[.='Clauses']

or a simplified one without the classes:


If you want to find the link (<a>..</a>) and you want to filter only by the title you could use:


This one locates the span by its text and then steps back to its parent by the /...

Also there are many more possibilities, this locator table cheat-sheat summarizes them quite well.


Why dont you simply select the anchor tag

  • Thank you all for your help! It worked .It was iframe
    – Pooja
    Jan 8, 2019 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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