Failed to create shader cache entry- error while l

2019-01-29 06:48发布

I am writing a simple script in Python using Selenium to detect an element by its Css selector. I am accessing the Google page, and am targeting the input, by its CSS selector, which is input[name=q]

The Chrome page opens as planned, but the issue is that it closes without actually finding the input, and throws the following error in the terminal: ERROR:shader_disk_cache.cc(237)] Failed to create shader cache entry: -2

I tried running the script when Google Chrome is closed, and even went as far as to close all the Chrome processes in Task Manager, and it still complains about the shader cache entry.

What should I do here?

My code is:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome(executable_path=r'C:\Python27\chromedriver.exe')
driver.get("http://www.google.com")
fLocator = "input[name=q]"
try:
    searchField = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, fLocator)))
finally:
    driver.quit() 

Error that I'm getting in the PyCharm's terminal

3条回答
贪生不怕死
2楼-- · 2019-01-29 06:54

I ran the script (your code) and no errors came.

Possibly the problem is of chrome driver, please make sure 32/64 bit version is not causing this issue. Also, please see the following link, it may help: "Unable to move the cache" error in selenium webdriver

查看更多
We Are One
3楼-- · 2019-01-29 07:00

Correct Locator are

Using xpath: //*[@id='gs_htif0']

fLocator = "input[name='q']"

查看更多
来,给爷笑一个
4楼-- · 2019-01-29 07:09

Your code is near perfect. You need to make a small change as follows:

Edit the CSS_SELECTOR from:

fLocator = "input[name=q]"

To:

fLocator = "input[name='q']"

Update:

Looking at the error, resurfacing of the error and some research over these few links and discussions I feel the shader_disk_cache.cc or shader_disk_cache.h somehow got corrupted. I think a clean uninstall of Google Chrome (using Revo Uninstaller) and complete disk cleanup (using CCleaner) & finally installation of the latest Google Chrome may get us beyond the error.

查看更多
登录 后发表回答