当chrome浏览器午餐后,我们在下面收到错误消息,并且在下面关于chrome和硒的问题的任何观点(使用python的情况下)
在ws://127.0.0.1:12306 / devtools / browser / 14f00afd-581d-4a48-9141-8ab74c3355cf上侦听的DevTools [1005 / 210449.408:ERROR:gl_surface_egl.cc(612)] EGL驱动程序消息(错误)eglQueryDeviceAttribEXT:错误的属性。 [1005 / 210503.773:ERROR:context_group.cc(151)] ContextResult :: kFatalFailure:WebGL2已列入黑名单 [1005 / 210508.959:ERROR:shared_image_manager.cc(120)] SharedImageManager :: ProduceGLTexture:尝试从不存在的邮箱中生成表示形式。 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错误:GL_INVALID_OPERATION:DoCreateAndTexStorage2DSharedImageINTERNAL:无效的邮箱名称 [1005 / 210508.960:ERROR:gles2_cmd_decoder.cc(18529)] [.DisplayCompositor] GL错误:GL_INVALID_OPERATION:DoBeginSharedImageAccessCHROMIUM:绑定纹理不是共享图像 [1005 / 210508.961:ERROR:gles2_cmd_decoder.cc(10742)] [.DisplayCompositor]渲染警告:绑定到纹理单元0的纹理不可渲染。它可能不是2的幂或不完整 可以进行纹理过滤(也许)? [1005 / 210508.962:ERROR:gles2_cmd_decoder.cc(18552)] [.DisplayCompositor] GL错误:GL_INVALID_OPERATION:DoEndSharedImageAccessCHROMIUM:绑定纹理不是共享图像 [1005 / 210509.027:ERROR:gles2_cmd_decoder.cc(18529)] [.DisplayCompositor] GL错误:GL_INVALID_OPERATION:DoBeginSharedImageAccessCHROMIUM:绑定纹理不是共享图像 [1005 / 210509.028:错误:gles2_cmd_decoder.cc(10742)] [.DisplayCompositor]渲染警告:绑定到纹理单元0的纹理无法渲染。它可能不是2的幂或不完整 可以进行纹理过滤(也许)? [1005 / 210509.028:ERROR:gles2_cmd_decoder.cc(18552)] [.DisplayCompositor] GL错误:GL_INVALID_OPERATION:DoEndSharedImageAccessCHROMIUM:绑定纹理不是共享图像 [1005 / 210509.673:错误:gles2_cmd_decoder.cc(18529)] [.DisplayCompositor] GL错误:GL_INVALID_OPERATION:DoBeginSharedImageAccessCHROMIUM:绑定纹理不是共享图像 [1005 / 210509.674:错误:gles2_cmd_decoder.cc(10742)] [.DisplayCompositor]渲染警告:绑定到纹理单元0的纹理无法渲染。它可能不是2的幂或不完整 可以进行纹理过滤(也许)? [1005 / 210509.674:ERROR:gles2_cmd_decoder.cc(18552)] [.DisplayCompositor] GL错误:GL_INVALID_OPERATION:DoEndSharedImageAccessCHROMIUM:绑定纹理不是共享图像 10/05/2019 09:05:16 PM ama-cloude webtext:alexa香港现在几点了,现在是早上6:50。
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)))
答案 0 :(得分:1)
此错误消息...
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;
根据List of Chromium Command Line Switches中的文档,参数--use-gl
选择应使用GPU进程的GL实现,并且可用的选项为:
此 DEBUG 消息无害,您可以继续进行测试。
但是,按照最佳实践,如果您的用例涉及调用click()
而不是使用visibility_of_element_located()
,则需要为element_to_be_clickable()
引入 WebDriverWait ,如下所示:< / p>
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
设备启动的应用引起的,即使清单要求具备ES
3的功能。将EGL_RENDERABLE_TYPE
从EGL_OPENGL_ES2_BIT
更新为 EGL_OPENGL_ES3_BIT
将解决此问题。
答案 1 :(得分:0)
在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)
...
使用上述选项运行脚本不会导致上述错误消息。