问题
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 ES
3 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