How to detect if an element exists in Watir

Posted by Rijksband on Stack Overflow See other posts from Stack Overflow or by Rijksband
Published on 2011-03-18T22:42:43Z Indexed on 2011/03/19 0:09 UTC
Read the original article Hit count: 96

Filed under:
|

Hi,

I'm relatively new to Watir but can find no good documentation (examples) regarding how to check if an element exists. There are the API specs, of course, but these make precious little sense to me if I don't find an example.

I've tried both combinations but nothing seems to work... if browser.image (:src "/media/images/icons/reviewertools/editreview.jpg").exists then... if browser.image (:src "/media/images/icons/reviewertools/editreview.jpg").exists? then...

If anyone has a concrete suggestion as per how to implement this, please help! Thanks!

© Stack Overflow or respective owner

Related posts about ruby

Related posts about watir