Python Selenium中的Chrome选项:禁用GPU与无头 [英] Chrome Options in Python Selenium : Disable GPU vs Headless

查看:965
本文介绍了Python Selenium中的Chrome选项:禁用GPU与无头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在python-selenium chrome_options中,以下两个选项之间的区别到底是什么?我知道这两个选项都在运行selenium脚本时没有打开浏览器.

In python-selenium chrome_options, What exactly is the difference between the following two options, I know both runs the selenium script without opening the browser.

chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')

推荐答案

您看对了.添加参数 --headless 会以 headless 模式启动 Chrome浏览上下文.

You saw it right. Adding the argument --headless initiates the Chrome Browsing Context in headless mode.

但是参数 --disable-gpu 的目的是启用 'windows'"rel =" tag> windows 平台.由于 SwiftShader无法在Windows的无头模式下断言,所以需要它 之前.

However the purpose of the argument --disable-gpu was to enable google-chrome-headless on windows platform. It was needed as SwiftShader fails an assert on Windows in headless mode earlier.

此问题已通过已解决 :使--disable-gpu标志不必要

This issue was resolved through Headless: make --disable-gpu flag unnecessary

您可以在 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆