现在,我需要编写一个脚本,内容类似于以下内容:
${result} set variable {}
create session url http://xxx
${resp} get request url /
should be equal as strings ${resp.status_code} 200
Dictionary Should Contain Value ${resp.jsonp(${result})} Success
log ${resp.jsonp(${result})}但是网址是用jSonp脚本写的。那么robotframework如何与jSonp和jSon脚本一起使用呢?它的错误如下:
Invalid variable name `${resp.jsonp({})}`.全部都是:enter image description here
jsonp来自url用jsonp脚本编写的url.And。我需要使用RobotFramework获取url接口script.may,因为我的脚本是错误的。
发布于 2015-10-20 17:18:56
jsonp是从哪里来的?我认为您希望使用${resp.content},因为您已从请求库发送了GET请求
发布于 2015-10-20 21:41:38
根据您提供的代码,我假设您使用的是Robotframework-Requests库。
返回的响应对象没有.jsonp()方法。它确实有一个.json()方法,该方法不接受任何参数并返回一个字典:
Dictionary Should Contain Value ${resp.json()} Success如果要执行多个检查,也可以将其保存到变量中:
${json}= set variable ${resp.json()}
Dictionary Should Contain Value ${json} Successhttps://stackoverflow.com/questions/33231775
复制相似问题