FastRunner变量包含$导致报错httprunner.exceptions.VariableNotFound解决

问题描述

在FastRunner使用时,想通过debugtalk.py驱动代码来实现登录获取cookie,但是发现在使用在线运行时一切正常,能够正常的获取到cookie,但是一运行用例就报错,报错如下:
httprunner.exceptions.VariableNotFound

问题原因

发现获取的cookie中包含了$符号,后面的内容被处理被httprunner框架给处理成了一个变量,返回的cookie如下:
在这里插入图片描述

解决办法

查找后发现按该贴中的使用两个$符号还是不行
https://github.com/httprunner/httprunner/issues/657

最后手动替换$符号,换成encodeURIComponent格式
在这里插入图片描述

session_id=session_id.replace("$","%24")

修改后cookie如下,问题解决
在这里插入图片描述

发布了5 篇原创文章 · 获赞 2 · 访问量 2657

猜你喜欢

转载自blog.csdn.net/jerurry/article/details/104053278