Reputation: 7957
using capybara how can i click the following image button
<tbody>
<tr>
<tr>
<th width="91" background="/b.gif" height="37">
<a href="javascript:GURL('/wlap.htm?rc=&rf=4000')">
<img border="0" src="/hw4.gif">
</a>
</th>
</tr>
<tr>
<tr>
<tr>
</tbody>
Upvotes: 2
Views: 1089
Reputation: 46836
The "image button" is really just a link that contains an image. You can click it like any other link. Here are a couple of options for clicking it.
You could use the click_link
method based on the href attribute:
click_link('', :href => %q{javascript:GURL('/wlap.htm?rc=&rf=4000')})
You could find the image, say by part of its src attribute, and then click it:
find(:css, 'img[src*="hw4.gif"]').click
Or you could find the link, say by part of its href attribute, and then click it:
find(:css, 'a[href*="wlap.htm"]').click
Upvotes: 4