

def save_session(self, value): """ 1. 其中localStorage、token關鍵字是需要根據自己實際情況填寫的 localStorage:目標系統,需要查看自己的token是存在localStorage中,還是sessionStorage。 我的是存在localStorage中,如上圖1所示 token:變量名,需要查看自己的token所對應的變量是什么,我這里是token,如上圖2所示 2. return是必須要有的, 否則返回值會為None 3. 這個方法必須放在登錄的下一步就使用,如果你放在其它階段獲取出來的token是為None值的 """
while True:
token = self.driver.execute_script(f'return localStorage.getItem("{value}")')
if token:
return token
