首页 > 解决方案 > 带有权限策略的无头 Chrome 错误

问题描述

如何使用硒以无头模式打开chrome?我试过了

chromeOptions = Options()
chromeOptions.add_argument("--headless")
self.driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chromeOptions)

但这只会返回一个错误:

Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.", source: (0)

此外,它会将我重定向到一个网页,上面写着“Cloudfare 提供的 DDOS 保护。请等待 5 秒”,而不是获取我想要的网页。

标签: pythonseleniumweb-scrapingheadlessgoogle-chrome-headless

解决方案


推荐阅读