我在 chrome 中禁用了加载图像,同时使用带有 selenium 的 webdriver 现在无法启用它

I disabled loading images in chrome while using webdriver with selenium now cant enable it

我在 chrome 中禁用了加载图像,同时使用带有 selenium 的 webdriver 现在无法启用它。

我正在使用 python 在 Instagram 上进行网络抓取,所以我认为禁用图像是个好主意。

我使用的命令:

options = webdriver.ChromeOptions()
options.add_argument("--disable-gpu=true")
options.add_argument("--blink-settings=imagesEnabled=false")

现在我无法从 chrome 设置中更改它。

Screenshot of chrome settings page.

请帮忙。

编辑:这只发生在我的默认 Chrome 配置文件中。其他配置文件工作正常,即使我用于 selenium 的配置文件是不同的。

经过漫长的一天 google 终于找到了解决方案。

options.add_experimental_option("prefs", {'profile.managed_default_content_settings.images': 1})