cookie = driver.get_cookies()
cookie_parse = dict()
for ck in cookie:
cookie_parse[ck['name']] = ck['value']
# 将字典拼成字符串
cookies = ''.join([str(k) + '=' + str(v) + ';' for k, v in cookie_parse.items()])
# 一行代码
# cookie = {c["name"]: c["value"] for c in driver.get_cookies()}
在这里插入代码片