How to click on an image in selenium webdriver
<p>I've been trying to click on an image on web page.
Xpath for this image is:</p>

<pre><code>//*[@id='gridview-1018']/table/tbody/tr[3]/td[7]/div/a/img
</code></pre>

<p>HTML code is:</p>

<pre><code>&lt;td class=" x-grid-cell x-grid-cell-gridcolumn-1016 "&gt;`&lt;div class="x-grid-cell-inner " style="text-align: center; ;"&gt;`&lt;a href="http://demo.webshopondemand.com/Shop/AbzorbDevelopment/Store/" target="_blank"&gt;`&lt;img src="/admin/templates/images/house.png" style="background-color: transparent;"/&gt;`
</code></pre>

<p>Tried all the below methods here, but got the same error msg "Unable to locate the element:</p>

<ol>
<li><p><code>driver</code>.findElement(<code>By</code>.<code>xpath</code>(".//*[@id='gridview-1018']/table/<code>tbody</code>/tr[3]/td[7]/div/a/img")).click();</p></li>
<li><p>WebElement temp = driver.findElement(By.xpath("//img[contains(@src,'/admin/templates/images/house.png')]"));
temp.click();</p></li>
<li><p><code>WebDriverWait</code> wait = new <code>WebDriverWait</code>(driver, 60);
wait.until(<code>ExpectedConditions.visibilityOfElementLocated</code>(<code>By.cssSelector</code>("x-grid-cell-inner.a.img")));
<code>driver.findElement</code>(<code>By.cssSelector</code>("x-grid-cell-`inner.a.img")).click()</p></li>
</ol>

<p>4.<code>driver</code>.<code>findElement</code>(By.cssSelector`("a[href='AbzorbDevelopment']")).click();</p>

<p>Thanks for the help<img src="https://i.stack.imgur.com/5Qldq.jpg" alt="enter image description here"></p>