gpt4 book ai didi

c# - ChromeDriver 显示丢失的 UI 共享上下文

转载 作者:太空狗 更新时间:2023-10-29 17:44:15 24 4
gpt4 key购买 nike

我有一台运行 Windows 7 虚拟机的 Windows 10 笔记本电脑。在虚拟机内部,当我启动 WebDriver 时,它在启动时给出错误 gpu_process_transport_factory.cc<1009> Lost UI shared context:

IWebDriver driver = new ChromeDriver() //This causes the 1009 Error

ERROR

Failed to query stereo recording and Failed to send GpuChannelMsg_CreateCommandBuffer and command_buffer_proxy_impll.cc<115> 共享内存句柄无效

这已经工作了几个月并且没有做任何改变(这个 WebDriver 是虚拟机的唯一目的),运行它的笔记本电脑运行良好(即. 没有 GPU 问题)。 WebDriver 仍然在页面中导航,但会出现更多错误并且速度降低 10 倍。

编辑:将 ChromeDriver 更新到 2.35,行为仍然相同。

最佳答案

Headless ChromeGoogle TeamChrome 59 中发布,它引入了一种运行 Chrome 浏览器的方法在 headless 环境中。

注释已添加为:

Headless mode has been available on Mac and Linux since Chrome 59. Windows support came in Chrome 60.

文章Getting Started with Headless Chrome提到:

--disable-gpu \                # Temporarily needed if running on Windows.

注释已添加为:

Right now, you'll also want to include the --disable-gpu flag if you're running on Windows.

根据讨论 Headless: make --disable-gpu flag unnecessary很明显:

The --disable-gpu flag is no longer necessary on Linux or Mac OSX. It will also become unnecessary on Windows as soon as the bug SwiftShader fails an assert on Windows in headless mode is fixed.

幕后发生了什么?

根据讨论 headless: Switch from osmesa to SwiftShader当 Google/Chromium 团队决定将 SwiftShaderChrome 一起发布时,该团队考虑开始使用它在 Headless 模式下呈现 GL 内容 。这需要进行如下一些更改:

  • Headless Mode 中跳过 GPU 数据收集,因为 SwiftShader 不被该代码视为软件实现,当我们尝试从 < strong>窗口系统。
  • 如果我们打算使用 osmesa,则仅在 InitializeStaticEGLInternal 中跳过 GL 初始化SwiftShader 需要像其他非软件实现一样进行初始化。
  • SwiftShader 目前在 Mac OSX 上不受支持,因此该团队决定在 Headless 模式下继续使用物理 GPU 在那个平台上(不像其他平台上的一切都是软件呈现)。
  • 因此,为了在Headless Mode 中禁用WebGL 支持,他们决定使用--disable-gpu--disable-软件光栅化器

想法Support WebGL in headless仍在讨论中,但SwiftShader fails an assert on Windows in headless mode错误为:

[0117/125830.649194:ERROR:gpu_process_transport_factory.cc(1043)] Lost UI shared context.
DevTools listening on ws://127.0.0.1:37429/devtools/browser/1f0b2bf7-dfdd-44ac-9da7-f2659d352f0d

结论

这个错误不会影响你的@Test,你可以暂时忽略这个错误。

关于c# - ChromeDriver 显示丢失的 UI 共享上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49094399/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com