"The way to check that is is actually visible is to check a JavaScript property ‘naturalWidth’ is greater than 0. b = Watir::Browser.new :firefox b.goto 'https://dl.dropbox.com/u/18859962/brokenimage.html' puts b.execute_script("return (typeof arguments[0].naturalWidth!=\"undefined\" && arguments[0].naturalWidth>0)", b.image(id: 'watermelon'))" _Reference for self for how to call javascript from watir. This shows you use execute_script_
#watir #webdriver #javascript #automation #tip #pub
Collect and share the web
Get started for free