3👍
✅
Yes, you have to return from the JS script in order to see the value at the Python level:
print(self.selenium.execute_script('return localStorage.getItem("token");'))
Source:stackexchange.com