简体   繁体   中英

How to compare two images by pixel using selenium C#

I have two screenshots. One is expected , another one is actual . I was looking for a good way to compare those screenshots using C# for my automated selenium tests. I found a few decisions to do that in java but C# doesn't provide a lot. I'd appreciate any help

You can use ImageMagick a 3rd party application. It supports command line calls to do image comparison. The following link discusses how to use the command line call: http://techblog.hotwire.com/2016/05/19/image-comparison-in-automated-testing/

You can also use the nuget package for ImageMagick. This would allow you to embed C# calls to the nuget library in your .NET application. The following stack overflow answer discusses it: https://stackoverflow.com/a/14235661/2683997

Both of these links assumes that you have been able to do the image capture part already.

You can do this by sikuli with selenium web driver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM