未找到名称为“${body}= Create Dictionary"的关键字 [英] No keyword with name '${body}= Create Dictionary' found

查看:34
本文介绍了未找到名称为“${body}= Create Dictionary"的关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

*** settings ***

Library  RequestsLibrary
Library  Collections
Library  OperatingSystem
Library  SeleniumLibrary

*** Variables ***

${username}     XXXXXX

${password}     YYYYYY

${locale}       ZZZZ


*** test cases ***

TC1

            ${body}= Create Dictionary  username=       ${username}  password=      ${password}
            ${header}= Create Dictionary   Accept=application/json, text/plain, */*    Content-Type=application/json, Accept-Language=${locale},   
            Create Session OA2  ${base_url}
            ${response}= post request   OA2 /oauth/v2/token   data=     ${body}    headers=     ${header}
            log to console  ${response.status_code}
            log to console  ${response.content}

推荐答案

您必须遵循 空格分隔格式.

在以下代码行(和其他代码行)中,您似乎只在变量和关键字之间使用了 1 个空格${body}= Create Dictionary.
这就是机器人无法正确解析代码并引发错误的原因.展开该代码以使用至少 2 个空格分隔.
你应该试试这样的代码.
${body}= 创建字典 use​​rname=${username} password=${password}

In following code line (and others) you seem to only use 1 space between variable and keyword ${body}= Create Dictionary.
That's why robot can not parse the code correctly and the error is raised.
Expand that code to use at least 2 space separation.
You should try the code like this.
${body}= Create Dictionary username=${username} password=${password}

当然也相应地修改其余的代码.

And of course revise rest of the code accordingly.

我还建议您阅读用户指南.
它包含很多有用的信息.

I also recommend you study the user guide.
It contains a lot of useful information.

这篇关于未找到名称为“${body}= Create Dictionary"的关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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