网页加载的某些资源会被存放在Chrome的缓存中,如果能够人工指定Python Selenium + Chromedriver的缓存路径,就可以更容易找到缓存的文件。
在启动Chromedriver时,指定参数:
import os
from selenium import webdriver
os.makedirs('cache', exist_ok=True)
options = webdriver.ChromeOptions()
options.add_argument('--disk-cache-dir=./cache')
driver = webdriver.Chrome('./chromedriver', options=options)
这样启动的Chrome就会把缓存放在当前目录下的 cache
文件夹中了。
然而,缓存的文件,文件名都是类似于`f_000009`这种奇怪的名字,并且都没有后缀名。如果从这里找到对应类型的文件呢?明天说。