简体   繁体   English

Chrome Canary无头模式在Windows10上不起作用

[英]Chrome canary headless mode does not work on windows10

Google Chrome Canary does not work with headless on Windows. Google Chrome Canary在Windows上无法正常运行。

Chrome headless does not work on windows. Chrome无头浏览器无法在Windows上使用。 The Error happens like following when I tried to execute below code. 当我尝试执行以下代码时,发生如下错误。 But it works on non-headless mode. 但它适用于非无头模式。

I know Canary is unstable but I want to using it to learning about web advanced spec. 我知道Canary不稳定,但是我想用它来学习Web高级规范。

This error caused by bug in canary? 这个错误是由金丝雀中的错误引起的吗? Or caused by my code? 还是由我的代码引起的?

code: 码:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

op = Options()
op.binary_location = "C:\\Users\\username\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe"
op.add_argument("--headless")
op.add_argument("--disable-gpu")

driver = webdriver.Chrome("chromedriver.exe", chrome_options=op)

driver.get("http://www.google.com")

Error: 错误:

[1205/232511.644:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
[1205/232511.644:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.644:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics

DevTools listening on ws://127.0.0.1:12022/devtools/browser/3d7c8ff8-625a-4326-b968-bbff
[1205/232511.714:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.714:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
[1205/232511.714:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.714:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
[1205/232513.037:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232513.037:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics

OS: windows 10 Home 1709 操作系统:Windows 10 Home 1709
Chrome: 65.0.3285.0 (Official Build) canary 64bit Chrome:65.0.3285.0(Official Build)金丝雀64位
ChromeDriver: 2.33.506120 ChromeDriver:2.33.506120

As your error logs reports as follows : 由于错误日志报告如下:

[1205/232511.644:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
[1205/232511.644:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[1205/232511.644:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics

I will suggest the following steps : 我将建议以下步骤:

  • Uninstall Google Chrome Canary from your system through Revo Uninstaller 通过Revo Uninstaller从系统上卸载Google Chrome Canary
  • Use CCleaner tool to wipe off all the OS chores. 使用CCleaner工具清除所有操作系统琐事。
  • Install fresh Google Chrome Canary 安装新的Google Chrome Canary
  • Use the following code block : 使用以下代码块:

     from selenium import webdriver from selenium.webdriver.chrome.options import Options op = Options() op.binary_location = "C:\\\\Users\\\\username\\\\AppData\\\\Local\\\\Google\\\\Chrome SxS\\\\Application\\\\chrome.exe" op.add_argument("--headless") op.add_argument("--disable-gpu") driver = webdriver.Chrome(chrome_options=op, executable_path=r'C:\\path\\to\\chromedriver.exe') driver.get("http://google.com/") 

You can find about multiple ways to work with multiple Chrome Browser Binaries in Set chrome browser binary to chrome webdriver in Python discussion. 您可以Set chrome browser binary to chrome webdriver in Python讨论中的Set chrome browser binary to chrome webdriver in Python找到使用多种Chrome Browser Binaries多种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM