get_cookies() 获得所有的cookies
get_cookie(name) 返回字典中key为“name”的cookies
add_cookie(cookie_dict) 添加Cookie
delete_cookie(name,optionsString) 删除名为OpenString的Cookie
delete_all_cookies() 删除所有Cookie
==获取所有Cookies==
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://baidu.com")
#获得所有的Cookie信息并打印
cookie = driver.get_cookies()
print(cookie)
==添加cookies==
driver.add_cookie({‘name’:key-aaaaaaa‘,’value‘:’value‘;'value-bbbbb')}
#遍历指定的cookies
for cookie in driver.ge_cookes():
print("%s -> %s" %(cookie['name']),cookie['value'])