【发布时间】:2021-10-06 08:11:19
【问题描述】:
我要使用浏览器中已经存在的 cookie 并在 Selenium 中使用它,我知道你不能只使用 Selenium 来使用它,但是有没有我可以使用的库来将 cookie 保存在 json 中变量并在 Selenium 中使用它?如何使用python提取保存在浏览器中的cookie?不仅是 Chrome,其他的也最好。
这是我目前的代码:
option = Options()
option.add_argument("--no-sandbox")
driver = webdriver.Chrome(options=option)
driver.get("https://google.com")
wait = WebDriverWait(driver, 5)
如何从浏览器获取 cookie,将其保存为 json 格式并与 Selenium 一起使用?
【问题讨论】:
标签: python python-3.x python-2.7 selenium