Fluffy
Fluffy

Reputation: 28392

How to access Firefox cache from webdriver?

I'm able to access pages like about:cache-entry?client=HTTP&sb=1&key=(some URL) directly in Firefox, but when it renders the page, it certainly gets the data from some storage. How can I access the latter from Python Firefox Webdriver?

Upvotes: 4

Views: 2725

Answers (1)

fviktor
fviktor

Reputation: 2958

The page returned by such an about:cache-entry?... URL contains a line like this one:

file on disk: /home/fviktor/.mozilla/firefox/7jx6k3hx.default/Cache/CF7379D8d01

It is the full pathname of the cache file if any. I think you'll be able to read that file from Python as usual, but I haven't tested it yet. The pathname can also be none in the case of small files cached only in memory. You can get the file contents by parsing the hex dump on the returned page in this case.

Upvotes: 2

Related Questions