开发者

How to save and restore all cookies with Selenium RC?

开发者 https://www.devze.com 2023-01-07 09:44 出处:网络
I\'m running complex tests that开发者_如何学运维 create many cookies for different sections of my web site.

I'm running complex tests that开发者_如何学运维 create many cookies for different sections of my web site.

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.

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?


Yes, sure. Look at getCookie, getCookieByName and createCookie methods.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消