I am creating some selenium test in ruby to check my web page.
Is there any way to check background-image is loaded or not using selenium webdriver or javascript.
there is css for background image
.banner {
background-image:url('http://dev.nestaway.in/assets/banner_slide1.jpg')
... //some other attributes
}
And html looks like this
<div class = 'banner' style='width:100px; height:75px'>
<h1>this is main heading</h1>
<p>this is some paragraph</p>
</div>
I know that I can check for 'img' but this doesn't work when images are in css background. For IMG tag images I can check
ele = document.getElementById('image_id');
return ele.complete && ele.naturalWidth > 0 && ele.naturalWidth != 'undefined'
Please Suggest some solution.
Thanks in advance.