SimpleBrowserDotNet / SimpleBrowser

A flexible and intuitive web browser engine designed for automation tasks. Built on .NET Standard 2.1.
Other
362 stars 105 forks source link

How to clear cache, clear history? #243

Closed toolgood closed 4 years ago

toolgood commented 4 years ago

How to clear cache, clear history? How to set the maximum history length?

kevingy commented 4 years ago

@toolgood Those are some good questions!

How to clear cache,

SimpleBrowser doesn't cache anything. It keeps a navigation history that stores some navigation data, but it's far from a true cache. In browsers that cache data, most of the time, the cache is used to prevent downloading of dependencies - css, javascript, images, etc. Since SimpleBrowser doesn't download any dependencies of the target page, there's no need to have a true cache and clear that cache.

clear history?

What do you mean by "history"? SimpleBrowser will store the navigation state of previous navigations in an attempt to be able to "Go Back", but it's not a history in the sense of being able to look at the browsing sessions from last Tuesday, for example. If you're wanting to clear the previous navigations, the only way to do that currently is to close the browser tab (window). Each browser tab/window maintains its own history.

How to set the maximum history length?

This is currently hard coded at 20 and can not be changed. That said, regardless of the number of navigations performed, there is a data storage mechanism in SimpleBrowser that will grow infinitely, regardless of the maximum history length. There is an open issue related to this. See #206. (I personally believe that #206 is also related to #121 and #108.)

If you're seeing that the memory usage of the browser continually grows over time, see my suggestion to change the way SimpleBrowser is used in your code in #206.

I hope that helps.

toolgood commented 4 years ago

Browser navigate more url , xelement keeps increasing and will not decrease

kevingy commented 4 years ago

Can you be more specific? Are you talking about the _allActiveElements collection increasing and will not decrease?

kevingy commented 4 years ago

@toolgood I haven't heard from you in a while. Are you still having issues? If so, can you help me find what you're experiencing? Thanks!

kevingy commented 4 years ago

No response to ping. I am going to assume either the issue has been resolved or is covered by another issue. I'm closing this issue. It can be re-opened, if needed.