selenium清除chrome缓存
时间: 2023-04-22 11:06:00 浏览: 210
清理Chrome缓存数据
4星 · 用户满意度95%
可以使用以下代码清除Chrome浏览器缓存:
```python
from selenium import webdriver
# 创建Chrome浏览器实例
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--disable-infobars')
chrome_options.add_argument('--disable-popup-blocking')
chrome_options.add_argument('--start-maximized')
chrome_options.add_argument('--incognito')
chrome_options.add_argument('--disable-blink-features=AutomationControlled')
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--disable-plugins-discovery')
chrome_options.add_argument('--disable-extensions-file-access-check')
chrome_options.add_argument('--disable-web-security')
chrome_options.add_argument('--disable-extensions-http-throttling')
chrome_options.add_argument('--disable-extensions-suggestions-service')
chrome_options.add_argument('--disable-extensions-clipboard')
chrome_options.add_argument('--disable-extensions-signin-promo')
chrome_options.add_argument('--disable-extensions-remote-install')
chrome_options.add_argument('--disable-extensions-install-verification')
chrome_options.add_argument('--disable-extensions-downloads')
chrome_options.add_argument('--disable-extensions-geolocation-api')
chrome_options.add_argument('--disable-extensions-geolocation')
chrome_options.add_argument('--disable-extensions-background-fetches')
chrome_options.add_argument('--disable-extensions-background-networking')
chrome_options.add_argument('--disable-extensions-auto-update')
chrome_options.add_argument('--disable-extensions-file-access')
chrome_options.add_argument('--disable-extensions-file-detection')
chrome_options.add_argument('--disable-extensions-file-access-check')
chrome_options.add_argument('--disable-extensions-logging')
chrome_options.add_argument('--disable-extensions-logging-redirect')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-append')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-append')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stderr-to-file-overwrite-append-quiet-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout')
chrome_options.add_argument('--disable-extensions-logging-redirect-stdout-to-file-overwrite-append-quiet-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr-stdout-stderr')
chrome_options.add_argument('--
阅读全文