robotframework接口上传图片
1 [Arguments] ${filePath}=${OTHER_FILE_PATH} 2 ... ${fileName}=${PHOTO_FILE_NAME} 3 ... ${fileType}=${JPG_TYPE} 4 ... ${docLib}=${1} 5 Create Session api ${ARTICLES_URL} 6 ${fileContent} Evaluate ('${fileName}.${fileType}',open('${filePath}/${fileName}.${fileType}','rb'),'image/${fileType}') 7 ${fileDict} = Create Dictionary file=${fileContent} 8 ${bodyData} = Create Dictionary docLib=${docLib} 9 ${resp} = Post Request api e5/images/upload files=${fileDict} data=${bodyData} 10 #Log ${resp} 11 Should Be Equal As Strings ${resp.status_code} 200 12 #Log ${resp.content} 13 #Log ${resp.json()} 14 ${responsedata} to json ${resp.content} 15 #Log ${responsedata} 16 ${data} Get From Dictionary ${responsedata} data 17 ${PIC_PATH} Get From Dictionary ${data} path 18 # Log ${PIC_PATH} 19 Set Suite Variable ${PIC_PATH}
卡卡,你好吗