是否可以使用扩展程序在无头模式下运行 Google Chrome? [英] Is it possible to run Google Chrome in headless mode with extensions?

查看:41
本文介绍了是否可以使用扩展程序在无头模式下运行 Google Chrome?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用 Headless 模式在 Google Chrome 中使用我当前安装的扩展程序.有没有办法启用它们?

检查扩展程序是否有效的一种简单方法是添加,例如,

但是,如果我使用无头模式(google-chrome --headless --disable-gpu --screenshot https://www.google.com)截取页面的屏幕截图,结果是:

解决方案

不,这是不可能的,Chrome 开发人员 由于任务的复杂性,决定在不久的将来不实施它.

如果您查看该问题,您可能会认为由于 ChromeDriver 的要求,他们仍在考虑它 - 但他们决定让 ChromeDriver 在没有扩展程序的情况下工作(通过 DevTools).

I cannot use my currently installed extensions in Google Chrome using headless mode. Is there any way to enable them?

An easy way to check if the extensions work is by adding, for example, the "Comic Sans Everything" extension.

So Google looks like that:

However, if I take a screenshot of the page using the headless mode (google-chrome --headless --disable-gpu --screenshot https://www.google.com), the result is:

解决方案

No, it's not possible, and Chrome developers decided against implementing it in any near future due to complexity of the task.

If you look at that issue you may get the idea that they are still considering it due to ChromeDriver requirements - but instead they decided to make ChromeDriver work without extensions (through DevTools).

这篇关于是否可以使用扩展程序在无头模式下运行 Google Chrome?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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