无法在Windows环境中将带Imagemagick的图像与机器人框架进行比较 [英] Failed to compare images with Imagemagick with robot framework on Windows environment

查看:281
本文介绍了无法在Windows环境中将带Imagemagick的图像与机器人框架进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Imagemagick来比较Windows环境中的两个屏幕截图。





或者,使用以下新命令:

  magick输入.png ... output.png 

而不是:

  convert input.png ... output.png 

所以,如果您知道如何将配置变量 IMAGE_COMPARATOR_COMMAND 更改为 C:\\程序文件\\ ImageMagick -7.0.7-Q16 \\magick ,你可以不用重新进行拖延ImageMagick。


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)

解决方案

If you want to use the "legacy" convert command with ImageMagick v7, you need to click the option during installation of ImageMagick that says "Install legacy tools".

Or, use the new command which is:

magick input.png ... output.png

rather than:

convert input.png ... output.png

So, if you know how to change your configuration variable IMAGE_COMPARATOR_COMMAND to C:\\"Program File"\\ImageMagick-7.0.7-Q16\\magick, you can do it without re-installing ImageMagick.

这篇关于无法在Windows环境中将带Imagemagick的图像与机器人框架进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆