"Error with Permissions-Policy header", when using Chromedriver to a Headless Browser
30,379
Solution 1
This is the new header used to block Google's new tracking technology called Federated Cohorts of Learning (FLoC).
The header is being used by DDG to block FLoC tracking.
DuckDuckGo Announces Plans to Block Google’s FLoC
You get the same warning in Chrome dev tools if you access any website that blocks FLoC.
To block Google's FLoC on your own website, add the following header:
permissions-policy: interest-cohort=()
Solution 2
If you just want to remove those warning messages then add
chrome_options.add_argument('--log-level=1')
More info here List of Chromium Command Line Switches
log-level: Sets the minimum log level.
Valid values are from 0 to 3:
INFO = 0 (default)
WARNING = 1
LOG_ERROR = 2
LOG_FATAL = 3
Author by
AamenIs
Updated on July 09, 2022Comments
-
AamenIs almost 2 years
On Selenium, I am using chromedriver version 89 and my chrome browser version 89.0. too. When I run my code on a headless browser, I got an error; turn chrome to a headless browser to test the result. Here is my script-
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options from shutil import which chrome_options = Options() chrome_options.add_argument("--headless") chrome_path = which("chromedriver") driver = webdriver.Chrome(executable_path=chrome_path, options=chrome_options) driver.get("https://duckduckgo.com/") search_input = driver.find_element_by_id("search_form_input_homepage") search_input.send_keys("My User Agent") search_input.send_keys(Keys.ENTER)
And here is the VSCODE Terminal Output,
DevTools listening on ws://127.0.0.1:57195/devtools/browser/7464cfb0-5b3c-497d-a768-6eae3bb5b59b [0408/112137.788:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.", source: (0) [0408/112138.552:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.", source: (0) [0408/112139.176:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.", source: (0) [0408/112139.483:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.", source: (0)
-
Aidin about 3 yearsThis post clarifies some of the misinformation about this header. Worth reading before adding the header to your site: seirdy.one/2021/04/16/permissions-policy-floc-misinfo.html
-
Ray Foss almost 3 yearsLooks like GitLab does this wholesale... including in your Gitlab Pages docs.gitlab.com/ee/user/admin_area/settings/floc.html Gitlab Pages are mostly free, but this does mean you may have practically no data on visitors at all, without cloudflare or some stateful backend.