T3rm1
T3rm1

Reputation: 2532

Compare two images for equality (cross domain)

I'm looking for a way to check whether a specific image has been loaded on a webpage with Selenium IDE.

My first try was to generate a hash value of the image but this doesn't seem to be possible with javascript. I then found out that you can base64 encode an image if you load it into a canvas and then call toDataUrl(). However this doesn't work if the image is located on another domain.

My image server provides a standard "image not found"-image. I want to check if a specific image was successfully loaded by comparing the loaded image against the failure image. Do you have any ideas how this can be achieved?

Upvotes: 1

Views: 526

Answers (1)

user1425908
user1425908

Reputation: 36

Have you looked at 'selenium signature' as a plug in to the ide? https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-signature/

It will make a crc32 signature of the element like *html=50D5FBD3*css=5BBF6784*img=81AD9F9D* You'll only need the *img=81AD9F9D* portion to validate an image.

Upvotes: 2

Related Questions