title: How to save values permanently in Local storage using selenium in Python
body: <p>I am trying to save values in Local storage so that I'm able to access them again after I close and reopen a new session with selenium. I'm able to save and access values from the same session but when I close the browser then try to access the stored variable, it shows as null:</p>
  <pre><code>from selenium import webdriver
  
  driver = webdriver.Chrome()
  driver.get(&quot;https://www.google.com&quot;)
  driver.execute_script(&quot;localStorage.setItem('testkey', 'myValue');&quot;)
  driver.execute_script(&quot;alert (localStorage.getItem('testkey'));&quot;)
  </code></pre>
  <p>The alert occurs as expected when I run the above but when I close and reopen the browser and run the above code after commenting out the <code>setItem</code> line, the alert shows null. How can I get this working, or is there any other way I can persist values that are set from javascript?</p>