'Error when using get_log() in Selenium Python

I'm trying to fetch Authorisation Bearer after I login to my website but keep getting this error:

CODE:

driver = webdriver.Chrome(executable_path=r"your_path")
har = json.loads(driver.get_log('har')[0]['message']) # get the log
print('headers: ', har['log']['entries'][0]['request']['headers'])

Error:

Message: invalid argument: log type 'har' not found


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source