MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

Where does browser meta data like caches, cookies and so on get persisted? #50

Open PatrickHuetter opened 8 years ago

PatrickHuetter commented 8 years ago

Does some data (browser history, caches, cookies, etc.) get persisted? If yes, where and is it possible to persist in-memory, so that the data gets flushed after an instance restart? Maybe it's also possible to define a special data directory and delete this directory afterwards?

Thank you very much for your work! I already tested and worked with many headless browser solutions (also build some by myself) and until now jBrowser seems to be very good.

hollingsworthd commented 8 years ago

History and cookies reside mostly in memory. You can access cookies from memory with JBrowserDriver.manage().getCookies()

If you enable caching, Settings.builder().cache(true) then you can get the cache dir by JBrowserDriver.cacheDir() or specify it yourself with Settings.builder().cacheDir(File). Use the latter if you want to persist it because the former is deleted when the instance is disposed.

There are also options to saveMedia and saveAttachments on the builder which have temp directories JBrowserDriver.attachmentsDir and JBrowserDriver.mediaDir

Agreed it would be nice to have browser history and cookies on disk. Thanks for the feedback!

PatrickHuetter commented 8 years ago

@hollingsworthd i would treat it as optional setting. The default setting should be in memory. I asked because i want it in memory so that each restart of a jBrowser instance is a clean one. With other webdrivers i've to implement cleanup tasks because they persist in default filesystem paths and do not clear by themself after stopping or restarting. So the current jBrowser in memory implementation is like i need it.