无法创建着色器缓存条目-通过其CSS选择器定位元素时出错 [英] Failed to create shader cache entry- error while locating an element by its Css selector

查看:129
本文介绍了无法创建着色器缓存条目-通过其CSS选择器定位元素时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Python使用Selenium编写一个简单的脚本,以通过其CSS选择器检测元素.我正在访问Google页面,并通过其CSS选择器(输入[name = q]

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]

Chrome页面按计划打开,但是问题是它关闭时没有实际找到输入,并且在终端中引发了以下错误:ERROR:shader_disk_cache.cc(237)]无法创建着色器缓存条目:-2

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

我尝试在关闭Google Chrome时运行脚本,甚至尝试关闭任务管理器中的所有Chrome进程,但它仍然抱怨着色器缓存条目.

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.

我在这里应该做什么?

我的代码是:

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() 

推荐答案

您的代码几乎是完美的.您需要进行如下更改:

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

从以下位置编辑CSS_SELECTOR:

fLocator = "input[name=q]"

收件人:

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

更新:

查看错误,重新出现错误以及对链接讨论 >我觉得shader_disk_cache.ccshader_disk_cache.h某种程度上已损坏.我认为可以彻底卸载Google Chrome(使用Revo Uninstaller)并完成磁盘清理(使用CCleaner)&最后安装最新版的Google Chrome可能会使我们超越错误.

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.

这篇关于无法创建着色器缓存条目-通过其CSS选择器定位元素时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆