Add a way to get hashes of screenshots

For some use cases it is only necessary to compare screenshots for 
(in)equality. One clear example is reftests, where you take screenshots 
of two pages and consider the test to have passed if the screenshots 
compare equal. In this case it is a great deal of overhead to have to 
work with the full screenshot data all the time; it is significantly 
more convenient to work with hashes of the screenshot. Therefore it 
would be very useful to just get these hashes back from webdriver.

The simplest API would either be a parameter to getScreenshot or a new 
method to return the hash. An API better specialised for reftests would 
provide the option to also return the screenshot data if the screenshot 
matched — or failed to match — one of a set of provided hashes, so that 
one could do something like (total pseudo-code):

navigate(reference)
ref_hash = getScreenshot({"hash":"only"})
navigate(test)
test_screenshot, test_hash = getScreenshot({"hash":"if-not-match",
                                             "hashes":[refhash]})

That isn't a specific API proposal, since I can't decide what the best 
API would look like here. But I think it gives a flavour of the kind of 
capabilities I would find useful.

Received on Wednesday, 21 August 2013 10:36:23 UTC