How to address the error EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute using Selenium and Python

会有一股神秘感。 提交于 2021-02-19 01:24:39

问题


I'm getting random error messages from selenium, even though none of them are related to the exact web driver commands I'm running (not that I know of).

This error isn't interrupting the program, it's just adding unwanted alerts (making my prints harder to read).

  • Chrome version: 75.0.3770.100 (Official Build) (64-bit)
  • Python version: 3.6.1
  • ChromeDriver version: 75.0.3770.140

I've added the following code already but I'm still getting the error.

options.add_argument("--log-level=3")

Error:

gl_surface_egl.cc(544) - EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute.

回答1:


This random error message...

gl_surface_egl.cc(544) - EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute.

...is coming from the LogEGLDebugMessage() method as there was an error with one of the GL Switches

This error is defined in gl_surface_egl.cc as follows:

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;

Deep Dive

As per the documentation in List of Chromium Command Line Switches the argument --use-gl selects which implementation of GL the GPU process should be used and the available options are:

  • desktop: whatever desktop OpenGL the user has installed (Linux and Mac default).
  • egl: whatever EGL / GLES2 the user has installed (Windows default - actually ANGLE).
  • swiftshader: The SwiftShader software renderer.

This DEBUG message is not harmful and you can continue with your tests.


Solution

If your usecase involves invoking click() or send_keys() method, you need to induce WebDriverWait for the element_to_be_clickable() as follows:

  • Invoking click():

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "element_css"))).click()
    
  • Invoking send_keys():

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "element_xpath"))).send_keys("Joseph Jones")
    

Additional consideration

Possibly this error is caused by the app getting launched by ES2-only devices, even though the manifest requires ES3 capability. Updating EGL_RENDERABLE_TYPE from EGL_OPENGL_ES2_BIT to EGL_OPENGL_ES3_BIT will solve this issue.



来源:https://stackoverflow.com/questions/57090258/how-to-address-the-error-egl-driver-message-error-eglquerydeviceattribext-bad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!