在机器人框架中记录 HTML 请求
问题描述
我一直在努力寻找与此相关的大量信息,所以我转向这里寻求帮助.
I have been struggling to find much information to go along with this so I have turned here for help.
我正在使用机器人框架运行 Web 应用程序的 UI 测试.当测试失败时,我想要一个 HTML 请求的日志,这样我就可以回顾一下失败的原因,即未加载的内容、500 个错误等.
I am running UI tests of a web app using robot framework. When a test fails I want a log of the HTML requests so I can look back and see what failed, i.e. things not loading, 500 errors etc.
到目前为止,我还没有设法在机器人框架或 selenium 中找到一些东西?
To this point I haven't managed to find something within the robot framework or selenium?
另一种选择是查看是否有用于记录此类事情的 python 库,或者创建一个是否是一项合理的任务?
Another option is to see if there is a python library for logging this sort of thing or whether it would be a reasonable task to create one?
我也研究过使用 autoit,它使用浏览器的内部网络日志工具,但使用这些工具本身就是一个完整的测试,我不确定它的效果如何.我确定我一定不是第一个想要这个功能的人吗?
I have also looked into using autoit it use the browsers internal network logging tools but using these is a whole test of its own and I am not sure how well it would work. I am sure I must not be the first person to want this functionality?
我一直在研究这个问题,发现一个可行的选择可能是使用 pcapy 的数据包嗅探器,我不知道在网络编程中该做什么以及如何处理数据包以仅获取帖子并获取数据包和响应,任何帮助将不胜感激
I have continued to look into this and have found a viable option may be a packet sniffer using pcapy, I have no idea what to do in network programming and how I would proccess packets to only get post and get packets and repsonses, any help would be much appreciated
干杯
解决方案
Selenium 只是模拟用户行为,所以在这里对您没有帮助.您可以使用记录所有流量并让您检查流量的代理.BrowserMob 代理 让你这样做.有关如何为你的浏览器.
Selenium is only emulating user behaviour, so it does not help you here. You could use a proxy that logs all the traffic and lets you examine the traffic. BrowserMob Proxy let's you do that. See Create Webdriver from Selenium2Libray on how to configure proxy for your browser.
这样,您可以在发现测试失败后要求您的代理返回流量.
This way you can ask your proxy to return the traffic after you noticed a failure in you test.
相关文章