如何保存和恢复所有Cookie与Selenium RC?

编程入门 行业动态 更新时间:2024-10-27 15:28:44
本文介绍了如何保存和恢复所有Cookie与Selenium RC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在运行复杂的测试,为我的网站的不同部分创建许多Cookie。

I'm running complex tests that create many cookies for different sections of my web site.

有时我必须在中间重新启动浏览器一个长时间的测试,因为Selenium服务器不会修改基本的Firefox配置文件,所以cookie会消失。

Occasionally I have to restart the browser in the middle a long test and since the Selenium server doesn't modify the base Firefox profile, the cookies evaporate.

有什么方法可以将所有的cookie保存到Python变量,然后再终止浏览器并在启动新的浏览器实例后恢复它们?

Is there any way I can save all of the cookies to a Python variable before terminating the browser and restore them after starting a new browser instance?

推荐答案

我认为你应该创建一个浏览器配置文件,并为该配置文件启动服务器。所以你的所有cookies在每次执行保存/修改。我已经gievn这些细节作为另一个问题的答案。请参考。它是为java客户端和Firefox提供的,但我相信你可以根据你的要求实现它。

I think you should crate a browser profile and start server for that profile. So all your cookies get saved/modified during every execution. I've gievn these details as answer for another question . Please refer it.. It is given for java client and firefox but I'm sure you can implement it as per your requirements.

更多推荐

如何保存和恢复所有Cookie与Selenium RC?

本文发布于:2023-10-26 11:37:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530027.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Cookie   Selenium   RC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!