title: How do I find an image generated by Dragonfly with Cucumber/Capybara?
body: <p>In the comments to the solution for <a href="https://stackoverflow.com/questions/4812606/how-do-i-find-an-image-on-a-page-with-cucumber-capybara-in-rails-3">How do I find an image on a page with Cucumber/Capybara</a>, somebody asked:</p>
  
  <blockquote>
    <p>I can't seem to figure how to get this
    to work with URLs generated by
    Dragonfly. They look like this:
    /media/BAh_some_long_string_AwIw/12_11_52_810_5x5.jpg?s=7e360000, where 5x5.jpg is my file name. I've
    tried something like:
    //img[@src="/media/<em>/</em>#{image}?s=*"]
    but it doesn't work. Got any tips? – <a href="https://stackoverflow.com/users/61018/ramon-tayag">Ramon Tayag</a> Feb 25 at 4:18</p>
  </blockquote>
  
  <p>I have a similar problem, only worse - in my case, the generated image paths don't even include a (jpg|png|gif) file name, they only have these really long ids:</p>
  
  <pre><code>&lt;img src="/media/BAhbB1sHOgZmSSIdNGQ4MTEyOGU3ZjViZmQwZTQ4MDAwMDAyBjoGRVRbCDoGcDoKdGh1bWJJIg0yMDB4MjAwIwY7BlQ" /&gt;
  </code></pre>
  
  <p>(Using dragonfly with mongo/gridfs)</p>
  
  <p>These paths get rendered alright, but I can't figure out how to find them in a Cucumber/Capybara step :P</p>
  
  <p>Any ideas? I looked at the <a href="https://github.com/markevans/dragonfly/tree/master/features" rel="nofollow noreferrer">Dragonfly's features</a>, but they only test the rendering of the image itself, without detecting it's existence within an html page.</p>