How to save and load all cookies using Java + Selenium WebDriver

Viewed 208

How can I save all cookies (from all domains, not just the current domain) in Java's Selenium WebDriver to a .txt file, and then load all of them when I restore Selenium session?

driver.manage().getCookies() only returns cookies from the current domain and addCookie() only adds one cookie at a time.

This question addresses Python while this question only addresses Ruby.

How can I achieve this in Java?

Thanks!

0 Answers
Related