Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 352
Joseph Jones Avatar asked Jul 18 '19 08:07

Joseph Jones


2 Answers

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.

like image 177
undetected Selenium Avatar answered Nov 17 '22 11:11

undetected Selenium


The chrome://gpu page was a good lead. My experience was: disabling hardware acceleration in the settings menu caused error messages to stop, but made a Babylon.js demo I was using as a benchmark run very slowly. I went through and enabled all of the functionalities that were in red on chrome://gpu. I now have a new error on start-up of Chrome that doesn't repeat:

[13837:13837:0505/004321.484642:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.

With the occasional:

[13801:13801:0505/005551.603893:ERROR:CONSOLE(15)] "Uncaught TypeError: Do not know how to serialize a BigInt", source: chrome://gpu/vulkan_info.js (15)

The benchmark runs well now, though. Hopefully, this works for someone besides me. I'm on Linux with an AMD GPU driver, and judging by the "Problems Detected" portion, I suspect that is a contributing factor in my case. Well, good luck!

like image 42
Adam Rufle Avatar answered Nov 17 '22 11:11

Adam Rufle