Proxy 基于代理的机器人框架
我有个电话:Proxy 基于代理的机器人框架,proxy,robotframework,Proxy,Robotframework,我有个电话: curl -k -i -X GET -H "Cache-Control: no-cache" --proxy1.0 "localhost:7070" "https://www.google.com" 我正在尝试使用Robot框架进行调用,以便使用相同的元素对其进行测试。到目前为止,我得到的是: ***Settings*** Library Collections Library RequestsLibrary ***Variables***
curl -k -i -X GET -H "Cache-Control: no-cache" --proxy1.0 "localhost:7070" "https://www.google.com"
我正在尝试使用Robot框架进行调用,以便使用相同的元素对其进行测试。到目前为止,我得到的是:
***Settings***
Library Collections
Library RequestsLibrary
***Variables***
${url} http://www.google.com
${proxy} localhost:7070
${headers}= Create Dictionary Cache-Control no-cache
***Test Cases***
Get Requests
Create Session google ${url} ${headers} ${proxy}
${resp}= Get Request google /
Should Be Equal As Strings ${resp.status_code} 200
我仍然得到一个错误:
ValueError: need more than 1 value to unpack
知道哪里出了问题吗?问题在于:
***Variables***
...
${headers}= Create Dictionary Cache-Control no-cache
不能在变量表中调用诸如create dictionary
之类的关键字。上面的代码将${headers}
设置为字符串“创建字典缓存控制无缓存”
从robot framework的2.9版开始,直接支持使用符号而不是美元符号作为变量的字典。您可以使用=
语法指定值。例如:
*** Variables ***
&{headers} Cache-Control=no-cache
我相信这解释了你在追求什么。