Home > Enterprise >  I tried to use linkText locator to click button but it didn't work
I tried to use linkText locator to click button but it didn't work

Time:07-06

I tried to use linkText locator to click " Sınav Modülü" button but it didn't work, i also tried xpath but i guess it was work. Can you help?

<a  href="#">
    <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" ><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"></path><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"></path></svg> 
    Sınav Modülü
    </a>

driver.findElement(By.linkText(" Sınav Modülü")).click();
        

enter image description here

enter image description here

CodePudding user response:

Try using below xpath

driver.findElement(By.partialLinkText("Sınav Modülü")).click();

CodePudding user response:

Try:

//a[.="Sınav Modülü"]

CodePudding user response:

just try

   //*[@class='feather-feather-book-open']/..  //for parent to svg

  //*[@class='feather-feather-book-open']   // for svg element
  • Related