Reputation: 1
How can I save all cookies in java's selenium webdriver to a txt file, then load them later? The documentation doesn't say much of anything about the addCookie function.
I've tried it in a multitude of ways and none seem to work at all.
I can get selenium to show me/save the cookies to a file its just loading them mainly that is the problem....
Thanks guys!
Upvotes: 0
Views: 1584
Reputation: 7062
I think the most important part is to fetch Cookies:
webDriver.manage().getCookies();
Return type is Set<Cookies>
. With this you can build your own logic for reading and writing to file.
Maybe you prefer some library for serialization. I really like Jackson.
Upvotes: 3