如何保存和恢复所有Cookie与Selenium RC? [英] How to save and restore all cookies with Selenium RC?

查看:321
本文介绍了如何保存和恢复所有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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆