Search code examples
javaseleniumfindhrefelement

i m trying to find element href by selenium in java


Native code for what i want to make automation.This is the a href tag

<a href="http://www.itpathsolutions.cu.ma/juniorApp/admin/user">
                <i class="fa fa-user"></i> <span>User Management</span>
                <small class="label pull-right bg-red">10</small>
              </a> here

Solution

  • XPATH

    //a[contains(@href, 'itpathsolutions')]
    

    OR

    //span[text()='User Management']/../a