簡體   English   中英

RobotFramework中如何獲取HTML響應體

[英]How to get HTML response body in RobotFramework

我無法從 Get 請求中獲得響應正文。 這是我在 Postman 上運行時得到的結果:

作為 HTML 的 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM