当使用selenium打开网页时,它会自动删除您在浏览器中保存的所有cookie,这是不方便的。
在这个页面java solution中找到解决方案,但不知道如何使用Python解决问题。
发布于 2016-05-21 20:01:03
将浏览器指向一个概要文件(这就是给定链接中的java示例所做的)
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('user-data-dir=<path to chrome profile>')
browser = webdriver.Chrome(chrome_options=chrome_options)
在Linux上,<path to chrome profile>
是/home/<user>/.config/google-chrome
。
https://stackoverflow.com/questions/37358546
复制相似问题