How to click a link that has an SVG child using Selenium and Java?

I am trying to click a button on a website using Selenium + Java, but am having no luck clicking this one particular button (I am able to click and type in other fields but this one in particular is giving me trouble).

This is what the HTML looks like and here is the image that I need to click:

<div class="sc-dIUggk XavQL">
   <a href="" target="_top" name="tempo-reports-menu-item" class="sc-fbNXWD eXJbNH">
      <div class="sc-GTWni jPMpTI">
         <svg width="48" height="48" viewBox="0 0 48 48">
            <g transform="translate(13 13)" fill="none" fill-rule="evenodd">
               <rect stroke="#004976" stroke-width="1.5" fill-opacity="0.64" fill="#00D8F6" fill-rule="nonzero" x="0.75" y="0.75" width="20.5" height="20.5" rx="2"></rect>
               <rect fill="#004976" x="14" y="5" width="2" height="13" rx="0.5"></rect>
               <rect fill="#004976" x="10" y="12" width="2" height="6" rx="0.5"></rect>
               <rect fill="#004976" x="6" y="9" width="2" height="9" rx="0.5"></rect>


This is the xpath I used to try to click "//a[@name,'tempo-reports-menu-item']", and its used like this driverexec.clickByXpath("Click Reports", "//a[@name,'tempo-reports-menu-item']");

ClickByXpath() is just my backend code for clicking by xpath.

No matter what I do, either the element can’t be found or can’t be clicked.

EDIT-> I have also tried this xpath:

        driverexec.clickByXpath("Click Reports", "//*[name()='svg']//*[name()='rect']/ancestor::a[@name='tempo-reports-menu-item']");

If I search this xpath in the DOM, it is found but still cannot be clicked.

This is the error message:

Expected condition failed: waiting for element to be clickable: By.xpath: //*[name()='svg']//*[name()='rect']/ancestor::a[@name='tempo-reports-menu-item']

This is my function ‘clickByXpath()`:

    public boolean clickByXpath(String description, String xpath) throws Exception {
        int retry = 0;
        while (retry <= maxAttempts) {
            try {
                // System.out.println("clicked " + description);
                System.out.println("clicked " + description);
                return true;
            } catch (Exception e) {
//              System.out.println("retrying click by xpath for row " + row + " with xpath " + xpath);
                if (retry > maxAttempts) {
                    System.out.println("now not retrying");
                    String message = "Could not click [" + description + "] with xpath " + xpath;
                    System.out.println("failed to click with error: " + e.getMessage());
                    return false;
        return false;


I figured it out. I had to switch to the iFrame that contained the link I needed to click.

// Have to switch to the iFrame that contains the entire <body> first
        driverexec.clickByXpath("Reports", "//*[@id='tempo-sidebar']//a[@name='tempo-reports-menu-item']");