FAQ: Why can’t I click on the hyperlink which contains an image?

I have the following construct in my html page.

<a href="http://bing.com"><img src="bing.jpg"/></a>


I am unable click on this hyperlink. Why?


In this case, the hyperlink does not have a clickable point. The image completely covers the hyperlink. You can click on the image though. In most applications, we find that click on the image is correct expected behavior.

Comments (6)

  1. cheater says:

    Hi Mathew,

    I have an application in which menu is composed from HtmlHyperlink items. How can I check if an HtmlHyperlink item is visible? Because it may be hidden. Here is an example:





    If the user clicks on Submenu1, the Submenu2 item exists, but it’s hidden.


  2. You can use the TryGetClickablePoint() method to verify if a control is clickable. We decided against using the term "Visible" since there was a lot of controversy around its definition.

  3. cheater says:

    I’ve tried this, but I got an error:

    Test method TestManager.LogIn.CodedUITestMethod1 threw exception:

    Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform ‘GetClickablePoint’ on the hidden control.

  4. Did you use TryGetClickablePoint(). THis method catches the exception and returns true or false.

    If you use GetClickablePoint, the above exception will occur as expected.

  5. cheater says:

    I’ve used a method:

    public bool linkExists(HtmlHyperlink link)


               Point p;



                   p = link.GetClickablePoint();


               catch (FailedToPerformActionOnHiddenControlException e)


                   return false;


               return true;


    But isn’t there a direct way to check this? This works only with walk arround?

  6. The direct way is to use link.TryGetClickablePoint().

    public bool linkExists(HtmlHyperlink link)


              Point p;

              return link.TryGetClickablePoint(out p);