blueprintmrk / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 0 forks source link

Compare a screenshot with an existing image #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system : Win 7
.Net Framework version :
Office Version : 2010
SeleniumWrapper version : 1.0.18

What is your issue ?
I need to compare a screenshot that I take during runtime with an existing 
image in an excel sheet or anywhere in my system. Is this possible without 
using a third party tool such as ImageMagick ?

Original issue reported on code.google.com by rohan.ka...@gmail.com on 30 Jul 2014 at 11:24

GoogleCodeExporter commented 9 years ago
Sure:

Set driver = CreateObject("SeleniumWrapper.WebDriver")
driver.start "firefox", "http://www.google.co.uk" 'Starts firefox
driver.open "/" 'Opens the root url
driver.getScreenshot().compareTo("c:\image.png").saveAs "c:\diff.png" 'Compares 
the page with a local image and saves the result
driver.stop 'Stops the browser

Original comment by florentbr on 30 Jul 2014 at 6:34

GoogleCodeExporter commented 9 years ago

Original comment by florentbr on 8 Sep 2014 at 5:40