python - 使用 selenium 时出现错误 : Unable to move the cache: Access is denied,(python)

标签 python selenium selenium-webdriver caching

我正在尝试使用 selenium(在 Python 中)来抓取网站,但是,当我启动 chrome 网络驱动程序时,它会尝试加载页面几秒钟,然后关闭窗口并返回以下错误留言:

[22424:18188:0531/121110.652:ERROR:cache_util_win.cc(21)] Unable to move the cache: Access is denied. (0x5)
[22424:18188:0531/121110.653:ERROR:cache_util.cc(139)] Unable to move cache folder C:\Users\user\AppData\Local\Google\Chrome\User Data\Profile 1\ShaderCache\GPUCache to C:\Users\user\AppData\Local\Google\Chrome\User Data\Profile 1\ShaderCache\old_GPUCache_000
[22424:18188:0531/121110.653:ERROR:disk_cache.cc(184)] Unable to create cache
[22424:18188:0531/121110.653:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2
Opening in existing browser session.

我在加载页面时使用自定义配置文件。我的 ChromeOptions 看起来像:

OPTIONS = webdriver.ChromeOptions()
OPTIONS.add_argument("--user-data-dir=C:/Users/user/AppData/Local/Google/Chrome/User Data/Profile 1")
driver = webdriver.Chrome(PATH, options=OPTIONS)

# rest of code

附言

1) 我没有在后台运行任何 Chrome 进程。不过,我在后台使用 Firefox。

2) 前几次有效,现在就停止了。

最佳答案

从任务管理器中关闭所有 Chrome 任务。主要包括名称“Google”或“Google Crash handler/reporter”。它会起作用

关于python - 使用 selenium 时出现错误 : Unable to move the cache: Access is denied,(python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62114053/

相关文章:

python - 如何解决 pandas 中多列的断言错误

python - 通过 Selenium Hub 获取 Chrome 时遇到问题

python - selenium.common.exceptions.WebDriverException : Message: 'Geckodriver' executable may have wrong permissions using GeckoDriver Firefox Selenium Python

Java - 尝试从电子邮件中提取网址

Python:对列表进行排序

python - 我不明白为什么这个 while 循环不能正常运行

python - 如何使用取模运算符在两个常量之间绑定(bind)一个数字?

python - 数据驱动的测试。使用 Selenium Python 从 .json 或 .yaml 文件读取参数

Python Scraping - 无法从 Flipkart 获取所需数据

python - Selenium iframe 数据问题 - python