findelement

master
ZouJiu 2024-02-04 18:10:44 +08:00
parent 7d0e35d4f0
commit ee0478010d
1 changed files with 2 additions and 0 deletions

View File

@ -925,6 +925,8 @@ def login_loadsavecookie():
try: try:
load_cookie(driver, cookie_path) load_cookie(driver, cookie_path)
driver.get(r"https://www.zhihu.com/") driver.get(r"https://www.zhihu.com/")
WebDriverWait(driver, timeout=10).until(lambda d: d.find_element(By.ID, 'Popover15-toggle'))
toggle = driver.find_element(By.ID, 'Popover15-toggle')
except Exception as e: except Exception as e:
if os.path.exists(cookie_path): if os.path.exists(cookie_path):
os.remove(cookie_path) os.remove(cookie_path)