views:

33

answers:

4

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 thing possible?

Thanks for help.

A: 

I'm not quite sure what you're asking. Do you want to check that the image links return 200 status codes? Or that the linked data is a valid image? Or that the browser actually displays the page?

The first two are straightforward and can be done without Selenium in many cases by using an HTTP library in your favorite language (if you need to interact with the page, Selenium is likely still your better bet). If the latter, that's going to be an incredibly difficult problem to solve.

nirvdrum
A: 

You can certainly check that the image appears in the page source e.g. by using a XPath parameter.

You can assume that because it is in the page source, it will be displayed but I don't know of any way to actually validate this.

nzpcmad
There are situation, when the gallery page is generated okay, but the image itself is invalid - for example due to exception in the image script.
CommanderZ