EGL 驱动程序消息 (错误) eglQueryDeviceAttribEXT: 错误属性



当chrome浏览器吃午饭时,我们会收到下面的错误,以及下面使用chrome和Selenium,python的问题的任何观点:

DevTools listening on ws://127.0.0.1:12306/devtools/browser/14f00afd-581d-4a48-9141-8ab74c3355cf
[1005/210449.408:ERROR:gl_surface_egl.cc(612)] EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute.
[1005/210503.773:ERROR:context_group.cc(151)] ContextResult::kFatalFailure: WebGL2 blacklisted
[1005/210508.959:ERROR:shared_image_manager.cc(120)] SharedImageManager::ProduceGLTexture: Trying to produce a representation from a non-existent mailbox. FB:DB:4B:EB:07:94:DB:D6:D
A:B3:D4:47:9D:AC:5B:83
[1005/210508.960:ERROR:gles2_cmd_decoder.cc(18508)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoCreateAndTexStorage2DSharedImageINTERNAL: invalid mailbox name
[1005/210508.960:ERROR:gles2_cmd_decoder.cc(18529)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
[1005/210508.961:ERROR:gles2_cmd_decoder.cc(10742)] [.DisplayCompositor]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incomp
atible texture filtering (maybe)?
[1005/210508.962:ERROR:gles2_cmd_decoder.cc(18552)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image
[1005/210509.027:ERROR:gles2_cmd_decoder.cc(18529)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
[1005/210509.028:ERROR:gles2_cmd_decoder.cc(10742)] [.DisplayCompositor]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incomp
atible texture filtering (maybe)?
[1005/210509.028:ERROR:gles2_cmd_decoder.cc(18552)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image
[1005/210509.673:ERROR:gles2_cmd_decoder.cc(18529)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
[1005/210509.674:ERROR:gles2_cmd_decoder.cc(10742)] [.DisplayCompositor]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incomp
atible texture filtering (maybe)?
[1005/210509.674:ERROR:gles2_cmd_decoder.cc(18552)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image
10/05/2019 09:05:16 PM ama-cloude webtext:alexa what time is it in hong kong , It's 6:50am.

代码试用:

import platform , logging
import os,re
from time import  sleep
import selenium.webdriver.support.ui as ui
import selenium.webdriver.support.expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
class Cloud(object):
"""
Amazon cloud class to get query and response for alexa
"""
def __init__(self, username='xxxxxxxx', password='xxxx'):
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO)
self.logger = logging.getLogger(__name__)
self.url = "https://www.amazon.com"
self.username = username
self.password = password
self.timeout = 100
self.driver = None
self.get_chrome_driver()
def get_chrome_driver(self):
"""
get chrome driver
"""
if platform.system().lower() == 'windows':
if self.driver is None:
chrome_options = Options()
#chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--start-maximized')
chrome_options.add_argument('--disable-popup-blocking')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--allow-insecure-localhost')
chrome_options.add_argument('--disable-infobars')
chrome_options.add_argument("--log-level=3")
chrome_driver_path = os.path.join(str(os.environ['PYTHONPATH'].split(';')[0]),"bin","chromedriver","chromedriver.exe")
self.driver = WebDriver(executable_path=chrome_driver_path, chrome_options=chrome_options)
return self.driver
def login(self, username='xxxxxxxxx', password='xxxxx'):
"""
Login into amazon cloud
"""
self.logger.info("logging in amazon cloud username: %s and password: %s" %(self.username, re.sub(r".", "*", self.password)))
self.driver.get(self.url)
# wait for login username textbox
self.wait_visibility_element(By.XPATH, "//div[@id='nav-signin-tooltip']//span[@class='nav-action-inner'][contains(text(),'Sign in')]")
self.driver.find_element_by_xpath("  //div[@id='nav-signin-tooltip']//span[@class='nav-action-inner'][contains(text(),'Sign in')]").click()
self.wait_visibility_element(By.XPATH,"//label[@class='a-form-label']")
self.wait_visibility_element(By.XPATH,"//input[@id='ap_email']")
username_textbox = self.driver.find_element_by_xpath("//input[@id='ap_email']")
username_textbox.clear()
username_textbox.send_keys(self.username)  
self.driver.find_element_by_xpath("//input[@id='continue']").click() 
self.wait_visibility_element(By.XPATH,"//input[@id='ap_password']")  #//label[@class='a-form-label']
password_textbox = self.driver.find_element_by_xpath("//input[@id='ap_password']")
password_textbox.clear()
password_textbox.send_keys(self.password)
# click on submit button
self.driver.find_element_by_xpath("//input[@id='signInSubmit']").click()

def wait_visibility_element(self, by_type, element_name):
"""
wait for visibility of element
:param by_type: Locate element using type of element
:param element_name: element name
"""
ui.WebDriverWait(self.driver, self.timeout).until(
EC.visibility_of_element_located((by_type, element_name)))

此错误消息...

ERROR:gl_surface_egl.cc(668)] EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute.

。在 gl_surface_egl.cc 中定义如下:

static void EGLAPIENTRY LogEGLDebugMessage(EGLenum error,
const char* command,
EGLint message_type,
EGLLabelKHR thread_label,
EGLLabelKHR object_label,
const char* message) {
std::string formatted_message = std::string("EGL Driver message (") +
GetDebugMessageTypeString(message_type) +
") " + command + ": " + message;

深入探讨

根据 Chromium 命令行开关列表中的文档,参数--use-gl选择应使用 GPU 进程的 GL 实现,可用选项包括:

桌面
  • :用户安装的任何桌面OpenGL(Linux 和 Mac 默认(。
  • egl:无论用户安装了什么EGL/GLES2(Windows默认值 - 实际上是ANGLE(。
  • swiftshader:SwiftShader 软件渲染器。

DEBUG消息无害,您可以继续测试。


溶液

但是,根据最佳实践,如果您的用例涉及调用click()而不是使用visibility_of_element_located()则需要诱导WebDriverWaitelement_to_be_clickable(),如下所示:

def wait_clickability_element(self, by_type, element_name):
"""
wait for clickability of element
:param by_type: Locate element using type of element
:param element_name: element name
"""
ui.WebDriverWait(self.driver, self.timeout).until(
EC.element_to_be_clickable((by_type, element_name)))

其他注意事项

此错误可能是由ES2-only设备启动的应用引起的,即使清单需要ES3 功能也是如此。将EGL_RENDERABLE_TYPEEGL_OPENGL_ES2_BIT更新到EGL_OPENGL_ES3_BIT将解决此问题。

在 chrome 上禁用 GPU 解决了此错误。

from selenium import webdriver
chrome_opt = webdriver.ChromeOptions()
chrome_opt.add_argument('--disable-gpu')
path = r"D:/tools/chromedriver/chromedriver.exe"
driver = webdriver.Chrome(executable_path=path,chrome_options=chrome_opt)
...

使用上述选项重新运行脚本不会导致上述错误消息。

相关内容

  • 没有找到相关文章

最新更新