
[英]How to get a required parameter from JSON response RobotFramework
[英]How to get HTML response body in RobotFramework
我无法从 Get 请求中获得响应正文。 这是我在 Postman 上运行时得到的结果:
但是当我 go 到 Robotframework 并发送Get On Session
请求时,我无法获得此类信息。 这是我从response
object 中得到的:
这是请求调用代码:
${response} GET On Session API_${SUITE_NAME} myURL json=${PARAMS} headers=${HEADERS} expected_status=${desired_status_code}
和回报:
${response.status_code} = 200
${response.headers} = {'Date': 'Thu, 02 Feb 2023 19:14:02 GMT', 'Content-Type': 'application/json', 'Content-Length': '0', 'Connection': 'close', 'access-control-allow-origin': '*', 'vary': 'Origin'}
content: ""
cookies: <RequestsCookieJar[]>
text: ""
OK: true
history: []
url: The URL I used on this cal: Create Session API_${SUITE_NAME} ${URL_API} verify=true
这是针对 response.json()
${response.json()} = [FAIL (+0.01s)] Resolving variable '${response.json()}' failed: JSONDecodeError: Expecting value: line 1 column 1 (char 0)
你能告诉我如何获得这个 HTML 以便我可以与之互动吗?
对我有用的是Get on Session
使用Get
而不是 Get
所以我的要求是这样的:
${response} Get url=theURL params=theParams
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.