【问题标题】:CefSharp GL ERROR :GL_INVALID_OPERATION : glCreateAndConsumeTextureCHROMIUM: invalid mailbox name,CefSharp GL 错误:GL_INVALID_OPERATION:glCreateAndConsumeTextureCHROMIUM:邮箱名称无效,
【发布时间】:2017-07-06 10:56:18
【问题描述】:

我插入 selenium 和 CefSharp 以协同工作,但是我记录了奇怪的错误...

[0217/000149:ERROR:gles2_cmd_decoder.cc(13988)] [.Compositor-000001C8F5CE0570]GL 错误:GL_INVALID_OPERATION:glCreateAndConsumeTextureCHROMIUM:邮箱名称无效 [0217/000149:ERROR:gles2_cmd_decoder.cc(7639)] [.Compositor-000001C8F5CE0570]渲染警告:绑定到纹理单元 0 的纹理不可渲染。它可能不是 2 的幂并且具有不兼容的纹理过滤。 [0217/001125:WARNING:dns_config_service_win.cc(673)] 读取 DnsConfig 失败。 [0217/003937:WARNING:raw_channel_win.cc(532)] WriteFile:管道正在关闭。 (0xE8) [0217/003937:WARNING:proxy_message_pipe_endpoint.cc(50)] 无法将入队消息写入通道

代码如下所示(Atm 应用程序更多的是用于调试而不是其原始目的):

using System;
using System.Linq;
using System.Windows.Forms;
using CefSharp.WinForms;
using OpenQA.Selenium.Chrome;
using System.Threading;
using System.IO;
using OpenQA.Selenium;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ChromiumWebBrowser _browser;
        private void button1_Click(object sender, EventArgs e)
        {

            _browser = new ChromiumWebBrowser("https://www.google.com/gmail/about/")
            {
                Dock = DockStyle.Fill,
            };

            Thread.Sleep(1000);
            var options = new ChromeOptions { BinaryLocation = Path.Combine(System.IO.Directory.GetCurrentDirectory().Split(new[] { "bin" }, StringSplitOptions.None)[0], @"support\cef_binary_3.2556.1368.g535c4fb_windows64_client\Release\cefclient.exe") };
           // options.AddArgument("no-sandbox");
            var cefDriver = new ChromeDriver(options);
            cefDriver.Navigate().GoToUrl("https://www.google.com/gmail/about/"); //Somewhere here error is raised that then writes a log file and pops up alert that derails whole application
            Thread.Sleep(1000);
            if (isAlertPresent(cefDriver)) {
              //  cefDriver.SwitchTo().Alert().Accept(); //This fails to close opened error dialog
            }
        }

        public bool isAlertPresent(ChromeDriver driver)
        {
            try
            {
                driver.SwitchTo().Alert();
                return true;
            }   
            catch (NoAlertPresentException Ex)
            {
                return false;
            }   
        }
    }
}

【问题讨论】:

    标签: c# selenium opengl gpu cefsharp


    【解决方案1】:

    我认为这与 UI 线程上的阻塞有关..

    下面的代码可以正常工作。

    using OpenQA.Selenium.Chrome;
    using System;
    using System.IO;
    using System.Linq;
    using System.Threading;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private async void button1_Click(object sender, EventArgs e)
            {
    
                var username = textBox1.Text;
                var password = textBox2.Text;
    
                if (new[] { username, password }.Any(o => string.IsNullOrWhiteSpace(o)))
                {
                    label3.Text = "One of'em boxes is empty";
                    return;
                }
    
                await PassLogin(username, password);
            }
    
            async Task PassLogin(string username, string password)
            {
                await Task<ChromeDriver>.Factory.StartNew(() =>
                {
                    var options = new ChromeOptions { BinaryLocation = Path.Combine(System.IO.Directory.GetCurrentDirectory().Split(new[] { "bin" }, StringSplitOptions.None)[0], @"support\cef_binary_3.2556.1368.g535c4fb_windows64_client\Release\cefclient.exe") };
                    var cefDriver = new ChromeDriver(options);
                    return cefDriver;
                }).ContinueWith(async cefDriverTask =>
                {
                    var cefDriver = await cefDriverTask;
                    cefDriver.Navigate().GoToUrl("https://www.google.com/gmail/about/");
                    cefDriver.FindElementByCssSelector(".gmail-nav__nav-link.gmail-nav__nav-link__sign-in").Click();
                    var user = cefDriver.FindElementById("Email");
                    user.SendKeys(username);
                    cefDriver.FindElementById("next").Click();
                    Thread.Sleep(100);
                    var pass = cefDriver.FindElementById("Passwd");
                    user.SendKeys(password);
                    cefDriver.FindElementById("signIn").Click();
                });
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-14
      • 1970-01-01
      • 1970-01-01
      • 2011-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多