RPA.Images.Get Pixel Color In Image 关键字出错

问题描述 投票:0回答:1

我正在尝试使用 RPA.Images.Get Pixel Color In Image 关键字

我收到错误: [内部失败] TypeError: Point.init() 缺少 1 个必需的位置参数:'y'

当我使用这个机器人框架代码时:

${Color1}=    RPA.Images.Get Pixel Color In Image  ${OUTPUT DIR}${/}selenium-element-screenshot-1.png  0

我收到错误: [内部失败] AttributeError:“str”对象没有属性“getpixel”

当我使用此代码时:

${Color1}=    RPA.Images.Get Pixel Color In Image  ${OUTPUT DIR}${/}selenium-element-screenshot-1.png  0, 0

截图1 截图2 我期待得到 RGB 值

image robotframework
1个回答
0
投票

检查 rpaframeawork 包中的代码后,点应以字符串形式提供,不带任何空格,如下所示:

${Color1}=    RPA.Images.Get Pixel Color In Image  ${OUTPUT DIR}${/}selenium-element-screenshot-1.png  0,0

as

get_pixel_color_in_image()
调用
to_point()
,看起来像这样;

def to_point(obj: Any) -> Optional["Point"]:
    """Convert `obj` to instance of Point."""
    if obj is None or isinstance(obj, Point):
        return obj
    if isinstance(obj, str):
        obj = obj.split(",")
    return Point(*(int(i) for i in obj))

例如。使用

x,y
语法,其中 x 和 y 是实际数字 并且 之间没有空格。

© www.soinside.com 2019 - 2024. All rights reserved.