我正在尝试使用 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/