robotframework获取json返回值
时间: 2023-10-18 20:54:45 浏览: 88
在Robot Framework中获取JSON返回值可以使用GetFromDictionary关键字。该关键字来自于Collections库。你可以将返回的content转换为JSON格式,然后使用GetFromDictionary关键字来获取对应的value。具体的代码如下所示:
```
${value}= Get From Dictionary ${content} data.shardInfo.total
```
其中,`${content}`是你的返回的JSON串,`data.shardInfo.total`是你想要获取的key对应的value。`${value}`即为获取到的value值。\[1\]\[2\]
#### 引用[.reference_title]
- *1* [robotframework接口自动化常见问题四](https://blog.csdn.net/weixin_39425607/article/details/114129556)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [RobotFramework学习(7)——返回体JSON提取](https://blog.csdn.net/u011197146/article/details/100130786)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文