robotframework常见报错记录

1.'Response' object has no attribute '__getitem__':'Response'对象没有属性' getitem__'

response对象的属性
r.status_code                HTTP请求的返回状态
r.text                      HTTP响应内容的字符串形式,即:url对应的页面内容
r.encoding                    从HTTP header中猜测的响应内容编码方式
r.apparent_encoding    从内容中分析出的响应内容编码方式(备选编码方式)
r.content                            HTTP响应内容的二进制形式

简单来说就是不能直接使用response对象,而是需要使用response对象的属性,经常使用的属性有r.content和r.text

猜你喜欢

转载自www.cnblogs.com/jasmine0112/p/12191140.html