title: Clicking on Image Link with Selenium webdriver java
body: <p>I have looked at the answers to similar questions and it seems like the code that I have should work but I get "Cannot click on element" error when the code invokes click on the web element. </p>
  
  <p>Following is html markup segment</p>
  
  <pre><code>&lt;div class="x-tree-node-item"&gt;
    &lt;a title="Manage Users" class="sidenavmenu_unselected" id="m-22" onclick="toggleMenu('22', '');" href="#"&gt;
      &lt;img title="" align="bottom" id="mi-22" alt="" src="ca/images/arrow.png" border="0"&gt;Manage Users
    &lt;/a&gt;
    &lt;div style="margin-left: 1em;"&gt;
      &lt;ul class="submenu-show" id="mp-22" style="height: auto; display: none;"&gt;
        &lt;li&gt;
          ...
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Java code to locate the link is:</p>
  
  <pre><code>By xpath=By.xpath("//a[contains(@title,'Manage Users')]/img");
  WebElement manageUsers = (new WebDriverWait(driver, 10))
    .until(ExpectedConditions.presenceOfElementLocated(xpath));
  manageUsers.click();
  </code></pre>
  
  <p>It finds the element but I get error:
  org.openqa.selenium.ElementNotInteractableException: Cannot click on element</p>
  
  <p>The ids are generated dynamically so we can't find by id and image source is used by multiple links. 
  Thank you for your help.</p>
  
  <p><strong>* Update *</strong>
  The problem was solved with help from JeffC and Xwris. JeffC's last comment showed that there are multiple nodes being found. So, I added following code:</p>
  
  <pre><code>       List&lt;WebElement&gt; manageUserImages=driver.findElements(xpath);
     for (WebElement manageUserImage:manageUserImages) {
         if (manageUserImage.isDisplayed()) {
             manageUserImage.click();   
         }
     }
  </code></pre>
  
  <p>Since there is only element displayed at one time with "Manage Users" as title, this finds the correct elements and delivers the desired results. </p>
  
  <p>@JeffC, if you can post an answer with your comment, we can mark that answer as the correct answer. 
  Thanks again to everyone who helped. </p>