【问题标题】:Python Selenium - Clearing chrome cachePython Selenium - 清除 chrome 缓存
【发布时间】:2020-09-30 08:08:01
【问题描述】:

我正在尝试使用 selenium 从 chrome 驱动程序中清除缓存。

下面的代码运行了一天,现在由于某种原因停止运行。它重定向到 ClearBrowserData url,但它没有按 Enter 键来运行 Clear Data 按钮。 难道我做错了什么?我将不胜感激。

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

chromedriver = 'path'
browser = webdriver.Chrome(executable_path = chromedriver)
browser.get('chrome://settings/clearBrowserData')
browser.find_element_by_xpath('//settings-ui').send_keys(Keys.ENTER)

【问题讨论】:

标签: python selenium headless-browser clear-cache


【解决方案1】:

因为 shadowRoot

<settings-clear-browsing-data-dialog>
 #shadow-root (open)
</settings-clear-browsing-data-dialog>

【讨论】:

  • 这并不能以一种有用的方式回答问题吗(显示更新的 selenium/python 代码以实现推荐)
猜你喜欢
  • 2018-09-11
  • 2018-03-13
  • 2018-10-31
  • 2019-11-07
  • 2017-05-19
  • 2022-01-10
  • 1970-01-01
  • 2015-01-21
  • 1970-01-01
相关资源
最近更新 更多