Local Storage with selenium


On 02-23-2021 code

Here is a quick way to add local storage for any website that is storing tokens inside local storage.

from selenium import webdriver   # for webdriver
# Get URL first to load page to run script
driver('https://url.com')
driver.execute_script("window.localStorage.setItem('name', 'value');")
# Refresh the page
driver('https://url.com')