简体   繁体   中英

Error: Unable to move the cache: Access is denied, when using selenium (python)

I'm trying to use selenium (in Python) to scrape a website, however, when I start the chrome web driver, it tries to load the page for a few seconds, and then closes the window and returns the following error message:

[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.

I 'm using a custom profile when loading the page. My ChromeOptions look like:

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

PS

1) I don't have any Chrome processes running in the background. I'm using Firefox in the background though.

2) It worked for the first few times, It stopped working just now.

Seems like you are missing the guava dependency:

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>27.0.1-jre</version>
        </dependency>

Close all Chrome Tasks from Task Manager. Mainly including the name "Google" or "Google Crash handler / reporter". It will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM