问题
I'm trying to delete all cookies from browser and then checking that no cookies remained. after that I ran my code I saw that still, some cookies remained... what's the problem? thanks
from selenium import webdriver
driver = webdriver.Chrome(executable_path=
"C:\\Chrome\\chromedriver.exe")
driver.get("http://www.walla.co.il")
driver.delete_all_cookies()
lst = driver.get_cookies()
for cookie in lst:
print(cookie)
回答1:
I think this problem is more related to the load time from the website. I just try your code adding a time.sleep(5) and the cookies are deleted correctly. Probably when you are trying to delete the cookies the page hasn't finished loading
来源:https://stackoverflow.com/questions/56515085/function-driver-delete-all-cookies-in-selenium-python-doesnt-delete-all-cooki