I am using Imagemagick to compare two screenshots in windows environment.
https://blog.codecentric.de/en/2017/09/robot-framework-compare-images-screenshots/
*** Settings ***
Library String
Library OperatingSystem
*** Variables ***
${IMAGE_COMPARATOR_COMMAND} C:\\"Program Files"\\ImageMagick-7.0.7-Q16\\convert.exe
*** Test Cases ***
Image Comparison Ok
Compare Images C:/Users/user/imagecompare/Test/src/reference-screenshots/reference-1.png C:/Users/user/imagecompare/Test/src/test-screenshots/test-1.png 0.1
Image Comparison NOk
Compare Images C:/Users/user/imagecompare/Test/src/reference-screenshots/reference-1.png C:/Users/user/imagecompare/Test/src/test-screenshots/test-1.png 0.1
*** Keywords ***
Compare Images
[Arguments] ${Reference_Image_Path} ${Test_Image_Path} ${Allowed_Threshold}
${TEMP}= Replace String ${IMAGE_COMPARATOR_COMMAND} __REFERENCE__ ${Reference_Image_Path}
${COMMAND}= Replace String ${TEMP} __TEST__ ${Test_Image_Path}
Log Executing: ${COMMAND}
${RC} ${OUTPUT}= Run And Return Rc And Output ${COMMAND}
Log Return Code: ${RC}
Log Return Output: ${OUTPUT}
${RESULT} Evaluate ${OUTPUT} < ${Allowed_Threshold}
Should be True ${RESULT}
But getting the following issue:
KEYWORD BuiltIn . Log Return Output: ${OUTPUT}
Documentation:
Logs the given message with the given level.
Start / End / Elapsed: 20171016 15:45:38.561 / 20171016 15:45:38.562 / 00:00:00.001
15:45:38.561 INFO Return Output: The system cannot find the path specified.
00:00:00.003KEYWORD ${RESULT} = BuiltIn . Evaluate ${OUTPUT} < ${Allowed_Threshold}
Documentation:
Evaluates the given expression in Python and returns the results.
Start / End / Elapsed: 20171016 15:45:38.562 / 20171016 15:45:38.565 / 00:00:00.003
15:45:38.563 FAIL Evaluating expression 'The system cannot find the path specified. < 0.1' failed: SyntaxError: invalid syntax (<string>, line 1)