How to click an image in sfBrowser (symfony lime testing)

This is probably a really simple point, but it actually took me a few searches and tries to find the answer – but it’s quite simple really, just use the image’s alt tag attribute.

If you are using the symfony image_tag helper and not specifying your own alt attribute, then it will be the image name minus the extension, for example – if your template contains this link:


then in your Functional test, use:


4 Comments so far

  1. zegenie on April 14th, 2008

    …what happens if you have an image called fred.png, and an image called fred.jpg?

  2. Russ on April 14th, 2008

    Very good question! I guess as a developer for accessibility reasons you should manually give them both different “alt” tags in the template, however it will be interesting to see what Symfony decides to “click” if there are two images with the same “alt” attribute.

    Maybe I’ll check it out some time and let you know!

  3. Klemens on September 1st, 2008

    Hi Russ,

    Have you found out anything about how “click()” can distinguish between ambiguous links?


    By the way: good site of yours. I’m a passionate climber myself, so it’s good to see there are some php-people climbing as well 🙂

    One last question: what module are you using for php-code syntax-highlighting in your blog posts?

    🙂 Klemens

  4. Russ on September 2nd, 2008


    I guess the solution really is just to make sure you always use unique alt tags. If you happen to have two identical image links on the same page, then it won’t hurt if the alt tags are the same since the test browser will hit the first one, and the intended result should be ok either way.

    It’s definitely nice to know that “geeks” can (and often are) into more than just sitting in front of a computer 🙂

    I’m using the WP syntax plugin: which seems to do the job nicely.

Leave a reply