I\'m creating a suite of Selenium tests for an web album application. I would like to test whether an image is actually displayed (it contains valid image data). Is such thi
Use this one liner function:
Boolean isImageLoaded = (Boolean) ((JavascriptExecutor)driver).executeScript("return arguments[0].complete && typeof arguments[0].naturalWidth != \"undefined\" && arguments[0].naturalWidth > 0", imageWebElement);
where:
imageWebElement = WebElement to locate image on page
isImageLoaded = Result in boolean (return true if image is present, false if its not)