Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Chrome canary无头模式在windows10上不起作用_Python 3.x_Google Chrome_Selenium Webdriver_Selenium Chromedriver - Fatal编程技术网

Python 3.x Chrome canary无头模式在windows10上不起作用

Python 3.x Chrome canary无头模式在windows10上不起作用,python-3.x,google-chrome,selenium-webdriver,selenium-chromedriver,Python 3.x,Google Chrome,Selenium Webdriver,Selenium Chromedriver,谷歌Chrome Canary不能在Windows上使用headless Chrome headless在windows上不起作用。 当我试图执行下面的代码时,出现如下错误。 但它在无头模式下工作 我知道金丝雀是不稳定的,但我想用它来学习网络高级规范 这个错误是由金丝雀的虫子引起的吗? 还是由我的代码引起的 代码: 错误: [1205/232511.644:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.

谷歌Chrome Canary不能在Windows上使用headless

Chrome headless在windows上不起作用。 当我试图执行下面的代码时,出现如下错误。 但它在无头模式下工作

我知道金丝雀是不稳定的,但我想用它来学习网络高级规范

这个错误是由金丝雀的虫子引起的吗? 还是由我的代码引起的

代码:

错误:

[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
操作系统:windows 10 Home 1709
Chrome:65.0.3285.0(官方版本)金丝雀64位

ChromeDriver:2.33.506120

因为您的错误日志报告如下:

[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
我建议采取以下步骤:

  • 通过
    Revo卸载程序从您的系统中卸载
    Google Chrome Canary
  • 使用
    CCleaner
    工具清除所有操作系统杂务
  • 安装fresh
    Google Chrome Canary
  • 使用以下代码块:

    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/")
    
您可以在讨论中找到使用多个
浏览器二进制文件的多种方法

“我知道金丝雀是不稳定的”-那么问题是什么?可能的复制品
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/")